fix crash on iOS <16 and macOS <13

- MTLComputePipelineReflection.bindings are only available from iOS 16 and macOS 13, before that MTLComputePipelineReflection.arguments should be used
- Same issue with MTLRenderPipelineReflection.vertexBindings and MTLRenderPipelineReflection.fragmentBindings

Added availability check to fix it.
This commit is contained in:
Adrien Duermael 2023-04-21 15:59:39 +02:00
parent 6dd8edc4b1
commit ef5937bd51

View File

@ -2337,7 +2337,19 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
if (NULL != reflection)
{
#if BX_PLATFORM_IOS
if (@available(iOS 16, *)) {
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
} else {
processArguments(pso, reflection.vertexArguments, reflection.fragmentArguments);
}
#elif BX_PLATFORM_OSX
if (@available(macOS 13, *)) {
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
} else {
processArguments(pso, reflection.vertexArguments, reflection.fragmentArguments);
}
#endif
}
}
@ -2384,7 +2396,20 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
, MTLPipelineOptionBufferTypeInfo
, &reflection
);
#if BX_PLATFORM_IOS
if (@available(iOS 16, *)) {
processArguments(pso, reflection.bindings, NULL);
} else {
processArguments(pso, reflection.arguments, NULL);
}
#elif BX_PLATFORM_OSX
if (@available(macOS 13, *)) {
processArguments(pso, reflection.bindings, NULL);
} else {
processArguments(pso, reflection.arguments, NULL);
}
#endif
for (uint32_t ii = 0; ii < 3; ++ii)
{