thatcosmonaut / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
1 stars 1 forks source link

macOS 11.x SDK Compatibility #33

Open flibitijibibo opened 3 weeks ago

flibitijibibo commented 3 weeks ago

Other than the camera implementation, GPU is the only subsystem with >10.14 SDK requirements:

/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:102:5: error: 'MTLPixelFormatB5G6R5Unorm' is unavailable: not available on macOS
    MTLPixelFormatB5G6R5Unorm, /* R5G6B5 */   /* FIXME: Swizzle? */
    ^
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:43:5: note: 'MTLPixelFormatB5G6R5Unorm' has been explicitly marked unavailable here
    MTLPixelFormatB5G6R5Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 40,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:103:5: error: 'MTLPixelFormatA1BGR5Unorm' is unavailable: not available on macOS
    MTLPixelFormatA1BGR5Unorm, /* A1R5G5B5 */ /* FIXME: Swizzle? */
    ^
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:44:5: note: 'MTLPixelFormatA1BGR5Unorm' has been explicitly marked unavailable here
    MTLPixelFormatA1BGR5Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 41,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:104:5: error: 'MTLPixelFormatABGR4Unorm' is unavailable: not available on macOS
    MTLPixelFormatABGR4Unorm,                 /* B4G4R4A4 */
    ^
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:45:5: note: 'MTLPixelFormatABGR4Unorm' has been explicitly marked unavailable here
    MTLPixelFormatABGR4Unorm  API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 42,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:106:5: warning: 'MTLPixelFormatBGR10A2Unorm' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
    MTLPixelFormatBGR10A2Unorm,               /* A2B10G10R10 */
    ^
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h:78:5: note: 'MTLPixelFormatBGR10A2Unorm' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
    MTLPixelFormatBGR10A2Unorm  API_AVAILABLE(macos(10.13), ios(11.0)) = 94,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:99:23: note: annotate 'SDLToMetal_SurfaceFormat' with an availability attribute to silence this warning
static MTLPixelFormat SDLToMetal_SurfaceFormat[] = {
                      ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:1042:111: error: use of undeclared identifier 'MTLResourceHazardTrackingModeDefault'; did you mean 'MTLResourceHazardTrackingModeUntracked'?
    textureDescriptor.resourceOptions = MTLResourceCPUCacheModeDefaultCache | MTLResourceStorageModePrivate | MTLResourceHazardTrackingModeDefault;
                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                              MTLResourceHazardTrackingModeUntracked
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h:156:5: note: 'MTLResourceHazardTrackingModeUntracked' declared here
    MTLResourceHazardTrackingModeUntracked API_AVAILABLE(macos(10.13), ios(10.0)) = 0x1UL << MTLResourceHazardTrackingModeShift,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:1042:111: warning: 'MTLResourceHazardTrackingModeUntracked' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
    textureDescriptor.resourceOptions = MTLResourceCPUCacheModeDefaultCache | MTLResourceStorageModePrivate | MTLResourceHazardTrackingModeDefault;
                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h:156:5: note: 'MTLResourceHazardTrackingModeUntracked' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
    MTLResourceHazardTrackingModeUntracked API_AVAILABLE(macos(10.13), ios(10.0)) = 0x1UL << MTLResourceHazardTrackingModeShift,
    ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:1042:111: note: enclose 'MTLResourceHazardTrackingModeUntracked' in an @available check to silence this warning
    textureDescriptor.resourceOptions = MTLResourceCPUCacheModeDefaultCache | MTLResourceStorageModePrivate | MTLResourceHazardTrackingModeDefault;
                                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:1043:23: warning: 'setAllowGPUOptimizedContents:' is only available on macOS 10.14 or newer [-Wunguarded-availability-new]
    textureDescriptor.allowGPUOptimizedContents = true;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h:179:39: note: 'setAllowGPUOptimizedContents:' has been marked as being introduced in macOS 10.14 here, but the deployment target is macOS 10.9.0
@property (readwrite, nonatomic) BOOL allowGPUOptimizedContents API_AVAILABLE(macos(10.14), ios(12.0));
                                      ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:1043:23: note: enclose 'setAllowGPUOptimizedContents:' in an @available check to silence this warning
    textureDescriptor.allowGPUOptimizedContents = true;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2601:23: warning: 'setDisplaySyncEnabled:' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
    windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
                      ^~~~~~~~~~~~~~~~~~
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:116:16: note: 'setDisplaySyncEnabled:' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
@property BOOL displaySyncEnabled API_AVAILABLE(macos(10.13));
               ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2601:23: note: enclose 'setDisplaySyncEnabled:' in an @available check to silence this warning
    windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
                      ^~~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2808:23: warning: 'setDisplaySyncEnabled:' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
    windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
                      ^~~~~~~~~~~~~~~~~~
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:116:16: note: 'setDisplaySyncEnabled:' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.9.0
@property BOOL displaySyncEnabled API_AVAILABLE(macos(10.13));
               ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2808:23: note: enclose 'setDisplaySyncEnabled:' in an @available check to silence this warning
    windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
                      ^~~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2962:35: error: no known instance method for selector 'supportsFamily:'
        return ![renderer->device supportsFamily:MTLGPUFamilyMac2];
                                  ^~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2962:50: error: use of undeclared identifier 'MTLGPUFamilyMac2'
        return ![renderer->device supportsFamily:MTLGPUFamilyMac2];
                                                 ^
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2962:35: error: no known instance method for selector 'supportsFamily:'
        return ![renderer->device supportsFamily:MTLGPUFamilyMac2];
                                  ^~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:2971:31: error: no known instance method for selector 'supportsBCTextureCompression'
            [renderer->device supportsBCTextureCompression] &&
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:3002:27: error: no known instance method for selector 'supports32BitMSAA'
        [renderer->device supports32BitMSAA]) {
                          ^~~~~~~~~~~~~~~~~
/home/flibitijibibo/libraries/SDL3/src/gpu/metal/SDL_gpu_metal.m:3161:43: error: use of undeclared identifier 'kCGColorSpaceITUR_2100_PQ'; did you mean 'kCGColorSpaceITUR_2020'?
    SwapchainCompositionToColorSpace[3] = kCGColorSpaceITUR_2100_PQ;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
                                          kCGColorSpaceITUR_2020
/home/flibitijibibo/osxcross/target/bin/../SDK/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGColorSpace.h:116:29: note: 'kCGColorSpaceITUR_2020' declared here
CG_EXTERN const CFStringRef kCGColorSpaceITUR_2020
                            ^
5 warnings and 10 errors generated.
make[2]: *** [CMakeFiles/SDL3-shared.dir/build.make:3233: CMakeFiles/SDL3-shared.dir/src/gpu/metal/SDL_gpu_metal.m.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/SDL3-shared.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Probably just have to assume unsupported on these SDKs...

flibitijibibo commented 3 weeks ago

This should be tested against an 11.x SDK, if it compiles there this can be closed.

flibitijibibo commented 1 week ago

Forgot to write here that 3.0 is indeed getting an SDK bump, ideally to 11.0 but may end up being 11.3 based on what Sam suggested.