From c773a500f29eecaf167ef768d33ed2b6df5c89c1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Sep 2014 09:01:16 +0200 Subject: [PATCH] - only activate shader storage buffers on modern drivers also supporting GL_ARB_buffer storage. Early adopters of this extension (i.e. older AMD drivers mainly) tend to implement this badly. --- src/gl/system/gl_interface.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index be0beaf4e..4541cfb18 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -133,8 +133,16 @@ void gl_LoadExtensions() if (!Args->CheckParm("-gl3")) { // don't use GL 4.x features when running in GL 3 emulation mode. - if (CheckExtension("GL_ARB_shader_storage_buffer_object")) gl.flags |= RFL_SHADER_STORAGE_BUFFER; - if (CheckExtension("GL_ARB_buffer_storage")) gl.flags |= RFL_BUFFER_STORAGE; + if (CheckExtension("GL_ARB_buffer_storage")) + { + // work around a problem with older AMD drivers: Their implementation of shader storage buffer objects is piss-poor and does not match uniform buffers even closely. + // Recent drivers, GL 4.4 don't have this problem, these can easily be recognized by also supporting the GL_ARB_buffer_storage extension. + if (CheckExtension("GL_ARB_shader_storage_buffer_object")) + { + gl.flags |= RFL_SHADER_STORAGE_BUFFER; + } + gl.flags |= RFL_BUFFER_STORAGE; + } } int v;