all repos — mgba @ 94ac31182989b5589dd9fc2a9b85ed49b210a57d

mGBA Game Boy Advance Emulator

Qt: Fix OpenGL 2.1 support (fixes #1678)
Vicki Pfau vi@endrift.com
Fri, 28 Feb 2020 18:27:13 -0800
commit

94ac31182989b5589dd9fc2a9b85ed49b210a57d

parent

2b4b9ce66e6d122982656bb9a103aa8bda0d090a

2 files changed, 10 insertions(+), 4 deletions(-)

jump to
M CHANGESCHANGES

@@ -6,6 +6,7 @@ - GBA Timers: Fix deserializing count-up timers

Other fixes: - Core: Fix ELF loading regression (fixes mgba.io/i/1669) - Core: Fix crash modifying hash table entry (fixes mgba.io/i/1673) + - Qt: Fix OpenGL 2.1 support (fixes mgba.io/i/1678) Misc: - Qt: Disable Replace ROM option when no game loaded - Qt: Defer texture updates until frame is drawn (fixes mgba.io/i/1590)
M src/platform/opengl/gles2.csrc/platform/opengl/gles2.c

@@ -21,6 +21,9 @@ static const GLchar* const _gles2Header =

"#version 100\n" "precision mediump float;\n"; +static const GLchar* const _gl2Header = + "#version 120\n"; + static const GLchar* const _gl32VHeader = "#version 150 core\n" "#define attribute in\n"

@@ -462,10 +465,12 @@ shader->vertexShader = glCreateShader(GL_VERTEX_SHADER);

shader->fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); const GLchar* shaderBuffer[2]; const GLubyte* version = glGetString(GL_VERSION); - if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) { - shaderBuffer[0] = _gl32VHeader; - } else { + if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES ")) == 0) { shaderBuffer[0] = _gles2Header; + } else if (version[0] == '2') { + shaderBuffer[0] = _gl2Header; + } else { + shaderBuffer[0] = _gl32VHeader; } if (vs) { shaderBuffer[1] = vs;

@@ -474,7 +479,7 @@ shaderBuffer[1] = _nullVertexShader;

} glShaderSource(shader->vertexShader, 2, shaderBuffer, 0); - if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) { + if (shaderBuffer[0] == _gl32VHeader) { shaderBuffer[0] = _gl32FHeader; } if (fs) {