all repos — mgba @ d1ef6d258ed3dafe1d56000087b8d332aba69f5f

mGBA Game Boy Advance Emulator

OpenGL: Bump minimum to 3.2
Vicki Pfau vi@endrift.com
Sat, 05 Oct 2019 15:36:52 -0700
commit

d1ef6d258ed3dafe1d56000087b8d332aba69f5f

parent

a2ed0785d95ba766025d02a1f00622bcdedbd09b

4 files changed, 19 insertions(+), 6 deletions(-)

jump to
M README.mdREADME.md

@@ -86,7 +86,7 @@ Other Unix-like platforms, such as OpenBSD, are known to work as well, but are untested and not fully supported.

### System requirements -Requirements are minimal. Any computer that can run Windows Vista or newer should be able to handle emulation. Support for OpenGL 1.1 or newer is also required, with OpenGL 3.0 or newer for shaders and advanced features. +Requirements are minimal. Any computer that can run Windows Vista or newer should be able to handle emulation. Support for OpenGL 1.1 or newer is also required, with OpenGL 3.2 or newer for shaders and advanced features. Downloads ---------
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -64,7 +64,7 @@ "precision highp sampler2D;\n"

"precision highp isampler2D;\n"; static const GLchar* const _gl3Header = - "#version 130\n" + "#version 150 core\n" "#define OUT(n)\n" PALETTE_ENTRY "precision highp float;\n";
M src/platform/opengl/gles2.csrc/platform/opengl/gles2.c

@@ -21,8 +21,17 @@ static const GLchar* const _gles2Header =

"#version 100\n" "precision mediump float;\n"; -static const GLchar* const _gl3Header = - "#version 120\n"; +static const GLchar* const _gl32VHeader = + "#version 150 core\n" + "#define attribute in\n" + "#define varying out\n"; + +static const GLchar* const _gl32FHeader = + "#version 150 core\n" + "#define varying in\n" + "#define texture2D texture\n" + "out vec4 compat_FragColor;\n" + "#define gl_FragColor compat_FragColor\n"; static const char* const _vertexShader = "attribute vec4 position;\n"

@@ -449,7 +458,7 @@ 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] = _gl3Header; + shaderBuffer[0] = _gl32VHeader; } else { shaderBuffer[0] = _gles2Header; }

@@ -460,6 +469,9 @@ shaderBuffer[1] = _nullVertexShader;

} glShaderSource(shader->vertexShader, 2, shaderBuffer, 0); + if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) { + shaderBuffer[0] = _gl32FHeader; + } if (fs) { shaderBuffer[1] = fs; } else {
M src/platform/qt/Display.cppsrc/platform/qt/Display.cpp

@@ -26,7 +26,8 @@

switch (s_driver) { #if defined(BUILD_GL) || defined(BUILD_GLES2) || defined(USE_EPOXY) case Driver::OPENGL: - format.setVersion(3, 0); + format.setVersion(3, 2); + format.setProfile(QSurfaceFormat::CoreProfile); return new DisplayGL(format, parent); #endif #ifdef BUILD_GL