From 7e8f96f0d3649f20483a639ac37f489737cba500 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Wed, 17 Dec 2014 00:26:03 +0100 Subject: [PATCH] OGL: Don't generate a geometry shader if the backend doesn't support it. This commit repurposes the bSupportsStereoscopy flag as the bSupportsGeometryShaders flag. --- Source/Core/DolphinWX/VideoConfigDiag.cpp | 2 +- Source/Core/VideoBackends/D3D/main.cpp | 2 +- Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp | 2 +- Source/Core/VideoBackends/OGL/Render.cpp | 10 +++++----- Source/Core/VideoBackends/OGL/main.cpp | 2 +- Source/Core/VideoCommon/VideoConfig.cpp | 2 +- Source/Core/VideoCommon/VideoConfig.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index 6ccba4251d..c1a26c2387 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -449,7 +449,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con // - stereoscopy - if (vconfig.backend_info.bSupportsStereoscopy && vconfig.iStereoMode > 0) + if (vconfig.backend_info.bSupportsGeometryShaders && vconfig.iStereoMode > 0) { wxFlexGridSizer* const szr_stereo = new wxFlexGridSizer(2, 5, 5); diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 0126ab8b1d..6652d6bc57 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -80,7 +80,7 @@ void InitBackendInfo() g_Config.backend_info.bSupportsDualSourceBlend = true; g_Config.backend_info.bSupportsPrimitiveRestart = true; g_Config.backend_info.bSupportsOversizedViewports = false; - g_Config.backend_info.bSupportsStereoscopy = true; + g_Config.backend_info.bSupportsGeometryShaders = true; g_Config.backend_info.bSupports3DVision = true; IDXGIFactory* factory; diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 8f90aff28a..14f5f94c82 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -211,7 +211,7 @@ SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components ShaderCode gcode; GenerateVertexShaderCode(vcode, components, API_OPENGL); GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL, components); - if (!IsPassthroughGeometryShader(uid.guid)) + if (g_ActiveConfig.backend_info.bSupportsGeometryShaders && !IsPassthroughGeometryShader(uid.guid)) GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL); if (g_ActiveConfig.bEnableShaderDebugging) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b717e3cf35..8658f92894 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -498,7 +498,7 @@ Renderer::Renderer() { g_ogl_config.eSupportedGLSLVersion = GLSLES_300; g_ogl_config.bSupportsAEP = false; - g_Config.backend_info.bSupportsStereoscopy = false; + g_Config.backend_info.bSupportsGeometryShaders = false; } else { @@ -506,7 +506,7 @@ Renderer::Renderer() g_ogl_config.bSupportsAEP = GLExtensions::Supports("GL_ANDROID_extension_pack_es31a"); g_Config.backend_info.bSupportsBindingLayout = true; g_Config.backend_info.bSupportsEarlyZ = true; - g_Config.backend_info.bSupportsStereoscopy = g_ogl_config.bSupportsAEP; + g_Config.backend_info.bSupportsGeometryShaders = g_ogl_config.bSupportsAEP; } } else @@ -522,13 +522,13 @@ Renderer::Renderer() { g_ogl_config.eSupportedGLSLVersion = GLSL_130; g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+ - g_Config.backend_info.bSupportsStereoscopy = false; // geometry shaders are only supported on glsl150+ + g_Config.backend_info.bSupportsGeometryShaders = false; // geometry shaders are only supported on glsl150+ } else if (strstr(g_ogl_config.glsl_version, "1.40")) { g_ogl_config.eSupportedGLSLVersion = GLSL_140; g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+ - g_Config.backend_info.bSupportsStereoscopy = false; // geometry shaders are only supported on glsl150+ + g_Config.backend_info.bSupportsGeometryShaders = false; // geometry shaders are only supported on glsl150+ } else { @@ -565,7 +565,7 @@ Renderer::Renderer() bSuccess = false; } - if (g_Config.iStereoMode > 0 && !g_Config.backend_info.bSupportsStereoscopy) + if (g_Config.iStereoMode > 0 && !g_Config.backend_info.bSupportsGeometryShaders) OSD::AddMessage("Stereoscopic 3D isn't supported by your GPU, support for OpenGL 3.2 is required.", 10000); if (!bSuccess) diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index addfcf0533..c4c966458e 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -139,7 +139,7 @@ static void InitBackendInfo() //g_Config.backend_info.bSupportsDualSourceBlend = true; // is gpu dependent and must be set in renderer //g_Config.backend_info.bSupportsEarlyZ = true; // is gpu dependent and must be set in renderer g_Config.backend_info.bSupportsOversizedViewports = true; - g_Config.backend_info.bSupportsStereoscopy = true; + g_Config.backend_info.bSupportsGeometryShaders = true; g_Config.backend_info.bSupports3DVision = false; g_Config.backend_info.Adapters.clear(); diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 2b6025f13e..d0f02dd327 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -214,7 +214,7 @@ void VideoConfig::VerifyValidity() // TODO: Check iMaxAnisotropy value if (iAdapter < 0 || iAdapter > ((int)backend_info.Adapters.size() - 1)) iAdapter = 0; if (iMultisampleMode < 0 || iMultisampleMode >= (int)backend_info.AAModes.size()) iMultisampleMode = 0; - if (!backend_info.bSupportsStereoscopy) iStereoMode = 0; + if (!backend_info.bSupportsGeometryShaders) iStereoMode = 0; } void VideoConfig::Save(const std::string& ini_file) diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index fa5a52772b..f27b1b2116 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -151,7 +151,7 @@ struct VideoConfig final bool bSupportsDualSourceBlend; bool bSupportsPrimitiveRestart; bool bSupportsOversizedViewports; - bool bSupportsStereoscopy; + bool bSupportsGeometryShaders; bool bSupports3DVision; bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon bool bSupportsBindingLayout; // Needed by ShaderGen, so must stay in VideoCommon