Check for sRGB workaround only if needed.

This fixes the crash for old OpenGL 2.1 drivers
This commit is contained in:
deve 2015-12-14 11:35:42 +01:00
parent e77dbf3d9f
commit 4531b15d5c

View File

@ -46,7 +46,7 @@ void CentralVideoSettings::init()
hasTextureCompression = false; hasTextureCompression = false;
hasUBO = false; hasUBO = false;
hasGS = false; hasGS = false;
hasSRGBCapableVisual = false; hasSRGBCapableVisual = true;
m_GI_has_artifact = false; m_GI_has_artifact = false;
m_need_rh_workaround = false; m_need_rh_workaround = false;
@ -182,11 +182,14 @@ void CentralVideoSettings::init()
} }
// Check if visual is sRGB-capable // Check if visual is sRGB-capable
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE))
{
GLint param; GLint param;
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK_LEFT, glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &param); GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &param);
hasSRGBCapableVisual = (param == GL_SRGB); hasSRGBCapableVisual = (param == GL_SRGB);
} }
}
} }
unsigned CentralVideoSettings::getGLSLVersion() const unsigned CentralVideoSettings::getGLSLVersion() const
@ -216,7 +219,7 @@ bool CentralVideoSettings::needsRGBBindlessWorkaround() const
bool CentralVideoSettings::needsSRGBCapableVisualWorkaround() const bool CentralVideoSettings::needsSRGBCapableVisualWorkaround() const
{ {
return !hasSRGBCapableVisual && GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE); return !hasSRGBCapableVisual;
} }
bool CentralVideoSettings::isARBGeometryShader4Usable() const bool CentralVideoSettings::isARBGeometryShader4Usable() const