Closed kkukshtel closed 9 months ago
Strange indeed, according to here MTLGPUFamilyApple8
should be available since macOS SDK 10.15+
https://developer.apple.com/documentation/metal/mtlgpufamily/mtlgpufamilyapple8
What does xcrun --sdk macosx --show-sdk-path
say? (to check what SDK version is used, for instance here it says: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
)
I was hoping that the way I'm conditionally compiling this code inside ifdefs would fix the issue now for older SDK version, but looks I did something wrong there:
Just ran:
xcrun --sdk macosx --show-sdk-path
And it's showing:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
I assume this means I could fix this by upgrading Xcode then? Though I would definitely expect yeah that it should still work with older versions.
Hmm ok, getting closer. On my old Intel Mac with SDK 11.3 this whole code block is skipped, so it builds just fine.
But the code block is compiled with SDK 12.x, but I guess this MTLGPUFamily8
is not yet defined in SDK 12.3 (which means the documentation is wrong, but that's not unusual unfortunately).
Upgrading the SDK or even Xcode would workaround the problem, but I'd better find a solution that also works with the 12.3 SDK, I just need to add a couple more ifdefs I guess.
I'll try to look into this in the evening, but it'll be a bit hard for me to test.
Btw, this define shouldn't be needed:
#define USE_SOKOL_APP
...also SOKOL_LOG has been replaced with the new runtime logging callback and sokol_log.h :)
It's really strange, there's nothing in the Metal headers (of SDK 14.0 at least) which would indicate when MTLGPUFamilyApple8
became available:
Can you check what this enum MTLGPUFamily
looks like on your SDK version? The path for your SDK version should be:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h
...I'm actually wondering why I explicitely added the MTLGPUFamily8 check, I would expect that this is a superset of MTLGPUFamily7... need to dig around a bit in the git history...
...yeah I simply removed the MTLGPUFamily8 check since the clamp_to_border_color feature should be covered by MTLGPUFamily7.
Can you check if this works for you now?
Just tried latest and it seems to compile without issue! However the program crashes on sokol_gfx setup but I think that's an issue for me and bindings.
Just for reference though, here's the enum for me:
Can you check what this enum
MTLGPUFamily
looks like on your SDK version? The path for your SDK version should be:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h
typedef NS_ENUM(NSInteger, MTLGPUFamily)
{
MTLGPUFamilyApple1 = 1001,
MTLGPUFamilyApple2 = 1002,
MTLGPUFamilyApple3 = 1003,
MTLGPUFamilyApple4 = 1004,
MTLGPUFamilyApple5 = 1005,
MTLGPUFamilyApple6 = 1006,
MTLGPUFamilyApple7 = 1007,
MTLGPUFamilyMac1 = 2001,
MTLGPUFamilyMac2 = 2002,
MTLGPUFamilyCommon1 = 3001,
MTLGPUFamilyCommon2 = 3002,
MTLGPUFamilyCommon3 = 3003,
MTLGPUFamilyMacCatalyst1 = 4001,
MTLGPUFamilyMacCatalyst2 = 4002,
} API_AVAILABLE(macos(10.15), ios(13.0));
Ok! I'll close this issue then. Please open another issue for that crash if you're stuck!
As the title says — trying to compile sokol_gfx to a library (using zig build) on macOS 12.4 on a 2021 M1 Pro laptop and getting the following error:
My sokol.c:
I was getting a similar error recently but for
MTLGPUFamilyApple7
but then I went to latest sokol master commit and that one went away. Not sure what's up but it seems like maybe an assumption of Metal versions available for OSs?