VertexShaderGen: Use correct depth output when glClipControl is supported.

This commit is contained in:
Jules Blok 2015-05-19 01:18:04 +02:00
parent 522e721830
commit 88cc91030e
5 changed files with 7 additions and 6 deletions

View File

@ -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;

View File

@ -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);

View File

@ -25,7 +25,6 @@ struct VideoConfig
bool bSupportsGLSync;
bool bSupportsGLBaseVertex;
bool bSupportsGLBufferStorage;
bool bSupportsGLClipControl;
bool bSupportsMSAA;
bool bSupportSampleShading;
GLSL_VERSION eSupportedGLSLVersion;

View File

@ -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");
}

View File

@ -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