Added framebuffer and colorbuffer members to the uikit portion of the SDL_SysWMinfo struct, removed SDL_iOSGetViewRenderbuffer and SDL_iOSGetViewFramebuffer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
diff --git a/include/SDL_system.h b/include/SDL_system.h
index 0c2d34a..ee9bb48 100644
--- a/include/SDL_system.h
+++ b/include/SDL_system.h
@@ -79,20 +79,6 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window,
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
-/**
- \brief Returns the OpenGL Renderbuffer Object associated with the window's main view.
-
- The Renderbuffer must be bound when calling SDL_GL_SwapWindow.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_iOSGetViewRenderbuffer(SDL_Window * window);
-
-/**
- \brief Returns the OpenGL Framebuffer Object associated with the window's main view.
-
- The Framebuffer must be bound when rendering to the screen.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_iOSGetViewFramebuffer(SDL_Window * window);
-
#endif /* __IPHONEOS__ */
diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h
index c265333..fa11455 100644
--- a/include/SDL_syswm.h
+++ b/include/SDL_syswm.h
@@ -98,6 +98,7 @@ typedef struct _NSWindow NSWindow;
typedef struct _UIWindow UIWindow;
typedef struct _UIViewController UIViewController;
#endif
+typedef Uint32 GLuint;
#endif
#if defined(SDL_VIDEO_DRIVER_ANDROID)
@@ -228,6 +229,8 @@ struct SDL_SysWMinfo
#else
UIWindow *window; /* The UIKit window */
#endif
+ GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
+ GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
} uikit;
#endif
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 3508280..dcc6d46 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -592,5 +592,3 @@
#define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
#define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
#define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL
-#define SDL_iOSGetViewRenderbuffer SDL_iOSGetViewRenderbuffer_REAL
-#define SDL_iOSGetViewFramebuffer SDL_iOSGetViewFramebuffer_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index a66c997..6408e3f 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -624,7 +624,3 @@ SDL_DYNAPI_PROC(int,SDL_QueueAudio,(SDL_AudioDeviceID a, const void *b, Uint32 c
SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return)
-#if defined(__IPHONEOS__) && __IPHONEOS__
-SDL_DYNAPI_PROC(Uint32,SDL_iOSGetViewRenderbuffer,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(Uint32,SDL_iOSGetViewFramebuffer,(SDL_Window *a),(a),return)
-#endif
diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m
index 66c9122..0184cf7 100644
--- a/src/video/uikit/SDL_uikitopengles.m
+++ b/src/video/uikit/SDL_uikitopengles.m
@@ -183,48 +183,6 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
}
}
-Uint32
-SDL_iOSGetViewRenderbuffer(SDL_Window * window)
-{
- if (!window) {
- SDL_SetError("Invalid window");
- return 0;
- }
-
- @autoreleasepool {
- SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
- UIView *view = data.viewcontroller.view;
- if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
- SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
- return glview.drawableRenderbuffer;
- }
- }
-
- SDL_SetError("Window does not have an attached OpenGL view");
- return 0;
-}
-
-Uint32
-SDL_iOSGetViewFramebuffer(SDL_Window * window)
-{
- if (!window) {
- SDL_SetError("Invalid window");
- return 0;
- }
-
- @autoreleasepool {
- SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
- UIView *view = data.viewcontroller.view;
- if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
- SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
- return glview.drawableFramebuffer;
- }
- }
-
- SDL_SetError("Window does not have an attached OpenGL view");
- return 0;
-}
-
#endif /* SDL_VIDEO_DRIVER_UIKIT */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index df4c700..e65732c 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -38,6 +38,7 @@
#import "SDL_uikitappdelegate.h"
#import "SDL_uikitview.h"
+#import "SDL_uikitopenglview.h"
#include <Foundation/Foundation.h>
@@ -314,8 +315,23 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
if (info->version.major <= SDL_MAJOR_VERSION) {
+ int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
+
info->subsystem = SDL_SYSWM_UIKIT;
info->info.uikit.window = data.uiwindow;
+
+ /* These struct members were added in SDL 2.0.4. */
+ if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
+ if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
+ SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
+ info->info.uikit.framebuffer = glview.drawableFramebuffer;
+ info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
+ } else {
+ info->info.uikit.framebuffer = 0;
+ info->info.uikit.colorbuffer = 0;
+ }
+ }
+
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d.%d\n",