mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 14:26:01 +00:00
Fixed Xcode warnings
This commit is contained in:
@@ -1198,8 +1198,10 @@ static void METAL_InsertDebugLabel(
|
|||||||
[metalCommandBuffer->computeEncoder insertDebugSignpost:label];
|
[metalCommandBuffer->computeEncoder insertDebugSignpost:label];
|
||||||
} else {
|
} else {
|
||||||
// Metal doesn't have insertDebugSignpost for command buffers...
|
// Metal doesn't have insertDebugSignpost for command buffers...
|
||||||
[metalCommandBuffer->handle pushDebugGroup:label];
|
if (@available(macOS 10.13, *)) {
|
||||||
[metalCommandBuffer->handle popDebugGroup];
|
[metalCommandBuffer->handle pushDebugGroup:label];
|
||||||
|
[metalCommandBuffer->handle popDebugGroup];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1219,7 +1221,9 @@ static void METAL_PushDebugGroup(
|
|||||||
} else if (metalCommandBuffer->computeEncoder) {
|
} else if (metalCommandBuffer->computeEncoder) {
|
||||||
[metalCommandBuffer->computeEncoder pushDebugGroup:label];
|
[metalCommandBuffer->computeEncoder pushDebugGroup:label];
|
||||||
} else {
|
} 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) {
|
} else if (metalCommandBuffer->computeEncoder) {
|
||||||
[metalCommandBuffer->computeEncoder popDebugGroup];
|
[metalCommandBuffer->computeEncoder popDebugGroup];
|
||||||
} else {
|
} 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];
|
textureDescriptor.pixelFormat = SDLToMetal_SurfaceFormat[createinfo->format];
|
||||||
// This format isn't natively supported so let's swizzle!
|
// This format isn't natively supported so let's swizzle!
|
||||||
if (createinfo->format == SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM) {
|
if (createinfo->format == SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM) {
|
||||||
textureDescriptor.swizzle = MTLTextureSwizzleChannelsMake(
|
if (@available(macOS 10.15, *)) {
|
||||||
MTLTextureSwizzleBlue,
|
textureDescriptor.swizzle = MTLTextureSwizzleChannelsMake(MTLTextureSwizzleBlue,
|
||||||
MTLTextureSwizzleGreen,
|
MTLTextureSwizzleGreen,
|
||||||
MTLTextureSwizzleRed,
|
MTLTextureSwizzleRed,
|
||||||
MTLTextureSwizzleAlpha);
|
MTLTextureSwizzleAlpha);
|
||||||
|
} else {
|
||||||
|
SDL_SetError("SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM is not supported");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textureDescriptor.width = createinfo->width;
|
textureDescriptor.width = createinfo->width;
|
||||||
@@ -3409,7 +3419,9 @@ static Uint8 METAL_INTERNAL_CreateSwapchain(
|
|||||||
windowData->layer = (__bridge CAMetalLayer *)(SDL_Metal_GetLayer(windowData->view));
|
windowData->layer = (__bridge CAMetalLayer *)(SDL_Metal_GetLayer(windowData->view));
|
||||||
windowData->layer.device = renderer->device;
|
windowData->layer.device = renderer->device;
|
||||||
#ifdef SDL_PLATFORM_MACOS
|
#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
|
#endif
|
||||||
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
||||||
#ifndef SDL_PLATFORM_TVOS
|
#ifndef SDL_PLATFORM_TVOS
|
||||||
@@ -3632,7 +3644,9 @@ static bool METAL_SetSwapchainParameters(
|
|||||||
METAL_Wait(driverData);
|
METAL_Wait(driverData);
|
||||||
|
|
||||||
#ifdef SDL_PLATFORM_MACOS
|
#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
|
#endif
|
||||||
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
windowData->layer.pixelFormat = SDLToMetal_SurfaceFormat[SwapchainCompositionToFormat[swapchainComposition]];
|
||||||
#ifndef SDL_PLATFORM_TVOS
|
#ifndef SDL_PLATFORM_TVOS
|
||||||
@@ -3763,8 +3777,12 @@ static bool METAL_SupportsTextureFormat(
|
|||||||
|
|
||||||
// Cube arrays are not supported on older iOS devices
|
// Cube arrays are not supported on older iOS devices
|
||||||
if (type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) {
|
if (type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) {
|
||||||
if (!([renderer->device supportsFamily:MTLGPUFamilyCommon2] ||
|
if (@available(macOS 10.15, *)) {
|
||||||
[renderer->device supportsFamily:MTLGPUFamilyApple4])) {
|
if (!([renderer->device supportsFamily:MTLGPUFamilyCommon2] ||
|
||||||
|
[renderer->device supportsFamily:MTLGPUFamilyApple4])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3774,7 +3792,11 @@ static bool METAL_SupportsTextureFormat(
|
|||||||
case SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM:
|
case SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM:
|
||||||
case SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM:
|
case SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM:
|
||||||
case SDL_GPU_TEXTUREFORMAT_B4G4R4A4_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
|
// Requires BC compression support
|
||||||
case SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM:
|
case SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM:
|
||||||
|
@@ -1572,7 +1572,7 @@ int HID_API_EXPORT_CALL hid_get_report_descriptor(hid_device *dev, unsigned char
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buf, descriptor_buf, copy_len);
|
memcpy(buf, descriptor_buf, copy_len);
|
||||||
return copy_len;
|
return (int)copy_len;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
register_device_error(dev, "Failed to get kIOHIDReportDescriptorKey property");
|
register_device_error(dev, "Failed to get kIOHIDReportDescriptorKey property");
|
||||||
|
@@ -143,7 +143,7 @@ static bool AddFileDescriptorCloseActions(posix_spawn_file_actions_t *fa)
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
} else {
|
} else {
|
||||||
for (int fd = sysconf(_SC_OPEN_MAX) - 1; fd > STDERR_FILENO; --fd) {
|
for (int fd = (int)(sysconf(_SC_OPEN_MAX) - 1); fd > STDERR_FILENO; --fd) {
|
||||||
int flags = fcntl(fd, F_GETFD);
|
int flags = fcntl(fd, F_GETFD);
|
||||||
if (flags < 0 || (flags & FD_CLOEXEC)) {
|
if (flags < 0 || (flags & FD_CLOEXEC)) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -115,7 +115,7 @@ static void Cocoa_HandlePenProximityEvent(SDL_CocoaWindowData *_data, NSEvent *e
|
|||||||
|
|
||||||
static void Cocoa_HandlePenPointEvent(SDL_CocoaWindowData *_data, NSEvent *event)
|
static void Cocoa_HandlePenPointEvent(SDL_CocoaWindowData *_data, NSEvent *event)
|
||||||
{
|
{
|
||||||
const Uint32 timestamp = Cocoa_GetEventTimestamp([event timestamp]);
|
const Uint64 timestamp = Cocoa_GetEventTimestamp([event timestamp]);
|
||||||
Cocoa_PenHandle *handle = Cocoa_FindPenByDeviceID([event deviceID], [event pointingDeviceID]);
|
Cocoa_PenHandle *handle = Cocoa_FindPenByDeviceID([event deviceID], [event pointingDeviceID]);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return;
|
return;
|
||||||
|
@@ -404,7 +404,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT_TYPE_TEXT_USERNAME:
|
case SDL_TEXTINPUT_TYPE_TEXT_USERNAME:
|
||||||
textField.keyboardType = UIKeyboardTypeDefault;
|
textField.keyboardType = UIKeyboardTypeDefault;
|
||||||
if (@available(iOS 11.0, *)) {
|
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||||
textField.textContentType = UITextContentTypeUsername;
|
textField.textContentType = UITextContentTypeUsername;
|
||||||
} else {
|
} else {
|
||||||
textField.textContentType = nil;
|
textField.textContentType = nil;
|
||||||
@@ -412,7 +412,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN:
|
case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN:
|
||||||
textField.keyboardType = UIKeyboardTypeDefault;
|
textField.keyboardType = UIKeyboardTypeDefault;
|
||||||
if (@available(iOS 11.0, *)) {
|
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||||
textField.textContentType = UITextContentTypePassword;
|
textField.textContentType = UITextContentTypePassword;
|
||||||
} else {
|
} else {
|
||||||
textField.textContentType = nil;
|
textField.textContentType = nil;
|
||||||
@@ -421,7 +421,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE:
|
case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE:
|
||||||
textField.keyboardType = UIKeyboardTypeDefault;
|
textField.keyboardType = UIKeyboardTypeDefault;
|
||||||
if (@available(iOS 11.0, *)) {
|
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||||
textField.textContentType = UITextContentTypePassword;
|
textField.textContentType = UITextContentTypePassword;
|
||||||
} else {
|
} else {
|
||||||
textField.textContentType = nil;
|
textField.textContentType = nil;
|
||||||
@@ -433,7 +433,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN:
|
case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN:
|
||||||
textField.keyboardType = UIKeyboardTypeNumberPad;
|
textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||||
if (@available(iOS 12.0, *)) {
|
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
||||||
textField.textContentType = UITextContentTypeOneTimeCode;
|
textField.textContentType = UITextContentTypeOneTimeCode;
|
||||||
} else {
|
} else {
|
||||||
textField.textContentType = nil;
|
textField.textContentType = nil;
|
||||||
@@ -442,7 +442,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
|||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE:
|
case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE:
|
||||||
textField.keyboardType = UIKeyboardTypeNumberPad;
|
textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||||
if (@available(iOS 12.0, *)) {
|
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
||||||
textField.textContentType = UITextContentTypeOneTimeCode;
|
textField.textContentType = UITextContentTypeOneTimeCode;
|
||||||
} else {
|
} else {
|
||||||
textField.textContentType = nil;
|
textField.textContentType = nil;
|
||||||
|
Reference in New Issue
Block a user