From 8f91acc269b00184cb4dc0bdf786a9dc1f3298f0 Mon Sep 17 00:00:00 2001 From: Mike Owens Date: Mon, 26 Jan 2026 02:49:32 -0500 Subject: [PATCH] iOS: Allow building with `opengl3=no` --- platform/ios/display_layer_ios.h | 4 ++++ platform/ios/display_layer_ios.mm | 4 ++++ platform/ios/godot_view_ios.mm | 2 ++ platform/ios/platform_gl.h | 2 ++ 4 files changed, 12 insertions(+) diff --git a/platform/ios/display_layer_ios.h b/platform/ios/display_layer_ios.h index 14977b3204..f32c450aff 100644 --- a/platform/ios/display_layer_ios.h +++ b/platform/ios/display_layer_ios.h @@ -32,7 +32,9 @@ #include "drivers/apple_embedded/display_layer_apple_embedded.h" +#if defined(GLES3_ENABLED) #import +#endif #import // An ugly workaround for iOS simulator @@ -48,7 +50,9 @@ API_AVAILABLE(ios(13.0)) #endif @end +#if defined(GLES3_ENABLED) API_DEPRECATED("OpenGLES is deprecated", ios(2.0, 12.0)) @interface GDTOpenGLLayer : CAEAGLLayer @end +#endif diff --git a/platform/ios/display_layer_ios.mm b/platform/ios/display_layer_ios.mm index c1f6d758a3..554c159d17 100644 --- a/platform/ios/display_layer_ios.mm +++ b/platform/ios/display_layer_ios.mm @@ -40,9 +40,11 @@ #import #import +#if defined(GLES3_ENABLED) #import #import #import +#endif #import #import @@ -69,6 +71,7 @@ @end +#if defined(GLES3_ENABLED) @implementation GDTOpenGLLayer { // The pixel dimensions of the backbuffer GLint backingWidth; @@ -189,3 +192,4 @@ } @end +#endif diff --git a/platform/ios/godot_view_ios.mm b/platform/ios/godot_view_ios.mm index c267ac397d..2de4ec34c9 100644 --- a/platform/ios/godot_view_ios.mm +++ b/platform/ios/godot_view_ios.mm @@ -62,10 +62,12 @@ GODOT_CLANG_WARNING_POP #else layer = [GDTMetalLayer layer]; #endif +#if defined(GLES3_ENABLED) } else if ([driverName isEqualToString:@"opengl3"]) { GODOT_CLANG_WARNING_PUSH_AND_IGNORE("-Wdeprecated-declarations") // OpenGL is deprecated in iOS 12.0. layer = [GDTOpenGLLayer layer]; GODOT_CLANG_WARNING_POP +#endif } else { return nil; } diff --git a/platform/ios/platform_gl.h b/platform/ios/platform_gl.h index 8271b43b67..ec7cb2108f 100644 --- a/platform/ios/platform_gl.h +++ b/platform/ios/platform_gl.h @@ -30,8 +30,10 @@ #pragma once +#ifdef GLES3_ENABLED #ifndef GLES_API_ENABLED #define GLES_API_ENABLED // Allow using GLES. #endif #include +#endif