From 9e70771da37b6cac52cd35395f121c2d690ddd83 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Mar 2017 20:14:18 +0100 Subject: [PATCH] - Added a check to allow shader storage buffers on GL 4.3 Intel drivers. It doesn't work if GLSL version is set to 4.0 and the feature activated via extension. --- src/gl/shaders/gl_shader.cpp | 6 +++++- src/gl/system/gl_interface.cpp | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index 9cb5e9aab..44be65ebe 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -97,7 +97,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * } else { - vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n"; + // This differentiation is for Intel which do not seem to expose the full extension, even if marked as required. + if (gl.glslversion < 4.3f) + vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n"; + else + vp_comb = "#version 430 core\n#define SHADER_STORAGE_LIGHTS\n"; } if (gl.buffermethod == BM_DEFERRED) diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 485876e7a..a0d16597f 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -233,8 +233,8 @@ void gl_LoadExtensions() // 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")) { - // Shader storage buffer objects are broken on current Intel drivers. - if (strstr(gl.vendorstring, "Intel") == NULL) + // Intel's GLSL compiler is a bit broken with extensions, so unlock the feature only if not on Intel or having GL 4.3. + if (strstr(gl.vendorstring, "Intel") == NULL || gl_version >= 4.3f) { gl.flags |= RFL_SHADER_STORAGE_BUFFER; }