[OGL] Update extension checks in Render.

This was relying on behaviour that GLExtensions was adding fake extensions to the supported list with ES.
This no longer happens so it needed to be changed.
This commit is contained in:
Ryan Houdek 2015-12-13 11:39:45 -06:00
parent b620b26f8f
commit 78dda1cf79
2 changed files with 67 additions and 63 deletions

View File

@ -336,6 +336,14 @@ Renderer::Renderer()
InitDriverInfo(); InitDriverInfo();
if (GLExtensions::Version() < 300)
{
// integer vertex attributes require a gl3 only function
PanicAlert("GPU: OGL ERROR: Need OpenGL version 3.\n"
"GPU: Does your video card support OpenGL 3?");
bSuccess = false;
}
// check for the max vertex attributes // check for the max vertex attributes
GLint numvertexattribs = 0; GLint numvertexattribs = 0;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs); glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
@ -357,6 +365,8 @@ Renderer::Renderer()
bSuccess = false; bSuccess = false;
} }
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
{
if (!GLExtensions::Supports("GL_ARB_framebuffer_object")) if (!GLExtensions::Supports("GL_ARB_framebuffer_object"))
{ {
// We want the ogl3 framebuffer instead of the ogl2 one for better blitting support. // We want the ogl3 framebuffer instead of the ogl2 one for better blitting support.
@ -408,22 +418,15 @@ Renderer::Renderer()
bSuccess = false; bSuccess = false;
} }
if (GLExtensions::Version() < 300)
{
// integer vertex attributes require a gl3 only function
PanicAlert("GPU: OGL ERROR: Need OpenGL version 3.\n"
"GPU: Does your video card support OpenGL 3?");
bSuccess = false;
}
// OpenGL 3 doesn't provide GLES like float functions for depth. // OpenGL 3 doesn't provide GLES like float functions for depth.
// They are in core in OpenGL 4.1, so almost every driver should support them. // They are in core in OpenGL 4.1, so almost every driver should support them.
// But for the oldest ones, we provide fallbacks to the old double functions. // But for the oldest ones, we provide fallbacks to the old double functions.
if (!GLExtensions::Supports("GL_ARB_ES2_compatibility") && GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) if (!GLExtensions::Supports("GL_ARB_ES2_compatibility"))
{ {
glDepthRangef = DepthRangef; glDepthRangef = DepthRangef;
glClearDepthf = ClearDepthf; glClearDepthf = ClearDepthf;
} }
}
g_Config.backend_info.bSupportsDualSourceBlend = GLExtensions::Supports("GL_ARB_blend_func_extended") || g_Config.backend_info.bSupportsDualSourceBlend = GLExtensions::Supports("GL_ARB_blend_func_extended") ||
GLExtensions::Supports("GL_EXT_blend_func_extended"); GLExtensions::Supports("GL_EXT_blend_func_extended");
@ -456,7 +459,6 @@ Renderer::Renderer()
g_ogl_config.bSupportsGLBufferStorage = GLExtensions::Supports("GL_ARB_buffer_storage") || g_ogl_config.bSupportsGLBufferStorage = GLExtensions::Supports("GL_ARB_buffer_storage") ||
GLExtensions::Supports("GL_EXT_buffer_storage"); GLExtensions::Supports("GL_EXT_buffer_storage");
g_ogl_config.bSupportsMSAA = GLExtensions::Supports("GL_ARB_texture_multisample"); g_ogl_config.bSupportsMSAA = GLExtensions::Supports("GL_ARB_texture_multisample");
g_ogl_config.bSupportOGL31 = GLExtensions::Version() >= 310;
g_ogl_config.bSupportViewportFloat = GLExtensions::Supports("GL_ARB_viewport_array"); g_ogl_config.bSupportViewportFloat = GLExtensions::Supports("GL_ARB_viewport_array");
g_ogl_config.bSupportsDebug = GLExtensions::Supports("GL_KHR_debug") || g_ogl_config.bSupportsDebug = GLExtensions::Supports("GL_KHR_debug") ||
GLExtensions::Supports("GL_ARB_debug_output"); GLExtensions::Supports("GL_ARB_debug_output");
@ -474,6 +476,9 @@ Renderer::Renderer()
GLExtensions::Supports("GL_OES_texture_buffer") ? ES_TEXBUF_TYPE::TEXBUF_OES : GLExtensions::Supports("GL_OES_texture_buffer") ? ES_TEXBUF_TYPE::TEXBUF_OES :
GLExtensions::Supports("GL_EXT_texture_buffer") ? ES_TEXBUF_TYPE::TEXBUF_EXT : ES_TEXBUF_TYPE::TEXBUF_NONE; GLExtensions::Supports("GL_EXT_texture_buffer") ? ES_TEXBUF_TYPE::TEXBUF_EXT : ES_TEXBUF_TYPE::TEXBUF_NONE;
g_ogl_config.bSupportsGLSLCache = true;
g_ogl_config.bSupportsGLSync = true;
if (strstr(g_ogl_config.glsl_version, "3.0") || DriverDetails::HasBug(DriverDetails::BUG_BROKENGLES31)) if (strstr(g_ogl_config.glsl_version, "3.0") || DriverDetails::HasBug(DriverDetails::BUG_BROKENGLES31))
{ {
g_ogl_config.eSupportedGLSLVersion = GLSLES_300; g_ogl_config.eSupportedGLSLVersion = GLSLES_300;
@ -687,7 +692,7 @@ Renderer::Renderer()
} }
else else
{ {
if (g_ogl_config.bSupportOGL31) if (GLExtensions::Version() >= 310)
{ {
glEnable(GL_PRIMITIVE_RESTART); glEnable(GL_PRIMITIVE_RESTART);
glPrimitiveRestartIndex(65535); glPrimitiveRestartIndex(65535);

View File

@ -41,7 +41,6 @@ struct VideoConfig
bool bSupportsGLBufferStorage; bool bSupportsGLBufferStorage;
bool bSupportsMSAA; bool bSupportsMSAA;
GLSL_VERSION eSupportedGLSLVersion; GLSL_VERSION eSupportedGLSLVersion;
bool bSupportOGL31;
bool bSupportViewportFloat; bool bSupportViewportFloat;
bool bSupportsAEP; bool bSupportsAEP;
bool bSupportsDebug; bool bSupportsDebug;