mirror of https://github.com/encounter/SDL.git
Fixed bug 4882 - Fix build for iOS when disabling OpenGL
Aaron Barany Since OpenGL is deprecated on iOS, it is advantageous to be able to remove all OpenGL related code when building SDL for iOS. This patch adds the necessary #if checks to compile in this case.
This commit is contained in:
parent
e5af951eae
commit
b7576025e3
|
@ -65,7 +65,9 @@ UIKit_PumpEvents(_THIS)
|
||||||
} while(result == kCFRunLoopRunHandledSource);
|
} while(result == kCFRunLoopRunHandledSource);
|
||||||
|
|
||||||
/* See the comment in the function definition. */
|
/* See the comment in the function definition. */
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
UIKit_GL_RestoreCurrentContext();
|
UIKit_GL_RestoreCurrentContext();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#ifndef SDL_uikitopengles_
|
#ifndef SDL_uikitopengles_
|
||||||
#define SDL_uikitopengles_
|
#define SDL_uikitopengles_
|
||||||
|
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
|
|
||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
|
|
||||||
extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window,
|
extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window,
|
||||||
|
@ -35,6 +37,8 @@ extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
|
||||||
|
|
||||||
extern void UIKit_GL_RestoreCurrentContext(void);
|
extern void UIKit_GL_RestoreCurrentContext(void);
|
||||||
|
|
||||||
|
#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
|
|
||||||
#endif /* SDL_uikitopengles_ */
|
#endif /* SDL_uikitopengles_ */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../SDL_internal.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_DRIVER_UIKIT
|
#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2)
|
||||||
|
|
||||||
#include "SDL_uikitopengles.h"
|
#include "SDL_uikitopengles.h"
|
||||||
#import "SDL_uikitopenglview.h"
|
#import "SDL_uikitopenglview.h"
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <OpenGLES/EAGL.h>
|
#import <OpenGLES/EAGL.h>
|
||||||
#import <OpenGLES/ES3/gl.h>
|
#import <OpenGLES/ES3/gl.h>
|
||||||
|
@ -57,4 +59,6 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../SDL_internal.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#if SDL_VIDEO_DRIVER_UIKIT
|
#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2)
|
||||||
|
|
||||||
#include <OpenGLES/EAGLDrawable.h>
|
#include <OpenGLES/EAGLDrawable.h>
|
||||||
#include <OpenGLES/ES2/glext.h>
|
#include <OpenGLES/ES2/glext.h>
|
||||||
|
|
|
@ -116,6 +116,7 @@ UIKit_CreateDevice(int devindex)
|
||||||
device->HasClipboardText = UIKit_HasClipboardText;
|
device->HasClipboardText = UIKit_HasClipboardText;
|
||||||
|
|
||||||
/* OpenGL (ES) functions */
|
/* OpenGL (ES) functions */
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
|
device->GL_MakeCurrent = UIKit_GL_MakeCurrent;
|
||||||
device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize;
|
device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize;
|
||||||
device->GL_SwapWindow = UIKit_GL_SwapWindow;
|
device->GL_SwapWindow = UIKit_GL_SwapWindow;
|
||||||
|
@ -123,6 +124,7 @@ UIKit_CreateDevice(int devindex)
|
||||||
device->GL_DeleteContext = UIKit_GL_DeleteContext;
|
device->GL_DeleteContext = UIKit_GL_DeleteContext;
|
||||||
device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
|
device->GL_GetProcAddress = UIKit_GL_GetProcAddress;
|
||||||
device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
|
device->GL_LoadLibrary = UIKit_GL_LoadLibrary;
|
||||||
|
#endif
|
||||||
device->free = UIKit_DeleteDevice;
|
device->free = UIKit_DeleteDevice;
|
||||||
|
|
||||||
#if SDL_VIDEO_VULKAN
|
#if SDL_VIDEO_VULKAN
|
||||||
|
|
|
@ -180,7 +180,9 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o
|
||||||
/* Don't run the game loop while a messagebox is up */
|
/* Don't run the game loop while a messagebox is up */
|
||||||
if (!UIKit_ShowingMessageBox()) {
|
if (!UIKit_ShowingMessageBox()) {
|
||||||
/* See the comment in the function definition. */
|
/* See the comment in the function definition. */
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
UIKit_GL_RestoreCurrentContext();
|
UIKit_GL_RestoreCurrentContext();
|
||||||
|
#endif
|
||||||
|
|
||||||
animationCallback(animationCallbackParam);
|
animationCallback(animationCallbackParam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,12 +364,16 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
|
||||||
|
|
||||||
/* These struct members were added in SDL 2.0.4. */
|
/* These struct members were added in SDL 2.0.4. */
|
||||||
if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
|
if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
|
||||||
|
#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
|
||||||
if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
|
if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
|
||||||
SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
|
SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
|
||||||
info->info.uikit.framebuffer = glview.drawableFramebuffer;
|
info->info.uikit.framebuffer = glview.drawableFramebuffer;
|
||||||
info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
|
info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
|
||||||
info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer;
|
info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer;
|
||||||
} else {
|
} else {
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
info->info.uikit.framebuffer = 0;
|
info->info.uikit.framebuffer = 0;
|
||||||
info->info.uikit.colorbuffer = 0;
|
info->info.uikit.colorbuffer = 0;
|
||||||
info->info.uikit.resolveFramebuffer = 0;
|
info->info.uikit.resolveFramebuffer = 0;
|
||||||
|
|
Loading…
Reference in New Issue