Coder Social home page Coder Social logo

Comments (10)

floooh avatar floooh commented on August 24, 2024 4

Ok! I'll close this issue then. Please open another issue for that crash if you're stuck!

from sokol.

floooh avatar floooh commented on August 24, 2024

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:

sokol/sokol_gfx.h

Lines 10757 to 10770 in 5bfa842

#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 120000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000)
if (@available(macOS 12.0, iOS 14.0, *)) {
_sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyApple7]
|| [_sg.mtl.device supportsFamily:MTLGPUFamilyApple8]
|| [_sg.mtl.device supportsFamily:MTLGPUFamilyMac2];
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 130000) || (__IPHONE_OS_VERSION_MAX_ALLOWED >= 160000)
if (!_sg.features.image_clamp_to_border) {
if (@available(macOS 13.0, iOS 16.0, *)) {
_sg.features.image_clamp_to_border = [_sg.mtl.device supportsFamily:MTLGPUFamilyMetal3];
}
}
#endif
}
#endif

from sokol.

kkukshtel avatar kkukshtel commented on August 24, 2024

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.

from sokol.

floooh avatar floooh commented on August 24, 2024

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.

from sokol.

floooh avatar floooh commented on August 24, 2024

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 :)

from sokol.

floooh avatar floooh commented on August 24, 2024

It's really strange, there's nothing in the Metal headers (of SDK 14.0 at least) which would indicate when MTLGPUFamilyApple8 became available:

image

from sokol.

floooh avatar floooh commented on August 24, 2024

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

from sokol.

floooh avatar floooh commented on August 24, 2024

...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...

from sokol.

floooh avatar floooh commented on August 24, 2024

...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?

from sokol.

kkukshtel avatar kkukshtel commented on August 24, 2024

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));

from sokol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.