[dawn][metal] Allow base vertex/instance draws on the iOS Simulator The iOS Simulator only advertises the MTLFeatureSet_iOS_GPUFamily2 feature set, but base vertex/instance draws execute correctly there because Metal commands are serviced by the host GPU, which always supports them. The fix has been verified on the React Native WebGPU test suite. Bug: None Change-Id: I52996fc0bc521469ae73b5ebc3eb79e50fbc45e0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/324776 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/native/metal/PhysicalDeviceMTL.mm b/src/dawn/native/metal/PhysicalDeviceMTL.mm index 6ac2615..1775aca 100644 --- a/src/dawn/native/metal/PhysicalDeviceMTL.mm +++ b/src/dawn/native/metal/PhysicalDeviceMTL.mm
@@ -416,7 +416,12 @@ deviceToggles->Default(Toggle::MetalUseArgumentBuffers, false); bool haveBaseVertexBaseInstance = true; -#if DAWN_PLATFORM_IS(IOS) && !DAWN_PLATFORM_IS(TVOS) && \ + // The iOS Simulator only advertises the MTLFeatureSet_iOS_GPUFamily2 feature set, but + // base vertex/instance draws execute correctly there because Metal commands are serviced + // by the host GPU, which always supports them. + // NOTE: TARGET_OS_SIMULATOR can be defined but set to false for MacOS builds. +#if DAWN_PLATFORM_IS(IOS) && !DAWN_PLATFORM_IS(TVOS) && \ + (!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR) && \ (!defined(__IPHONE_16_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_16_0) haveBaseVertexBaseInstance = [*mDevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]; #endif