OpenGL Renderer: Okay, let's try using GL_AMD_conservative_depth for those AMD drivers that outright lie about supporting GL_ARB_conservative_depth. (Related to commit 4d6a132 and commit 39f9483.)

This commit is contained in:
rogerman 2018-12-30 02:12:54 -08:00
parent 39f9483034
commit f97c633441
3 changed files with 10 additions and 4 deletions

View File

@ -1235,6 +1235,7 @@ OpenGLRenderer::OpenGLRenderer()
isShaderSupported = false;
isSampleShadingSupported = false;
isConservativeDepthSupported = false;
isConservativeDepthAMDSupported = false;
isVAOSupported = false;
willFlipOnlyFramebufferOnGPU = false;
willFlipAndConvertFramebufferOnGPU = false;

View File

@ -659,6 +659,7 @@ protected:
bool isVAOSupported;
bool isSampleShadingSupported;
bool isConservativeDepthSupported;
bool isConservativeDepthAMDSupported;
bool willFlipOnlyFramebufferOnGPU;
bool willFlipAndConvertFramebufferOnGPU;
bool willUsePerSampleZeroDstPass;

View File

@ -828,6 +828,7 @@ Render3DError OpenGLRenderer_3_2::InitExtensions()
this->isSampleShadingSupported = this->IsExtensionPresent(&oglExtensionSet, "GL_ARB_sample_shading");
this->isConservativeDepthSupported = this->IsExtensionPresent(&oglExtensionSet, "GL_ARB_conservative_depth") && IsOpenGLDriverVersionSupported(4, 0, 0);
this->isConservativeDepthAMDSupported = this->IsExtensionPresent(&oglExtensionSet, "GL_AMD_conservative_depth") && IsOpenGLDriverVersionSupported(4, 0, 0);
this->_enableTextureSmoothing = CommonSettings.GFX3D_Renderer_TextureSmoothing;
this->_emulateShadowPolygon = CommonSettings.OpenGL_Emulation_ShadowPolygon;
@ -1312,7 +1313,7 @@ Render3DError OpenGLRenderer_3_2::CreateGeometryPrograms()
programFlags.value = 0;
std::stringstream vtxShaderHeader;
if (this->isConservativeDepthSupported)
if (this->isConservativeDepthSupported || this->isConservativeDepthAMDSupported)
{
vtxShaderHeader << "#version 400\n";
}
@ -1325,17 +1326,20 @@ Render3DError OpenGLRenderer_3_2::CreateGeometryPrograms()
std::string vtxShaderCode = vtxShaderHeader.str() + std::string(GeometryVtxShader_150);
std::stringstream fragShaderHeader;
if (this->isConservativeDepthSupported)
if (this->isConservativeDepthSupported || this->isConservativeDepthAMDSupported)
{
fragShaderHeader << "#version 400\n";
fragShaderHeader << "#extension GL_ARB_conservative_depth : require\n";
// Prioritize using GL_AMD_conservative_depth over GL_ARB_conservative_depth, since AMD drivers
// seem to have problems with GL_ARB_conservative_depth.
fragShaderHeader << ((this->isConservativeDepthAMDSupported) ? "#extension GL_AMD_conservative_depth : require\n" : "#extension GL_ARB_conservative_depth : require\n");
}
else
{
fragShaderHeader << "#version 150\n";
}
fragShaderHeader << "\n";
fragShaderHeader << "#define IS_CONSERVATIVE_DEPTH_SUPPORTED " << ((this->isConservativeDepthSupported) ? 1 : 0) << "\n";
fragShaderHeader << "#define IS_CONSERVATIVE_DEPTH_SUPPORTED " << ((this->isConservativeDepthSupported || this->isConservativeDepthAMDSupported) ? 1 : 0) << "\n";
fragShaderHeader << "#define DEPTH_EQUALS_TEST_TOLERANCE " << DEPTH_EQUALS_TEST_TOLERANCE << ".0\n";
fragShaderHeader << "\n";