all repos — mgba @ d25ba2ec59b940940950aa1330fe563bced278bd

mGBA Game Boy Advance Emulator

OpenGL: Rename GBAGL to mGL
Jeffrey Pfau jeffrey@endrift.com
Tue, 09 Feb 2016 21:23:17 -0800
commit

d25ba2ec59b940940950aa1330fe563bced278bd

parent

ef68c84e76bfd95b454bcbc3eec4d6946d23a282

M src/platform/opengl/gl.csrc/platform/opengl/gl.c

@@ -21,9 +21,9 @@ 1, 1,

0, 1 }; -static void GBAGLContextInit(struct VideoBackend* v, WHandle handle) { +static void mGLContextInit(struct VideoBackend* v, WHandle handle) { UNUSED(handle); - struct GBAGLContext* context = (struct GBAGLContext*) v; + struct mGLContext* context = (struct mGLContext*) v; glGenTextures(1, &context->tex); glBindTexture(GL_TEXTURE_2D, context->tex); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

@@ -33,8 +33,8 @@ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

#endif } -static void GBAGLContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { - struct GBAGLContext* context = (struct GBAGLContext*) v; +static void mGLContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { + struct mGLContext* context = (struct mGLContext*) v; v->width = width; v->height = height;

@@ -50,12 +50,12 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, toPow2(width), toPow2(height), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

#endif } -static void GBAGLContextDeinit(struct VideoBackend* v) { - struct GBAGLContext* context = (struct GBAGLContext*) v; +static void mGLContextDeinit(struct VideoBackend* v) { + struct mGLContext* context = (struct mGLContext*) v; glDeleteTextures(1, &context->tex); } -static void GBAGLContextResized(struct VideoBackend* v, unsigned w, unsigned h) { +static void mGLContextResized(struct VideoBackend* v, unsigned w, unsigned h) { unsigned drawW = w; unsigned drawH = h; if (v->lockAspectRatio) {

@@ -72,14 +72,14 @@ glClear(GL_COLOR_BUFFER_BIT);

glViewport((w - drawW) / 2, (h - drawH) / 2, drawW, drawH); } -static void GBAGLContextClear(struct VideoBackend* v) { +static void mGLContextClear(struct VideoBackend* v) { UNUSED(v); glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); } -void GBAGLContextDrawFrame(struct VideoBackend* v) { - struct GBAGLContext* context = (struct GBAGLContext*) v; +void mGLContextDrawFrame(struct VideoBackend* v) { + struct mGLContext* context = (struct mGLContext*) v; glEnable(GL_TEXTURE_2D); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);

@@ -101,8 +101,8 @@ }

glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } -void GBAGLContextPostFrame(struct VideoBackend* v, const void* frame) { - struct GBAGLContext* context = (struct GBAGLContext*) v; +void mGLContextPostFrame(struct VideoBackend* v, const void* frame) { + struct mGLContext* context = (struct mGLContext*) v; glBindTexture(GL_TEXTURE_2D, context->tex); #ifdef COLOR_16_BIT #ifdef COLOR_5_6_5

@@ -115,15 +115,15 @@ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, v->width, v->height, GL_RGBA, GL_UNSIGNED_BYTE, frame);

#endif } -void GBAGLContextCreate(struct GBAGLContext* context) { - context->d.init = GBAGLContextInit; - context->d.deinit = GBAGLContextDeinit; - context->d.setDimensions = GBAGLContextSetDimensions; - context->d.resized = GBAGLContextResized; +void mGLContextCreate(struct mGLContext* context) { + context->d.init = mGLContextInit; + context->d.deinit = mGLContextDeinit; + context->d.setDimensions = mGLContextSetDimensions; + context->d.resized = mGLContextResized; context->d.swap = 0; - context->d.clear = GBAGLContextClear; - context->d.postFrame = GBAGLContextPostFrame; - context->d.drawFrame = GBAGLContextDrawFrame; + context->d.clear = mGLContextClear; + context->d.postFrame = mGLContextPostFrame; + context->d.drawFrame = mGLContextDrawFrame; context->d.setMessage = 0; context->d.clearMessage = 0; }
M src/platform/opengl/gl.hsrc/platform/opengl/gl.h

@@ -16,12 +16,12 @@ #endif

#include "platform/video-backend.h" -struct GBAGLContext { +struct mGLContext { struct VideoBackend d; GLuint tex; }; -void GBAGLContextCreate(struct GBAGLContext*); +void mGLContextCreate(struct mGLContext*); #endif
M src/platform/opengl/gles2.csrc/platform/opengl/gles2.c

@@ -71,9 +71,9 @@ 1.f, 1.f,

1.f, -1.f, }; -static void GBAGLES2ContextInit(struct VideoBackend* v, WHandle handle) { +static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) { UNUSED(handle); - struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; + struct mGLES2Context* context = (struct mGLES2Context*) v; glGenTextures(1, &context->tex); glBindTexture(GL_TEXTURE_2D, context->tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

@@ -81,7 +81,7 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glClearColor(0.f, 0.f, 0.f, 1.f); - struct GBAGLES2Uniform* uniforms = malloc(sizeof(struct GBAGLES2Uniform) * 4); + struct mGLES2Uniform* uniforms = malloc(sizeof(struct mGLES2Uniform) * 4); uniforms[0].name = "gamma"; uniforms[0].readableName = "Gamma"; uniforms[0].type = GL_FLOAT;

@@ -124,16 +124,16 @@ uniforms[3].min.fvec3[2] = 0.0f;

uniforms[3].max.fvec3[0] = 1.0f; uniforms[3].max.fvec3[1] = 1.0f; uniforms[3].max.fvec3[2] = 1.0f; - GBAGLES2ShaderInit(&context->initialShader, _vertexShader, _fragmentShader, -1, -1, false, uniforms, 4); - GBAGLES2ShaderInit(&context->finalShader, 0, 0, 0, 0, false, 0, 0); + mGLES2ShaderInit(&context->initialShader, _vertexShader, _fragmentShader, -1, -1, false, uniforms, 4); + mGLES2ShaderInit(&context->finalShader, 0, 0, 0, 0, false, 0, 0); glDeleteFramebuffers(1, &context->finalShader.fbo); glDeleteTextures(1, &context->finalShader.tex); context->finalShader.fbo = 0; context->finalShader.tex = 0; } -static void GBAGLES2ContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { - struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; +static void mGLES2ContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { + struct mGLES2Context* context = (struct mGLES2Context*) v; v->width = width; v->height = height;

@@ -149,15 +149,15 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

#endif } -static void GBAGLES2ContextDeinit(struct VideoBackend* v) { - struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; +static void mGLES2ContextDeinit(struct VideoBackend* v) { + struct mGLES2Context* context = (struct mGLES2Context*) v; glDeleteTextures(1, &context->tex); - GBAGLES2ShaderDeinit(&context->initialShader); - GBAGLES2ShaderDeinit(&context->finalShader); + mGLES2ShaderDeinit(&context->initialShader); + mGLES2ShaderDeinit(&context->finalShader); free(context->initialShader.uniforms); } -static void GBAGLES2ContextResized(struct VideoBackend* v, unsigned w, unsigned h) { +static void mGLES2ContextResized(struct VideoBackend* v, unsigned w, unsigned h) { unsigned drawW = w; unsigned drawH = h; if (v->lockAspectRatio) {

@@ -173,13 +173,13 @@ glClear(GL_COLOR_BUFFER_BIT);

glViewport((w - drawW) / 2, (h - drawH) / 2, drawW, drawH); } -static void GBAGLES2ContextClear(struct VideoBackend* v) { +static void mGLES2ContextClear(struct VideoBackend* v) { UNUSED(v); glClearColor(0.f, 0.f, 0.f, 1.f); glClear(GL_COLOR_BUFFER_BIT); } -void _drawShader(struct GBAGLES2Context* context, struct GBAGLES2Shader* shader) { +void _drawShader(struct mGLES2Context* context, struct mGLES2Shader* shader) { GLint viewport[4]; glBindFramebuffer(GL_FRAMEBUFFER, shader->fbo); if (shader->blend) {

@@ -230,7 +230,7 @@ glVertexAttribPointer(shader->positionLocation, 2, GL_FLOAT, GL_FALSE, 0, _vertices);

glEnableVertexAttribArray(shader->positionLocation); size_t u; for (u = 0; u < shader->nUniforms; ++u) { - struct GBAGLES2Uniform* uniform = &shader->uniforms[u]; + struct mGLES2Uniform* uniform = &shader->uniforms[u]; switch (uniform->type) { case GL_FLOAT: glUniform1f(uniform->location, uniform->value.f);

@@ -284,8 +284,8 @@ glBindTexture(GL_TEXTURE_2D, shader->tex);

glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); } -void GBAGLES2ContextDrawFrame(struct VideoBackend* v) { - struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; +void mGLES2ContextDrawFrame(struct VideoBackend* v) { + struct mGLES2Context* context = (struct mGLES2Context*) v; glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, context->tex);

@@ -300,8 +300,8 @@ glBindFramebuffer(GL_FRAMEBUFFER, 0);

glUseProgram(0); } -void GBAGLES2ContextPostFrame(struct VideoBackend* v, const void* frame) { - struct GBAGLES2Context* context = (struct GBAGLES2Context*) v; +void mGLES2ContextPostFrame(struct VideoBackend* v, const void* frame) { + struct mGLES2Context* context = (struct mGLES2Context*) v; glBindTexture(GL_TEXTURE_2D, context->tex); #ifdef COLOR_16_BIT #ifdef COLOR_5_6_5

@@ -314,22 +314,22 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, v->width, v->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, frame);

#endif } -void GBAGLES2ContextCreate(struct GBAGLES2Context* context) { - context->d.init = GBAGLES2ContextInit; - context->d.deinit = GBAGLES2ContextDeinit; - context->d.setDimensions = GBAGLES2ContextSetDimensions; - context->d.resized = GBAGLES2ContextResized; +void mGLES2ContextCreate(struct mGLES2Context* context) { + context->d.init = mGLES2ContextInit; + context->d.deinit = mGLES2ContextDeinit; + context->d.setDimensions = mGLES2ContextSetDimensions; + context->d.resized = mGLES2ContextResized; context->d.swap = 0; - context->d.clear = GBAGLES2ContextClear; - context->d.postFrame = GBAGLES2ContextPostFrame; - context->d.drawFrame = GBAGLES2ContextDrawFrame; + context->d.clear = mGLES2ContextClear; + context->d.postFrame = mGLES2ContextPostFrame; + context->d.drawFrame = mGLES2ContextDrawFrame; context->d.setMessage = 0; context->d.clearMessage = 0; context->shaders = 0; context->nShaders = 0; } -void GBAGLES2ShaderInit(struct GBAGLES2Shader* shader, const char* vs, const char* fs, int width, int height, bool integerScaling, struct GBAGLES2Uniform* uniforms, size_t nUniforms) { +void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* fs, int width, int height, bool integerScaling, struct mGLES2Uniform* uniforms, size_t nUniforms) { shader->width = width; shader->height = height; shader->integerScaling = integerScaling;

@@ -403,19 +403,19 @@ }

glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void GBAGLES2ShaderDeinit(struct GBAGLES2Shader* shader) { +void mGLES2ShaderDeinit(struct mGLES2Shader* shader) { glDeleteTextures(1, &shader->tex); glDeleteShader(shader->fragmentShader); glDeleteProgram(shader->program); glDeleteFramebuffers(1, &shader->fbo); } -void GBAGLES2ShaderAttach(struct GBAGLES2Context* context, struct GBAGLES2Shader* shaders, size_t nShaders) { +void mGLES2ShaderAttach(struct mGLES2Context* context, struct mGLES2Shader* shaders, size_t nShaders) { if (context->shaders) { if (context->shaders == shaders && context->nShaders == nShaders) { return; } - GBAGLES2ShaderDetach(context); + mGLES2ShaderDetach(context); } context->shaders = shaders; context->nShaders = nShaders;

@@ -427,7 +427,7 @@ }

glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void GBAGLES2ShaderDetach(struct GBAGLES2Context* context) { +void mGLES2ShaderDetach(struct mGLES2Context* context) { if (!context->shaders) { return; }

@@ -485,22 +485,22 @@ *out = value;

return true; } -DECLARE_VECTOR(GBAGLES2UniformList, struct GBAGLES2Uniform); -DEFINE_VECTOR(GBAGLES2UniformList, struct GBAGLES2Uniform); +DECLARE_VECTOR(mGLES2UniformList, struct mGLES2Uniform); +DEFINE_VECTOR(mGLES2UniformList, struct mGLES2Uniform); static void _uniformHandler(const char* sectionName, void* user) { - struct GBAGLES2UniformList* uniforms = user; + struct mGLES2UniformList* uniforms = user; unsigned passId; int sentinel; if (sscanf(sectionName, "pass.%u.uniform.%n", &passId, &sentinel) < 1) { return; } - struct GBAGLES2Uniform* u = GBAGLES2UniformListAppend(uniforms); + struct mGLES2Uniform* u = mGLES2UniformListAppend(uniforms); u->name = sectionName; } -static void _loadValue(struct Configuration* description, const char* name, GLenum type, const char* field, union GBAGLES2UniformValue* value) { +static void _loadValue(struct Configuration* description, const char* name, GLenum type, const char* field, union mGLES2UniformValue* value) { char fieldName[16]; switch (type) { case GL_FLOAT:

@@ -710,7 +710,7 @@ break;

} } -static bool _loadUniform(struct Configuration* description, size_t pass, struct GBAGLES2Uniform* uniform) { +static bool _loadUniform(struct Configuration* description, size_t pass, struct mGLES2Uniform* uniform) { unsigned passId; if (sscanf(uniform->name, "pass.%u.uniform.", &passId) < 1 || passId != pass) { return false;

@@ -765,7 +765,7 @@ uniform->name = strdup(strstr(uniform->name, "uniform.") + strlen("uniform."));

return true; } -bool GBAGLES2ShaderLoad(struct VideoShader* shader, struct VDir* dir) { +bool mGLES2ShaderLoad(struct VideoShader* shader, struct VDir* dir) { struct VFile* manifest = dir->openFile(dir, "manifest.ini", O_RDONLY); if (!manifest) { return false;

@@ -780,7 +780,7 @@ if (inShaders > MAX_PASSES || inShaders < 1) {

success = false; } if (success) { - struct GBAGLES2Shader* shaderBlock = malloc(sizeof(struct GBAGLES2Shader) * inShaders); + struct mGLES2Shader* shaderBlock = malloc(sizeof(struct mGLES2Shader) * inShaders); int n; for (n = 0; n < inShaders; ++n) { char passName[12];

@@ -827,23 +827,23 @@ _lookupIntValue(&description, passName, "width", &width);

_lookupIntValue(&description, passName, "height", &height); _lookupIntValue(&description, passName, "integerScaling", &scaling); - struct GBAGLES2UniformList uniformVector; - GBAGLES2UniformListInit(&uniformVector, 0); + struct mGLES2UniformList uniformVector; + mGLES2UniformListInit(&uniformVector, 0); ConfigurationEnumerateSections(&description, _uniformHandler, &uniformVector); size_t u; - for (u = 0; u < GBAGLES2UniformListSize(&uniformVector); ++u) { - struct GBAGLES2Uniform* uniform = GBAGLES2UniformListGetPointer(&uniformVector, u); + for (u = 0; u < mGLES2UniformListSize(&uniformVector); ++u) { + struct mGLES2Uniform* uniform = mGLES2UniformListGetPointer(&uniformVector, u); if (!_loadUniform(&description, n, uniform)) { - GBAGLES2UniformListShift(&uniformVector, u, 1); + mGLES2UniformListShift(&uniformVector, u, 1); --u; } } - u = GBAGLES2UniformListSize(&uniformVector); - struct GBAGLES2Uniform* uniformBlock = malloc(sizeof(*uniformBlock) * u); - memcpy(uniformBlock, GBAGLES2UniformListGetPointer(&uniformVector, 0), sizeof(*uniformBlock) * u); - GBAGLES2UniformListDeinit(&uniformVector); + u = mGLES2UniformListSize(&uniformVector); + struct mGLES2Uniform* uniformBlock = malloc(sizeof(*uniformBlock) * u); + memcpy(uniformBlock, mGLES2UniformListGetPointer(&uniformVector, 0), sizeof(*uniformBlock) * u); + mGLES2UniformListDeinit(&uniformVector); - GBAGLES2ShaderInit(&shaderBlock[n], vssrc, fssrc, width, height, scaling, uniformBlock, u); + mGLES2ShaderInit(&shaderBlock[n], vssrc, fssrc, width, height, scaling, uniformBlock, u); int b = 0; _lookupIntValue(&description, passName, "blend", &b); if (b) {

@@ -875,7 +875,7 @@ }

} else { inShaders = n; for (n = 0; n < inShaders; ++n) { - GBAGLES2ShaderDeinit(&shaderBlock[n]); + mGLES2ShaderDeinit(&shaderBlock[n]); } } }

@@ -884,17 +884,17 @@ ConfigurationDeinit(&description);

return success; } -void GBAGLES2ShaderFree(struct VideoShader* shader) { +void mGLES2ShaderFree(struct VideoShader* shader) { free((void*) shader->name); free((void*) shader->author); free((void*) shader->description); shader->name = 0; shader->author = 0; shader->description = 0; - struct GBAGLES2Shader* shaders = shader->passes; + struct mGLES2Shader* shaders = shader->passes; size_t n; for (n = 0; n < shader->nPasses; ++n) { - GBAGLES2ShaderDeinit(&shaders[n]); + mGLES2ShaderDeinit(&shaders[n]); size_t u; for (u = 0; u < shaders[n].nUniforms; ++u) { free((void*) shaders[n].uniforms[u].name);
M src/platform/opengl/gles2.hsrc/platform/opengl/gles2.h

@@ -22,7 +22,7 @@ #endif

#include "platform/video-backend.h" -union GBAGLES2UniformValue { +union mGLES2UniformValue { GLfloat f; GLint i; GLboolean b;

@@ -40,17 +40,17 @@ GLfloat fmat3x3[9];

GLfloat fmat4x4[16]; }; -struct GBAGLES2Uniform { +struct mGLES2Uniform { const char* name; GLenum type; - union GBAGLES2UniformValue value; + union mGLES2UniformValue value; GLuint location; - union GBAGLES2UniformValue min; - union GBAGLES2UniformValue max; + union mGLES2UniformValue min; + union mGLES2UniformValue max; const char* readableName; }; -struct GBAGLES2Shader { +struct mGLES2Shader { int width; int height; bool integerScaling;

@@ -64,33 +64,33 @@ GLuint program;

GLuint texLocation; GLuint positionLocation; - struct GBAGLES2Uniform* uniforms; + struct mGLES2Uniform* uniforms; size_t nUniforms; }; -struct GBAGLES2Context { +struct mGLES2Context { struct VideoBackend d; GLuint tex; GLuint texLocation; GLuint positionLocation; - struct GBAGLES2Shader initialShader; - struct GBAGLES2Shader finalShader; + struct mGLES2Shader initialShader; + struct mGLES2Shader finalShader; - struct GBAGLES2Shader* shaders; + struct mGLES2Shader* shaders; size_t nShaders; }; -void GBAGLES2ContextCreate(struct GBAGLES2Context*); +void mGLES2ContextCreate(struct mGLES2Context*); -void GBAGLES2ShaderInit(struct GBAGLES2Shader*, const char* vs, const char* fs, int width, int height, bool integerScaling, struct GBAGLES2Uniform* uniforms, size_t nUniforms); -void GBAGLES2ShaderDeinit(struct GBAGLES2Shader*); -void GBAGLES2ShaderAttach(struct GBAGLES2Context*, struct GBAGLES2Shader*, size_t nShaders); -void GBAGLES2ShaderDetach(struct GBAGLES2Context*); +void mGLES2ShaderInit(struct mGLES2Shader*, const char* vs, const char* fs, int width, int height, bool integerScaling, struct mGLES2Uniform* uniforms, size_t nUniforms); +void mGLES2ShaderDeinit(struct mGLES2Shader*); +void mGLES2ShaderAttach(struct mGLES2Context*, struct mGLES2Shader*, size_t nShaders); +void mGLES2ShaderDetach(struct mGLES2Context*); struct VDir; -bool GBAGLES2ShaderLoad(struct VideoShader*, struct VDir*); -void GBAGLES2ShaderFree(struct VideoShader*); +bool mGLES2ShaderLoad(struct VideoShader*, struct VDir*); +void mGLES2ShaderFree(struct VideoShader*); #endif
M src/platform/qt/DisplayGL.cppsrc/platform/qt/DisplayGL.cpp

@@ -189,16 +189,16 @@ , m_backend(nullptr)

, m_messagePainter(nullptr) { #ifdef BUILD_GL - GBAGLContext* glBackend; + mGLContext* glBackend; #endif #if !defined(_WIN32) || defined(USE_EPOXY) - GBAGLES2Context* gl2Backend; + mGLES2Context* gl2Backend; #endif #if !defined(_WIN32) || defined(USE_EPOXY) if (glVersion & (QGLFormat::OpenGL_Version_3_0 | QGLFormat::OpenGL_ES_Version_2_0)) { - gl2Backend = new GBAGLES2Context; - GBAGLES2ContextCreate(gl2Backend); + gl2Backend = new mGLES2Context; + mGLES2ContextCreate(gl2Backend); m_backend = &gl2Backend->d; m_supportsShaders = true; }

@@ -206,8 +206,8 @@ #endif

#ifdef BUILD_GL if (!m_backend) { - glBackend = new GBAGLContext; - GBAGLContextCreate(glBackend); + glBackend = new mGLContext; + mGLContextCreate(glBackend); m_backend = &glBackend->d; m_supportsShaders = false; }

@@ -224,7 +224,7 @@ #endif

m_backend->init(m_backend, reinterpret_cast<WHandle>(m_gl->winId())); #if !defined(_WIN32) || defined(USE_EPOXY) if (m_supportsShaders) { - m_shader.preprocessShader = static_cast<void*>(&reinterpret_cast<GBAGLES2Context*>(m_backend)->initialShader); + m_shader.preprocessShader = static_cast<void*>(&reinterpret_cast<mGLES2Context*>(m_backend)->initialShader); } #endif m_gl->doneCurrent();

@@ -251,7 +251,7 @@ epoxy_handle_external_wglMakeCurrent();

#endif #if !defined(_WIN32) || defined(USE_EPOXY) if (m_shader.passes) { - GBAGLES2ShaderFree(&m_shader); + mGLES2ShaderFree(&m_shader); } #endif m_backend->deinit(m_backend);

@@ -310,7 +310,7 @@ #endif

#if !defined(_WIN32) || defined(USE_EPOXY) if (m_supportsShaders && m_shader.passes) { - GBAGLES2ShaderAttach(reinterpret_cast<GBAGLES2Context*>(m_backend), static_cast<GBAGLES2Shader*>(m_shader.passes), m_shader.nPasses); + mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses); } #endif

@@ -429,12 +429,12 @@ #if defined(_WIN32) && defined(USE_EPOXY)

epoxy_handle_external_wglMakeCurrent(); #endif if (m_shader.passes) { - GBAGLES2ShaderDetach(reinterpret_cast<GBAGLES2Context*>(m_backend)); - GBAGLES2ShaderFree(&m_shader); + mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend)); + mGLES2ShaderFree(&m_shader); } - GBAGLES2ShaderLoad(&m_shader, dir); + mGLES2ShaderLoad(&m_shader, dir); if (m_started) { - GBAGLES2ShaderAttach(reinterpret_cast<GBAGLES2Context*>(m_backend), static_cast<GBAGLES2Shader*>(m_shader.passes), m_shader.nPasses); + mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses); } m_gl->doneCurrent(); #endif

@@ -450,8 +450,8 @@ #if defined(_WIN32) && defined(USE_EPOXY)

epoxy_handle_external_wglMakeCurrent(); #endif if (m_shader.passes) { - GBAGLES2ShaderDetach(reinterpret_cast<GBAGLES2Context*>(m_backend)); - GBAGLES2ShaderFree(&m_shader); + mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend)); + mGLES2ShaderFree(&m_shader); } m_gl->doneCurrent(); #endif
M src/platform/qt/ShaderSelector.cppsrc/platform/qt/ShaderSelector.cpp

@@ -118,9 +118,9 @@ disconnect(this, SIGNAL(resetToDefault()), 0, 0);

#if !defined(_WIN32) || defined(USE_EPOXY) if (m_shaders->preprocessShader) { - m_ui.passes->addTab(makePage(static_cast<GBAGLES2Shader*>(m_shaders->preprocessShader), "default", 0), tr("Preprocessing")); + m_ui.passes->addTab(makePage(static_cast<mGLES2Shader*>(m_shaders->preprocessShader), "default", 0), tr("Preprocessing")); } - GBAGLES2Shader* shaders = static_cast<GBAGLES2Shader*>(m_shaders->passes); + mGLES2Shader* shaders = static_cast<mGLES2Shader*>(m_shaders->passes); QFileInfo fi(m_shaderPath); for (size_t p = 0; p < m_shaders->nPasses; ++p) { QWidget* page = makePage(&shaders[p], fi.baseName(), p);

@@ -200,7 +200,7 @@ i->setValue(def);

}); } -QWidget* ShaderSelector::makePage(GBAGLES2Shader* shader, const QString& name, int pass) { +QWidget* ShaderSelector::makePage(mGLES2Shader* shader, const QString& name, int pass) { if (!shader->nUniforms) { return nullptr; }

@@ -209,7 +209,7 @@ QFormLayout* layout = new QFormLayout;

page->setLayout(layout); for (size_t u = 0 ; u < shader->nUniforms; ++u) { QGridLayout* settings = new QGridLayout; - GBAGLES2Uniform* uniform = &shader->uniforms[u]; + mGLES2Uniform* uniform = &shader->uniforms[u]; QString section = QString("shader.%1.%2").arg(name).arg(pass); QString name = QLatin1String(uniform->name); switch (uniform->type) {
M src/platform/qt/ShaderSelector.hsrc/platform/qt/ShaderSelector.h

@@ -10,7 +10,7 @@ #include <QDialog>

#include "ui_ShaderSelector.h" -struct GBAGLES2Shader; +struct mGLES2Shader; class QGridLayout; struct VideoShader;

@@ -44,7 +44,7 @@

private: void addUniform(QGridLayout*, const QString& section, const QString& name, float* value, float min, float max, int y, int x); void addUniform(QGridLayout*, const QString& section, const QString& name, int* value, int min, int max, int y, int x); - QWidget* makePage(GBAGLES2Shader*, const QString& name, int pass); + QWidget* makePage(mGLES2Shader*, const QString& name, int pass); Ui::ShaderSelector m_ui; Display* m_display;
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -101,13 +101,15 @@ connect(m_controller, SIGNAL(gameStopped(mCoreThread*)), this, SLOT(gameStopped()));

connect(m_controller, SIGNAL(gameStopped(mCoreThread*)), &m_inputController, SLOT(resumeScreensaver())); connect(m_controller, SIGNAL(stateLoaded(mCoreThread*)), m_display, SLOT(forceDraw())); connect(m_controller, SIGNAL(rewound(mCoreThread*)), m_display, SLOT(forceDraw())); - connect(m_controller, &GameController::gamePaused, [this]() { - QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, - VIDEO_VERTICAL_PIXELS, VIDEO_HORIZONTAL_PIXELS * BYTES_PER_PIXEL, QImage::Format_RGBX8888); + connect(m_controller, &GameController::gamePaused, [this](mCoreThread* context) { + unsigned width, height; + context->core->desiredVideoDimensions(context->core, &width, &height); + QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), width, height, + width * BYTES_PER_PIXEL, QImage::Format_RGBX8888); QPixmap pixmap; pixmap.convertFromImage(currentImage); m_screenWidget->setPixmap(pixmap); - m_screenWidget->setLockAspectRatio(3, 2); + m_screenWidget->setLockAspectRatio(width, height); }); connect(m_controller, SIGNAL(gamePaused(mCoreThread*)), m_display, SLOT(pauseDrawing())); #ifndef Q_OS_MAC
M src/platform/sdl/gl-sdl.csrc/platform/sdl/gl-sdl.c

@@ -11,8 +11,6 @@ #include "core/core.h"

#include "core/thread.h" #include "platform/opengl/gl.h" -#define GB_GBA_CENTER ((VIDEO_HORIZONTAL_PIXELS - GB_VIDEO_HORIZONTAL_PIXELS + VIDEO_HORIZONTAL_PIXELS * (VIDEO_VERTICAL_PIXELS - GB_VIDEO_VERTICAL_PIXELS)) / 2) - static void _doViewport(int w, int h, struct VideoBackend* v) { v->resized(v, w, h); v->clear(v);

@@ -37,7 +35,7 @@ renderer->outputBuffer = malloc(renderer->width * renderer->height * BYTES_PER_PIXEL);

memset(renderer->outputBuffer, 0, renderer->width * renderer->height * BYTES_PER_PIXEL); renderer->core->setVideoBuffer(renderer->core, renderer->outputBuffer, renderer->width); - GBAGLContextCreate(&renderer->gl); + mGLContextCreate(&renderer->gl); renderer->gl.d.user = renderer; renderer->gl.d.lockAspectRatio = renderer->lockAspectRatio; renderer->gl.d.filter = renderer->filter;
M src/platform/sdl/gles2-sdl.csrc/platform/sdl/gles2-sdl.c

@@ -96,7 +96,7 @@

renderer->d.outputBuffer = memalign(16, VIDEO_HORIZONTAL_PIXELS * VIDEO_VERTICAL_PIXELS * 4); renderer->d.outputBufferStride = VIDEO_HORIZONTAL_PIXELS; - GBAGLES2ContextCreate(&renderer->gl2); + mGLES2ContextCreate(&renderer->gl2); renderer->gl2.d.user = renderer; renderer->gl2.d.lockAspectRatio = renderer->lockAspectRatio; renderer->gl2.d.filter = renderer->filter;
M src/platform/sdl/main.hsrc/platform/sdl/main.h

@@ -72,10 +72,10 @@ bool lockAspectRatio;

bool filter; #ifdef BUILD_GL - struct GBAGLContext gl; + struct mGLContext gl; #endif #if defined(BUILD_GLES2) || defined(USE_EPOXY) - struct GBAGLES2Context gl2; + struct mGLES2Context gl2; #endif #ifdef USE_PIXMAN