Skip to content

Commit

Permalink
Restore old macOS support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcourteaux committed Apr 29, 2024
1 parent 1138cc0 commit 2f2b3fa
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/renderer_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,8 @@ void processArguments(
{
BX_TRACE("arg: %s type:%d", utf8String(arg.name), arg.type);

if (arg.used)
if ( ( @available(macOS 13.0, iOS 16.0, *) && arg.used)
|| (!@available(macOS 13.0, iOS 16.0, *) && [arg isActive]))
{
if (arg.type == MTLBindingTypeBuffer)
{
Expand Down Expand Up @@ -2357,8 +2358,20 @@ void processArguments(
pso->m_rps = m_device.newRenderPipelineStateWithDescriptor(pd, MTLPipelineOptionBufferTypeInfo, &reflection);

if (NULL != reflection)
{
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
{
#if BX_PLATFORM_IOS
if (@available(iOS 16.0, *)) {
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
} else {
processArguments(pso, reflection.vertexArguments, reflection.fragmentArguments);
}
#elif BX_PLATFORM_OSX
if (@available(macOS 13.0, *)) {
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
} else {
processArguments(pso, reflection.vertexArguments, reflection.fragmentArguments);
}
#endif
}
}

Expand Down Expand Up @@ -2405,7 +2418,12 @@ void processArguments(
, MTLPipelineOptionBufferTypeInfo
, &reflection
);
processArguments(pso, reflection.bindings, NULL);

if (@available(macOS 13.0, iOS 16.0, *)) {
processArguments(pso, reflection.bindings, NULL);
} else {
processArguments(pso, reflection.arguments, NULL);
}

for (uint32_t ii = 0; ii < 3; ++ii)
{
Expand Down

0 comments on commit 2f2b3fa

Please sign in to comment.