OpenGL: Bump minimum to 3.2

This commit is contained in:
Vicki Pfau 2019-10-05 15:36:52 -07:00
parent a2ed0785d9
commit d1ef6d258e
4 changed files with 19 additions and 6 deletions

View File

@ -86,7 +86,7 @@ Other Unix-like platforms, such as OpenBSD, are known to work as well, but are u
### System requirements ### 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 Downloads
--------- ---------

View File

@ -64,7 +64,7 @@ static const GLchar* const _gles3Header =
"precision highp isampler2D;\n"; "precision highp isampler2D;\n";
static const GLchar* const _gl3Header = static const GLchar* const _gl3Header =
"#version 130\n" "#version 150 core\n"
"#define OUT(n)\n" "#define OUT(n)\n"
PALETTE_ENTRY PALETTE_ENTRY
"precision highp float;\n"; "precision highp float;\n";

View File

@ -21,8 +21,17 @@ static const GLchar* const _gles2Header =
"#version 100\n" "#version 100\n"
"precision mediump float;\n"; "precision mediump float;\n";
static const GLchar* const _gl3Header = static const GLchar* const _gl32VHeader =
"#version 120\n"; "#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 = static const char* const _vertexShader =
"attribute vec4 position;\n" "attribute vec4 position;\n"
@ -449,7 +458,7 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
const GLchar* shaderBuffer[2]; const GLchar* shaderBuffer[2];
const GLubyte* version = glGetString(GL_VERSION); const GLubyte* version = glGetString(GL_VERSION);
if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) { if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) {
shaderBuffer[0] = _gl3Header; shaderBuffer[0] = _gl32VHeader;
} else { } else {
shaderBuffer[0] = _gles2Header; shaderBuffer[0] = _gles2Header;
} }
@ -460,6 +469,9 @@ void mGLES2ShaderInit(struct mGLES2Shader* shader, const char* vs, const char* f
} }
glShaderSource(shader->vertexShader, 2, shaderBuffer, 0); glShaderSource(shader->vertexShader, 2, shaderBuffer, 0);
if (strncmp((const char*) version, "OpenGL ES ", strlen("OpenGL ES "))) {
shaderBuffer[0] = _gl32FHeader;
}
if (fs) { if (fs) {
shaderBuffer[1] = fs; shaderBuffer[1] = fs;
} else { } else {

View File

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