diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index f554544953..88e33a5119 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -83,6 +83,7 @@ void InitBackendInfo() g_Config.backend_info.bSupports3DVision = true; g_Config.backend_info.bSupportsPostProcessing = false; g_Config.backend_info.bSupportsPaletteConversion = true; + g_Config.backend_info.bSupportsClipControl = true; IDXGIFactory* factory; IDXGIAdapter* ad; diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b2011e6cdd..008437a7cb 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -468,6 +468,7 @@ Renderer::Renderer() g_Config.backend_info.bSupportsGSInstancing = GLExtensions::Supports("GL_ARB_gpu_shader5"); g_Config.backend_info.bSupportsGeometryShaders = GLExtensions::Version() >= 320; g_Config.backend_info.bSupportsPaletteConversion = GLExtensions::Supports("GL_ARB_texture_buffer_object"); + g_Config.backend_info.bSupportsClipControl = GLExtensions::Supports("GL_ARB_clip_control"); // Desktop OpenGL supports the binding layout if it supports 420pack // OpenGL ES 3.1 supports it implicitly without an extension @@ -486,7 +487,6 @@ Renderer::Renderer() g_ogl_config.bSupportOGL31 = GLExtensions::Version() >= 310; g_ogl_config.bSupportViewportFloat = GLExtensions::Supports("GL_ARB_viewport_array"); g_ogl_config.bSupportsDebug = GLExtensions::Supports("GL_KHR_debug") || GLExtensions::Supports("GL_ARB_debug_output"); - g_ogl_config.bSupportsGLClipControl = GLExtensions::Supports("GL_ARB_clip_control"); if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3) { @@ -598,7 +598,7 @@ Renderer::Renderer() g_ogl_config.bSupportsMSAA ? "" : "MSAA ", g_ogl_config.bSupportSampleShading ? "" : "SSAA ", g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ", - g_ogl_config.bSupportsGLClipControl ? "" : "ClipControl " + g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl " ); s_last_multisample_mode = g_ActiveConfig.iMultisampleMode; @@ -635,6 +635,8 @@ Renderer::Renderer() glBlendFunc(GL_ONE, GL_ONE); glViewport(0, 0, GetTargetWidth(), GetTargetHeight()); // Reset The Current Viewport + if (g_ActiveConfig.backend_info.bSupportsClipControl) + glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearDepthf(1.0f); @@ -646,8 +648,6 @@ Renderer::Renderer() glDisable(GL_STENCIL_TEST); glEnable(GL_SCISSOR_TEST); - if (g_ogl_config.bSupportsGLClipControl) - glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); glScissor(0, 0, GetTargetWidth(), GetTargetHeight()); glBlendColor(0, 0, 0, 0.5f); glClearDepthf(1.0f); diff --git a/Source/Core/VideoBackends/OGL/Render.h b/Source/Core/VideoBackends/OGL/Render.h index cbf36fe943..834f73e3a3 100644 --- a/Source/Core/VideoBackends/OGL/Render.h +++ b/Source/Core/VideoBackends/OGL/Render.h @@ -25,7 +25,6 @@ struct VideoConfig bool bSupportsGLSync; bool bSupportsGLBaseVertex; bool bSupportsGLBufferStorage; - bool bSupportsGLClipControl; bool bSupportsMSAA; bool bSupportSampleShading; GLSL_VERSION eSupportedGLSLVersion; diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index fea6ee3916..45bd8d71f3 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -379,7 +379,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ //write the true depth value, if the game uses depth textures pixel shaders will override with the correct values //if not early z culling will improve speed - if (api_type == API_D3D) + if (g_ActiveConfig.backend_info.bSupportsClipControl) { out.Write("o.pos.z = o.pos.w + o.pos.z;\n"); } diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 2eaa0d7e75..b0f133e759 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -159,6 +159,7 @@ struct VideoConfig final bool bSupportsGSInstancing; // Needed by GeometryShaderGen, so must stay in VideoCommon bool bSupportsPostProcessing; bool bSupportsPaletteConversion; + bool bSupportsClipControl; // Needed by VertexShaderGen, so must stay in VideoCommon } backend_info; // Utility