Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macOS and iOS builds on older versions of Xcode #3116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/renderer_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@
BGFX_PROFILER_END(); \
BX_MACRO_BLOCK_END

#ifndef BX_XCODE_14
# define BX_XCODE_14 ((__MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) || \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 160000))
#endif
#ifndef BX_XCODE_13
# define BX_XCODE_13 ((__MAC_OS_X_VERSION_MAX_ALLOWED >= 120000) || \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 150000))
#endif
#ifndef BX_XCODE_12
# define BX_XCODE_12 ((__MAC_OS_X_VERSION_MAX_ALLOWED >= 110000) || \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000))
#endif

#if !(BX_PLATFORM_IOS || (BX_PLATFORM_OSX && BX_XCODE_12))
# define MTLGPUFamilyApple6 MTLGPUFamily(1006)
#endif
#if !((BX_PLATFORM_IOS || BX_PLATFORM_OSX) && BX_XCODE_12)
# define MTLGPUFamilyApple7 MTLGPUFamily(1007)
#endif
#if !(BX_XCODE_14 || (BX_PLATFORM_IOS && BX_XCODE_13))
# define MTLGPUFamilyApple8 MTLGPUFamily(1008)
#endif

namespace bgfx { namespace mtl
{
//runtime os check
Expand Down
8 changes: 8 additions & 0 deletions src/renderer_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,11 @@ void processArguments(

if (NULL != reflection)
{
#if BX_XCODE_14
processArguments(pso, reflection.vertexBindings, reflection.fragmentBindings);
#else
processArguments(pso, reflection.vertexArguments, reflection.fragmentArguments);
#endif
}
}

Expand Down Expand Up @@ -2384,7 +2388,11 @@ void processArguments(
, MTLPipelineOptionBufferTypeInfo
, &reflection
);
#if BX_XCODE_14
processArguments(pso, reflection.bindings, NULL);
#else
processArguments(pso, reflection.arguments, NULL);
#endif

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