Fixed building for simulators or older iOS SDKs

This commit is contained in:
Sam Lantinga committed 2017-12-07 17:47:01 -08:00
1 parent 6deb1e7595
commit ba9c336e04
5 files changed
+24 -13

No files matched your search

+3 -3
View File
@@ -113,12 +113,12 @@ SDL_RenderDriver METAL_RenderDriver = {
static int
IsMetalAvailable(const SDL_SysWMinfo *syswm)
{
if (syswm->subsystem != SDL_SYSWM_COCOA) { // !!! FIXME: SDL_SYSWM_UIKIT for iOS, too!
return SDL_SetError("Metal render target only supports Cocoa video target at the moment.");
if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) {
return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment.");
}
// this checks a weak symbol.
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
#if defined(__MACOSX__)
if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower.
return SDL_SetError("Metal framework not available on this system");
}
+4
View File
@@ -32,6 +32,8 @@
#import "../SDL_sysvideo.h"
#import "SDL_uikitwindow.h"
#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN)
#import <UIKit/UIKit.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
@@ -50,6 +52,8 @@ SDL_uikitmetalview* UIKit_Mtl_AddMetalView(SDL_Window* window);
void UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h);
#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */
#endif /* SDL_uikitmetalview_h_ */
/* vi: set ts=4 sw=4 expandtab: */
+2 -2
View File
@@ -28,7 +28,7 @@
#include "../../SDL_internal.h"
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT
#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN)
#import "../SDL_sysvideo.h"
#import "SDL_uikitwindow.h"
@@ -133,4 +133,4 @@ UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h)
}
}
#endif
#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */