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:
Clément Foucault 2018-08-13 11:48:44 +02:00
parent 2aa26de378
commit 822de6e9e1
Notes: blender-bot 2023-02-14 08:07:50 +01:00
Referenced by commit 04067a54c0, GPUShader: Fix previous "old Nvidia" fix commit
Referenced by issue #55802, Segmentation fault crash starting Blender 2.8 under Linux
3 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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");