mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
Fixed bug 5440 - MacCatalyst build failures
C.W. Betts I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues: * MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst. * OpenGL ES is unavailable under Mac Catalyst. * Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled. * Set Metal as the default renderer on Mac Catalyst Attaching a patch that will make SDL2 build for Mac Catalyst.
This commit is contained in:
@@ -59,7 +59,7 @@ extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
|
||||
|
||||
/* macOS requires constants in a buffer to have a 256 byte alignment. */
|
||||
/* Use native type alignments from https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf */
|
||||
#if defined(__MACOSX__) || TARGET_OS_SIMULATOR
|
||||
#if defined(__MACOSX__) || TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST
|
||||
#define CONSTANT_ALIGN(x) (256)
|
||||
#else
|
||||
#define CONSTANT_ALIGN(x) (x < 4 ? 4 : x)
|
||||
@@ -1875,7 +1875,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
|
||||
renderer->always_batch = SDL_TRUE;
|
||||
|
||||
#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)
|
||||
#if (defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
|
||||
if (@available(macOS 10.13, *)) {
|
||||
data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0;
|
||||
if (data.mtllayer.displaySyncEnabled) {
|
||||
@@ -1889,7 +1889,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||
|
||||
/* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */
|
||||
int maxtexsize = 4096;
|
||||
#if defined(__MACOSX__)
|
||||
#if defined(__MACOSX__) || TARGET_OS_MACCATALYST
|
||||
maxtexsize = 16384;
|
||||
#elif defined(__TVOS__)
|
||||
maxtexsize = 8192;
|
||||
|
@@ -1474,10 +1474,14 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||
}
|
||||
|
||||
/* Some platforms have OpenGL enabled by default */
|
||||
#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
|
||||
#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__
|
||||
if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN) && !(flags & SDL_WINDOW_METAL) && !SDL_IsVideoContextExternal()) {
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
}
|
||||
#elif TARGET_OS_MACCATALYST
|
||||
if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN) && !(flags & SDL_WINDOW_OPENGL) && !SDL_IsVideoContextExternal()) {
|
||||
flags |= SDL_WINDOW_METAL;
|
||||
}
|
||||
#endif
|
||||
if (flags & SDL_WINDOW_OPENGL) {
|
||||
if (!_this->GL_CreateContext) {
|
||||
|
Reference in New Issue
Block a user