mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 16:10:01 +00:00
Qt: Fix OpenGL 2.1 support (fixes #1678)
This commit is contained in:
parent
cd6209d7f0
commit
a637ac256d
1
CHANGES
1
CHANGES
@ -22,6 +22,7 @@ Other fixes:
|
||||
- GBA: Reject incorrectly sized BIOSes
|
||||
- Debugger: Don't skip undefined instructions when debugger attached
|
||||
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
||||
- Qt: Fix OpenGL 2.1 support (fixes mgba.io/i/1678)
|
||||
Misc:
|
||||
- FFmpeg: Add looping option for GIF/APNG
|
||||
- Qt: Renderer can be changed while a game is running
|
||||
|
@ -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 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
|
||||
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 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
|
||||
}
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user