Added framebuffer and colorbuffer members to the uikit portion of the SDL_SysWMinfo struct, removed SDL_iOSGetViewRenderbuffer and SDL_iOSGetViewFramebuffer. iOS-improvements
authorAlex Szpakowski <slime73@gmail.com>
Thu, 09 Apr 2015 19:28:00 -0300
branchiOS-improvements
changeset 954032ddc92d78cf
parent 9539 ea3513fe64a0
child 9541 cf8fab52e33b
child 9542 618662dc9e82
Added framebuffer and colorbuffer members to the uikit portion of the SDL_SysWMinfo struct, removed SDL_iOSGetViewRenderbuffer and SDL_iOSGetViewFramebuffer.
include/SDL_system.h
include/SDL_syswm.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitwindow.m
     1.1 --- a/include/SDL_system.h	Wed Apr 08 15:59:29 2015 -0300
     1.2 +++ b/include/SDL_system.h	Thu Apr 09 19:28:00 2015 -0300
     1.3 @@ -79,20 +79,6 @@
     1.4  #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
     1.5  extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
     1.6  
     1.7 -/**
     1.8 -   \brief Returns the OpenGL Renderbuffer Object associated with the window's main view.
     1.9 -
    1.10 -   The Renderbuffer must be bound when calling SDL_GL_SwapWindow.
    1.11 - */
    1.12 -extern DECLSPEC Uint32 SDLCALL SDL_iOSGetViewRenderbuffer(SDL_Window * window);
    1.13 -
    1.14 -/**
    1.15 -   \brief Returns the OpenGL Framebuffer Object associated with the window's main view.
    1.16 -
    1.17 -   The Framebuffer must be bound when rendering to the screen.
    1.18 - */
    1.19 -extern DECLSPEC Uint32 SDLCALL SDL_iOSGetViewFramebuffer(SDL_Window * window);
    1.20 -
    1.21  #endif /* __IPHONEOS__ */
    1.22  
    1.23  
     2.1 --- a/include/SDL_syswm.h	Wed Apr 08 15:59:29 2015 -0300
     2.2 +++ b/include/SDL_syswm.h	Thu Apr 09 19:28:00 2015 -0300
     2.3 @@ -98,6 +98,7 @@
     2.4  typedef struct _UIWindow UIWindow;
     2.5  typedef struct _UIViewController UIViewController;
     2.6  #endif
     2.7 +typedef Uint32 GLuint;
     2.8  #endif
     2.9  
    2.10  #if defined(SDL_VIDEO_DRIVER_ANDROID)
    2.11 @@ -228,6 +229,8 @@
    2.12  #else
    2.13              UIWindow *window;                     /* The UIKit window */
    2.14  #endif
    2.15 +            GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
    2.16 +            GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
    2.17          } uikit;
    2.18  #endif
    2.19  #if defined(SDL_VIDEO_DRIVER_WAYLAND)
     3.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Wed Apr 08 15:59:29 2015 -0300
     3.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Thu Apr 09 19:28:00 2015 -0300
     3.3 @@ -592,5 +592,3 @@
     3.4  #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL
     3.5  #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL
     3.6  #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL
     3.7 -#define SDL_iOSGetViewRenderbuffer SDL_iOSGetViewRenderbuffer_REAL
     3.8 -#define SDL_iOSGetViewFramebuffer SDL_iOSGetViewFramebuffer_REAL
     4.1 --- a/src/dynapi/SDL_dynapi_procs.h	Wed Apr 08 15:59:29 2015 -0300
     4.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Thu Apr 09 19:28:00 2015 -0300
     4.3 @@ -624,7 +624,3 @@
     4.4  SDL_DYNAPI_PROC(Uint32,SDL_GetQueuedAudioSize,(SDL_AudioDeviceID a),(a),return)
     4.5  SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
     4.6  SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return)
     4.7 -#if defined(__IPHONEOS__) && __IPHONEOS__
     4.8 -SDL_DYNAPI_PROC(Uint32,SDL_iOSGetViewRenderbuffer,(SDL_Window *a),(a),return)
     4.9 -SDL_DYNAPI_PROC(Uint32,SDL_iOSGetViewFramebuffer,(SDL_Window *a),(a),return)
    4.10 -#endif
     5.1 --- a/src/video/uikit/SDL_uikitopengles.m	Wed Apr 08 15:59:29 2015 -0300
     5.2 +++ b/src/video/uikit/SDL_uikitopengles.m	Thu Apr 09 19:28:00 2015 -0300
     5.3 @@ -183,48 +183,6 @@
     5.4      }
     5.5  }
     5.6  
     5.7 -Uint32
     5.8 -SDL_iOSGetViewRenderbuffer(SDL_Window * window)
     5.9 -{
    5.10 -    if (!window) {
    5.11 -        SDL_SetError("Invalid window");
    5.12 -        return 0;
    5.13 -    }
    5.14 -
    5.15 -    @autoreleasepool {
    5.16 -        SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
    5.17 -        UIView *view = data.viewcontroller.view;
    5.18 -        if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
    5.19 -            SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
    5.20 -            return glview.drawableRenderbuffer;
    5.21 -        }
    5.22 -    }
    5.23 -
    5.24 -    SDL_SetError("Window does not have an attached OpenGL view");
    5.25 -    return 0;
    5.26 -}
    5.27 -
    5.28 -Uint32
    5.29 -SDL_iOSGetViewFramebuffer(SDL_Window * window)
    5.30 -{
    5.31 -    if (!window) {
    5.32 -        SDL_SetError("Invalid window");
    5.33 -        return 0;
    5.34 -    }
    5.35 -
    5.36 -    @autoreleasepool {
    5.37 -        SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
    5.38 -        UIView *view = data.viewcontroller.view;
    5.39 -        if ([view isKindOfClass:[SDL_uikitopenglview class]]) {
    5.40 -            SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
    5.41 -            return glview.drawableFramebuffer;
    5.42 -        }
    5.43 -    }
    5.44 -
    5.45 -    SDL_SetError("Window does not have an attached OpenGL view");
    5.46 -    return 0;
    5.47 -}
    5.48 -
    5.49  #endif /* SDL_VIDEO_DRIVER_UIKIT */
    5.50  
    5.51  /* vi: set ts=4 sw=4 expandtab: */
     6.1 --- a/src/video/uikit/SDL_uikitwindow.m	Wed Apr 08 15:59:29 2015 -0300
     6.2 +++ b/src/video/uikit/SDL_uikitwindow.m	Thu Apr 09 19:28:00 2015 -0300
     6.3 @@ -38,6 +38,7 @@
     6.4  #import "SDL_uikitappdelegate.h"
     6.5  
     6.6  #import "SDL_uikitview.h"
     6.7 +#import "SDL_uikitopenglview.h"
     6.8  
     6.9  #include <Foundation/Foundation.h>
    6.10  
    6.11 @@ -314,8 +315,23 @@
    6.12          SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
    6.13  
    6.14          if (info->version.major <= SDL_MAJOR_VERSION) {
    6.15 +            int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
    6.16 +
    6.17              info->subsystem = SDL_SYSWM_UIKIT;
    6.18              info->info.uikit.window = data.uiwindow;
    6.19 +
    6.20 +            /* These struct members were added in SDL 2.0.4. */
    6.21 +            if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
    6.22 +                if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
    6.23 +                    SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
    6.24 +                    info->info.uikit.framebuffer = glview.drawableFramebuffer;
    6.25 +                    info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
    6.26 +                } else {
    6.27 +                    info->info.uikit.framebuffer = 0;
    6.28 +                    info->info.uikit.colorbuffer = 0;
    6.29 +                }
    6.30 +            }
    6.31 +
    6.32              return SDL_TRUE;
    6.33          } else {
    6.34              SDL_SetError("Application not compiled with SDL %d.%d\n",