all repos — mgba @ a3803a853ca4c54f51dced1e27be52bdf7c257a7

mGBA Game Boy Advance Emulator

SDL: Allow GLES2 and GL backends to be compiled at the same time
Jeffrey Pfau jeffrey@endrift.com
Wed, 28 Oct 2015 23:21:09 -0700
commit

a3803a853ca4c54f51dced1e27be52bdf7c257a7

parent

08c7c805a8069b7a04722314d6ebc2f104f0b9ae

2 files changed, 12 insertions(+), 11 deletions(-)

jump to
M src/platform/sdl/gles2-sdl.csrc/platform/sdl/gles2-sdl.c

@@ -96,18 +96,18 @@

renderer->d.outputBuffer = memalign(16, 256 * 256 * 4); renderer->d.outputBufferStride = 256; - GBAGLES2ContextCreate(&renderer->gl); - renderer->gl.d.user = renderer; - renderer->gl.d.lockAspectRatio = renderer->lockAspectRatio; - renderer->gl.d.filter = renderer->filter; - renderer->gl.d.swap = GBASDLGLCommonSwap; - renderer->gl.d.init(&renderer->gl.d, 0); + GBAGLES2ContextCreate(&renderer->gl2); + renderer->gl2.d.user = renderer; + renderer->gl2.d.lockAspectRatio = renderer->lockAspectRatio; + renderer->gl2.d.filter = renderer->filter; + renderer->gl2.d.swap = GBASDLGLCommonSwap; + renderer->gl2.d.init(&renderer->gl2.d, 0); return true; } void GBASDLGLES2Runloop(struct GBAThread* context, struct SDLSoftwareRenderer* renderer) { SDL_Event event; - struct VideoBackend* v = &renderer->gl.d; + struct VideoBackend* v = &renderer->gl2.d; while (context->state < THREAD_EXITING) { while (SDL_PollEvent(&event)) {

@@ -128,8 +128,8 @@ }

} void GBASDLGLES2Deinit(struct SDLSoftwareRenderer* renderer) { - if (renderer->gl.d.deinit) { - renderer->gl.d.deinit(&renderer->gl.d); + if (renderer->gl2.d.deinit) { + renderer->gl2.d.deinit(&renderer->gl2.d); } #ifdef BUILD_RASPI eglMakeCurrent(renderer->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
M src/platform/sdl/main.hsrc/platform/sdl/main.h

@@ -62,8 +62,9 @@ bool filter;

#ifdef BUILD_GL struct GBAGLContext gl; -#elif BUILD_GLES2 - struct GBAGLES2Context gl; +#endif +#ifdef BUILD_GLES2 + struct GBAGLES2Context gl2; #endif #ifdef USE_PIXMAN