21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_UIKIT 30 #include "../SDL_sysvideo.h" 31 #include "../../events/SDL_keyboard_c.h" 32 #include "../../events/SDL_mouse_c.h" 33 #include "../../power/uikit/SDL_syspower.h" 37 @interface SDLEAGLContext : EAGLContext
44 @implementation SDLEAGLContext
50 [
self.sdlView setSDLWindow:NULL];
61 return dlsym(RTLD_DEFAULT, proc);
71 SDLEAGLContext *eaglcontext = (__bridge SDLEAGLContext *) context;
73 if (![EAGLContext setCurrentContext:eaglcontext]) {
74 return SDL_SetError(
"Could not make EAGL context current");
78 [eaglcontext.sdlView setSDLWindow:window];
92 SDL_uikitopenglview *glview = (SDL_uikitopenglview *) view;
109 return SDL_SetError(
"iOS GL Load Library just here for compatibility");
121 SDL_UIKit_UpdateBatteryMonitoring();
124 [context.sdlView swapBuffers];
137 SDLEAGLContext *context = nil;
138 SDL_uikitopenglview *view;
140 CGRect
frame = UIKit_ComputeViewFrame(window, data.
uiwindow.screen);
141 EAGLSharegroup *sharegroup = nil;
149 EAGLRenderingAPI api = major;
154 SDL_SetError(
"OpenGL ES %d.%d context could not be created", major, minor);
164 sharegroup = context.sharegroup;
172 if ([data.
uiwindow.screen respondsToSelector:
@selector(nativeScale)]) {
173 scale = data.
uiwindow.screen.nativeScale;
181 context = [[SDLEAGLContext alloc] initWithAPI:api sharegroup:sharegroup];
190 retainBacking:_this->gl_config.retained_backing
191 rBits:_this->gl_config.red_size
192 gBits:_this->gl_config.green_size
193 bBits:_this->gl_config.blue_size
194 aBits:_this->gl_config.alpha_size
195 depthBits:_this->gl_config.depth_size
196 stencilBits:_this->gl_config.stencil_size
197 sRGB:_this->gl_config.framebuffer_srgb_capable
206 context.sdlView = view;
215 return (SDL_GLContext) CFBridgingRetain(context);
242 if (context !=
NULL && [EAGLContext currentContext] != context) {
243 [EAGLContext setCurrentContext:context];
GLenum GLenum GLenum GLenum GLenum scale
SDL_bool UIKit_IsSystemVersionAtLeast(double version)
void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
GLfloat GLfloat GLfloat GLfloat h
SDL_uikitviewcontroller * viewcontroller
void UIKit_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
static screen_context_t context
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
int UIKit_GL_LoadLibrary(_THIS, const char *path)
void UIKit_GL_RestoreCurrentContext(void)
int UIKit_GL_SwapWindow(_THIS, SDL_Window *window)
struct SDL_VideoDevice::@33 gl_config
static SDL_VideoDevice * _this
void * SDL_GLContext
An opaque handle to an OpenGL context.
GLubyte GLubyte GLubyte GLubyte w
SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window)
int share_with_current_context
void * UIKit_GL_GetProcAddress(_THIS, const char *proc)
#define SDL_GL_GetCurrentContext
EGLSurface EGLNativeWindowType * window
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
The type used to identify a window.
GLsizei const GLchar *const * path
int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)