|
@@ -1198,8 +1198,10 @@ static void METAL_InsertDebugLabel(
|
|
|
[metalCommandBuffer->computeEncoder insertDebugSignpost:label];
|
|
|
} else {
|
|
|
// Metal doesn't have insertDebugSignpost for command buffers...
|
|
|
- [metalCommandBuffer->handle pushDebugGroup:label];
|
|
|
- [metalCommandBuffer->handle popDebugGroup];
|
|
|
+ if (@available(macOS 10.13, *)) {
|
|
|
+ [metalCommandBuffer->handle pushDebugGroup:label];
|
|
|
+ [metalCommandBuffer->handle popDebugGroup];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1219,7 +1221,9 @@ static void METAL_PushDebugGroup(
|
|
|
} else if (metalCommandBuffer->computeEncoder) {
|
|
|
[metalCommandBuffer->computeEncoder pushDebugGroup:label];
|
|
|
} else {
|
|
|
- [metalCommandBuffer->handle pushDebugGroup:label];
|
|
|
+ if (@available(macOS 10.13, *)) {
|
|
|
+ [metalCommandBuffer->handle pushDebugGroup:label];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1237,7 +1241,9 @@ static void METAL_PopDebugGroup(
|
|
|
} else if (metalCommandBuffer->computeEncoder) {
|
|
|
[metalCommandBuffer->computeEncoder popDebugGroup];
|
|
|
} else {
|
|
|
- [metalCommandBuffer->handle popDebugGroup];
|
|
|
+ if (@available(macOS 10.13, *)) {
|
|
|
+ [metalCommandBuffer->handle popDebugGroup];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1321,11 +1327,15 @@ static MetalTexture *METAL_INTERNAL_CreateTexture(
|
|
|
textureDescriptor.pixelFormat = SDLToMetal_SurfaceFormat[createinfo->format];
|
|
|
// This format isn't natively supported so let's swizzle!
|
|
|
if (createinfo->format == SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM) {
|
|
|
- textureDescriptor.swizzle = MTLTextureSwizzleChannelsMake(
|
|
|
- MTLTextureSwizzleBlue,
|
|
|
- MTLTextureSwizzleGreen,
|
|
|
- MTLTextureSwizzleRed,
|
|
|
- MTLTextureSwizzleAlpha);
|
|
|
+ if (@available(macOS 10.15, *)) {
|
|
|
+ textureDescriptor.swizzle = MTLTextureSwizzleChannelsMake(MTLTextureSwizzleBlue,
|
|
|
+ MTLTextureSwizzleGreen,
|
|
|
+ MTLTextureSwizzleRed,
|
|
|
+ MTLTextureSwizzleAlpha);
|
|
|
+ } else {
|
|
|
+ SDL_SetError("SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM is not supported");
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
textureDescriptor.width = createinfo->width;
|
|
@@ -3409,7 +3419,9 @@ static Uint8 METAL_INTERNAL_CreateSwapchain(
|
|
|
windowData->layer = (__bridge CAMetalLayer *)(SDL_Metal_GetLayer(windowData->view));
|
|
|
windowData->layer.device = renderer->device;
|
|
|
#ifdef SDL_PLATFORM_MACOS
|
|
|
- windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
|
|
|
+ if (@available(macOS 10.13, *)) {
|
|
|
+ windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
|
|
|
+ }
|
|
|
#endif
|
|
|
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
|
|
#ifndef SDL_PLATFORM_TVOS
|
|
@@ -3632,7 +3644,9 @@ static bool METAL_SetSwapchainParameters(
|
|
|
METAL_Wait(driverData);
|
|
|
|
|
|
#ifdef SDL_PLATFORM_MACOS
|
|
|
- windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
|
|
|
+ if (@available(macOS 10.13, *)) {
|
|
|
+ windowData->layer.displaySyncEnabled = (presentMode != SDL_GPU_PRESENTMODE_IMMEDIATE);
|
|
|
+ }
|
|
|
#endif
|
|
|
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
|
|
#ifndef SDL_PLATFORM_TVOS
|
|
@@ -3763,8 +3777,12 @@ static bool METAL_SupportsTextureFormat(
|
|
|
|
|
|
// Cube arrays are not supported on older iOS devices
|
|
|
if (type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) {
|
|
|
- if (!([renderer->device supportsFamily:MTLGPUFamilyCommon2] ||
|
|
|
- [renderer->device supportsFamily:MTLGPUFamilyApple4])) {
|
|
|
+ if (@available(macOS 10.15, *)) {
|
|
|
+ if (!([renderer->device supportsFamily:MTLGPUFamilyCommon2] ||
|
|
|
+ [renderer->device supportsFamily:MTLGPUFamilyApple4])) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -3774,7 +3792,11 @@ static bool METAL_SupportsTextureFormat(
|
|
|
case SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM:
|
|
|
case SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM:
|
|
|
case SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM:
|
|
|
- return [renderer->device supportsFamily:MTLGPUFamilyApple1];
|
|
|
+ if (@available(macOS 10.15, *)) {
|
|
|
+ return [renderer->device supportsFamily:MTLGPUFamilyApple1];
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
// Requires BC compression support
|
|
|
case SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM:
|