Fix T55802 shader compile bug with texture gather on old Nvidia card
The extension GL_ARB_texture_gather is reported to be supported and does not trigger an error when enabled but the textureGater functions are not defined. Workaround is to disable the use of this extension on such systems.
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
* Adapted from http://rastergrid.com/blog/2010/10/hierarchical-z-map-based-occlusion-culling/
|
||||
**/
|
||||
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
|
||||
#ifdef LAYERED
|
||||
uniform sampler2DArray depthBuffer;
|
||||
uniform int depthLayer;
|
||||
|
||||
@@ -377,14 +377,13 @@ static void OBJECT_engine_init(void *vedata)
|
||||
datatoc_common_fullscreen_vert_glsl, NULL,
|
||||
datatoc_object_outline_detect_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
"#extension GL_ARB_texture_gather : enable\n");
|
||||
NULL);
|
||||
|
||||
e_data.outline_detect_wire_sh = DRW_shader_create_with_lib(
|
||||
datatoc_common_fullscreen_vert_glsl, NULL,
|
||||
datatoc_object_outline_detect_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
"#define WIRE\n"
|
||||
"#extension GL_ARB_texture_gather : enable\n");
|
||||
"#define WIRE\n");
|
||||
|
||||
|
||||
e_data.outline_fade_sh = DRW_shader_create_fullscreen(datatoc_object_outline_expand_frag_glsl, NULL);
|
||||
|
||||
@@ -221,6 +221,13 @@ static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH])
|
||||
* don't use an extension for something already available!
|
||||
*/
|
||||
|
||||
if (GLEW_ARB_texture_gather) {
|
||||
/* There is a bug on older Nvidia GPU where GL_ARB_texture_gather
|
||||
* is reported to be supported but yield a compile error (see T55802). */
|
||||
if (!GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY) || GLEW_VERSION_4_0) {
|
||||
strcat(defines, "#extension GL_ARB_texture_gather: enable\n");
|
||||
}
|
||||
}
|
||||
if (GLEW_ARB_texture_query_lod) {
|
||||
/* a #version 400 feature, but we use #version 330 maximum so use extension */
|
||||
strcat(defines, "#extension GL_ARB_texture_query_lod: enable\n");
|
||||
|
||||
Reference in New Issue
Block a user