mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
ogl: reorder driver extensions checks
This commit is contained in:
@ -385,22 +385,34 @@ Renderer::Renderer()
|
|||||||
g_ogl_config.bSupportOGL31 = false;
|
g_ogl_config.bSupportOGL31 = false;
|
||||||
g_ogl_config.eSupportedGLSLVersion = GLSLES3;
|
g_ogl_config.eSupportedGLSLVersion = GLSLES3;
|
||||||
#else
|
#else
|
||||||
GLint numvertexattribs = 0;
|
|
||||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
|
|
||||||
if (numvertexattribs < 16)
|
|
||||||
{
|
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Number of attributes %d not enough.\n"
|
|
||||||
"GPU: Does your video card support OpenGL 2.x?",
|
|
||||||
numvertexattribs);
|
|
||||||
bSuccess = false;
|
|
||||||
}
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
glewExperimental = 1;
|
glewExperimental = 1;
|
||||||
#endif
|
#endif
|
||||||
if (glewInit() != GLEW_OK)
|
if (glewInit() != GLEW_OK)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "glewInit() failed! Does your video card support OpenGL 2.x?");
|
PanicAlert("glewInit() failed! Does your video card support OpenGL 2.x?");
|
||||||
return; // TODO: fail
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for the max vertex attributes
|
||||||
|
GLint numvertexattribs = 0;
|
||||||
|
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
|
||||||
|
if (numvertexattribs < 16)
|
||||||
|
{
|
||||||
|
PanicAlert("GPU: OGL ERROR: Number of attributes %d not enough.\n"
|
||||||
|
"GPU: Does your video card support OpenGL 2.x?",
|
||||||
|
numvertexattribs);
|
||||||
|
bSuccess = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check the max texture width and height
|
||||||
|
GLint max_texture_size;
|
||||||
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&max_texture_size);
|
||||||
|
if (max_texture_size < 1024)
|
||||||
|
{
|
||||||
|
PanicAlert("GL_MAX_TEXTURE_SIZE too small at %i - must be at least 1024.",
|
||||||
|
max_texture_size);
|
||||||
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
@ -412,43 +424,49 @@ Renderer::Renderer()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!GLEW_EXT_secondary_color)
|
if (!GLEW_VERSION_2_0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_EXT_secondary_color.\n"
|
// OpenGL 2.0 is required for all shader based drawings. There is no way to get this by extensions
|
||||||
"GPU: Does your video card support OpenGL 2.x?");
|
PanicAlert("GPU: OGL ERROR: Does your video card support OpenGL 2.0?");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GLEW_ARB_framebuffer_object)
|
if (!GLEW_ARB_framebuffer_object)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: ERROR: Need GL_ARB_framebuffer_object for multiple render targets.\n"
|
// We want the ogl3 framebuffer instead of the ogl2 one for better blitting support.
|
||||||
|
// It's also compatible with the gles3 one.
|
||||||
|
PanicAlert("GPU: ERROR: Need GL_ARB_framebuffer_object for multiple render targets.\n"
|
||||||
"GPU: Does your video card support OpenGL 3.0?");
|
"GPU: Does your video card support OpenGL 3.0?");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GLEW_ARB_vertex_array_object)
|
if (!GLEW_ARB_vertex_array_object)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
|
// This extension is used to replace lots of pointer setting function.
|
||||||
|
// Also gles3 requires to use it.
|
||||||
|
PanicAlert("GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
|
||||||
"GPU: Does your video card support OpenGL 3.0?");
|
"GPU: Does your video card support OpenGL 3.0?");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GLEW_ARB_map_buffer_range)
|
if (!GLEW_ARB_map_buffer_range)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_map_buffer_range.\n"
|
// ogl3 buffer mapping for better streaming support.
|
||||||
|
// The ogl2 one also isn't in gles3.
|
||||||
|
PanicAlert("GPU: OGL ERROR: Need GL_ARB_map_buffer_range.\n"
|
||||||
"GPU: Does your video card support OpenGL 3.0?");
|
"GPU: Does your video card support OpenGL 3.0?");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GLEW_ARB_sampler_objects && bSuccess)
|
if (!GLEW_ARB_sampler_objects && bSuccess)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_sampler_objects."
|
// Our sampler cache uses this extension. It could easyly be workaround and it's by far the
|
||||||
"GPU: Does your video card support OpenGL 3.2?"
|
// highest requirement, but it seems that no driver lacks support for it.
|
||||||
|
PanicAlert("GPU: OGL ERROR: Need GL_ARB_sampler_objects."
|
||||||
|
"GPU: Does your video card support OpenGL 3.3?"
|
||||||
"Please report this issue, then there will be a workaround");
|
"Please report this issue, then there will be a workaround");
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
}
|
}
|
||||||
if (!GLEW_ARB_texture_non_power_of_two)
|
|
||||||
WARN_LOG(VIDEO, "ARB_texture_non_power_of_two not supported.");
|
|
||||||
|
|
||||||
// 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.
|
||||||
@ -460,9 +478,6 @@ Renderer::Renderer()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bSuccess)
|
|
||||||
return; // TODO: fail
|
|
||||||
|
|
||||||
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
|
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
|
||||||
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
|
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
|
||||||
g_Config.backend_info.bSupportsPrimitiveRestart = GLEW_VERSION_3_1 || GLEW_NV_primitive_restart;
|
g_Config.backend_info.bSupportsPrimitiveRestart = GLEW_VERSION_3_1 || GLEW_NV_primitive_restart;
|
||||||
@ -478,7 +493,7 @@ Renderer::Renderer()
|
|||||||
|
|
||||||
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10"))
|
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10"))
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need at least GLSL 1.20\n"
|
PanicAlert("GPU: OGL ERROR: Need at least GLSL 1.20\n"
|
||||||
"GPU: Does your video card support OpenGL 2.1?\n"
|
"GPU: Does your video card support OpenGL 2.1?\n"
|
||||||
"GPU: Your driver supports GLSL %s", g_ogl_config.glsl_version);
|
"GPU: Your driver supports GLSL %s", g_ogl_config.glsl_version);
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
@ -504,6 +519,12 @@ Renderer::Renderer()
|
|||||||
g_ogl_config.eSupportedGLSLVersion = GLSL_150;
|
g_ogl_config.eSupportedGLSLVersion = GLSL_150;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!bSuccess)
|
||||||
|
{
|
||||||
|
// Not all needed extensions are supported, so we have to stop here.
|
||||||
|
// Else some of the next calls might crash.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
|
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
|
||||||
if(g_ogl_config.max_samples < 1)
|
if(g_ogl_config.max_samples < 1)
|
||||||
@ -550,16 +571,6 @@ Renderer::Renderer()
|
|||||||
s_vsync = g_ActiveConfig.IsVSync();
|
s_vsync = g_ActiveConfig.IsVSync();
|
||||||
GLInterface->SwapInterval(s_vsync);
|
GLInterface->SwapInterval(s_vsync);
|
||||||
|
|
||||||
// check the max texture width and height
|
|
||||||
GLint max_texture_size;
|
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&max_texture_size);
|
|
||||||
if (max_texture_size < 1024)
|
|
||||||
ERROR_LOG(VIDEO, "GL_MAX_TEXTURE_SIZE too small at %i - must be at least 1024.",
|
|
||||||
max_texture_size);
|
|
||||||
|
|
||||||
if (GL_REPORT_ERROR() != GL_NO_ERROR)
|
|
||||||
bSuccess = false;
|
|
||||||
|
|
||||||
// TODO: Move these somewhere else?
|
// TODO: Move these somewhere else?
|
||||||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||||
@ -573,9 +584,6 @@ Renderer::Renderer()
|
|||||||
// options while running
|
// options while running
|
||||||
g_Config.bRunning = true;
|
g_Config.bRunning = true;
|
||||||
|
|
||||||
if (GL_REPORT_ERROR() != GL_NO_ERROR)
|
|
||||||
bSuccess = false;
|
|
||||||
|
|
||||||
glStencilFunc(GL_ALWAYS, 0, 0);
|
glStencilFunc(GL_ALWAYS, 0, 0);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user