diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-13 12:48:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-14 00:01:18 +0300 |
commit | 822de6e9e1b87e2ed3571e7166281fa622c28c02 (patch) | |
tree | 6a247033033301c8c999ad1dca070d59876df2d9 /source | |
parent | 2aa26de378a6afd64257a79444af932d3e054558 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl | 2 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 7 |
3 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl index 24dbb5436d9..b6b713e97a0 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl @@ -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; diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 26e1428cb8b..a8a1d735a90 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -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); diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 67ae1414b66..6560b5e7f13 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -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"); |