Skip to content

Commit

Permalink
Fix simulator feature discovery
Browse files Browse the repository at this point in the history
Fix depth clamp and texture swizzle feature discovery on simulator builds

Both of these features are not supported by the iphone simulator
and leads to crashes when used
  • Loading branch information
Dani Frank committed May 12, 2023
1 parent dfc0af8 commit 68225e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,11 @@
if ( mvkOSVersionIsAtLeast(13.0) ) {
_metalFeatures.mslVersionEnum = MTLLanguageVersion2_2;
_metalFeatures.placementHeaps = mvkConfig().useMTLHeap;
#if MVK_OS_SIMULATOR
_metalFeatures.nativeTextureSwizzle = false;
#else
_metalFeatures.nativeTextureSwizzle = true;
#endif
if (supportsMTLGPUFamily(Apple3)) {
_metalFeatures.native3DCompressedTextures = true;
}
Expand Down Expand Up @@ -2196,9 +2200,13 @@
_features.dualSrcBlend = true;
}

#if MVK_OS_SIMULATOR
_features.depthClamp = false;
#else
if (supportsMTLFeatureSet(iOS_GPUFamily2_v4)) {
_features.depthClamp = true;
}
#endif

if (supportsMTLFeatureSet(iOS_GPUFamily3_v2)) {
_features.tessellationShader = true;
Expand Down

0 comments on commit 68225e4

Please sign in to comment.