[Bf-blender-cvs] [04067a54c04] blender2.8: GPUShader: Fix previous "old Nvidia" fix commit

Clément Foucault noreply at git.blender.org
Mon Aug 13 23:09:58 CEST 2018


Commit: 04067a54c04472cff2e35a077d77630522e94e7f
Author: Clément Foucault
Date:   Mon Aug 13 23:09:48 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB04067a54c04472cff2e35a077d77630522e94e7f

GPUShader: Fix previous "old Nvidia" fix commit

Note to myself, next time, better check the fix before pushing it.

GL_ARB_texture_gather is defined if there is support for the extension
not only when the extension is enabled. Do this check ourself with
GPU_ARB_texture_gather define.

Original fix 822de6e9e1b8

===================================================================

M	source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl
M	source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
M	source/blender/gpu/intern/gpu_shader.c

===================================================================

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 b6b713e97a0..f834b698ef9 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl
@@ -48,7 +48,7 @@ void main()
 	float val = sampleLowerMip(texelPos);
 #else
 	vec4 samp;
-#  ifdef GL_ARB_texture_gather
+#  ifdef GPU_ARB_texture_gather
 	samp = gatherLowerMip(vec2(texelPos) / vec2(mipsize));
 #  else
 	samp.x = sampleLowerMip(texelPos);
@@ -66,7 +66,7 @@ void main()
 			samp.x = sampleLowerMip(texelPos + ivec2(2, 2));
 			val = minmax2(val, samp.x);
 		}
-#  ifdef GL_ARB_texture_gather
+#  ifdef GPU_ARB_texture_gather
 		samp = gatherLowerMip((vec2(texelPos) + vec2(1.0, 0.0)) / vec2(mipsize));
 #  else
 		samp.y = sampleLowerMip(texelPos + ivec2(2, 0));
@@ -76,7 +76,7 @@ void main()
 	}
 	/* if we are reducing an odd-height texture then fetch the edge texels */
 	if (((mipsize.y & 1) != 0) && (texelPos.y == mipsize.y - 3)) {
-#  ifdef GL_ARB_texture_gather
+#  ifdef GPU_ARB_texture_gather
 		samp = gatherLowerMip((vec2(texelPos) + vec2(0.0, 1.0)) / vec2(mipsize));
 #  else
 		samp.x = sampleLowerMip(texelPos + ivec2(0, 2));
diff --git a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
index 9a7856ecb13..dbf7f411a20 100644
--- a/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
+++ b/source/blender/draw/modes/shaders/object_outline_detect_frag.glsl
@@ -32,7 +32,7 @@ void main()
 {
 	ivec2 texel = ivec2(gl_FragCoord.xy);
 
-#ifdef GL_ARB_texture_gather
+#ifdef GPU_ARB_texture_gather
 	vec2 texel_size = 1.0 / vec2(textureSize(outlineId, 0).xy);
 	vec2 uv = ceil(gl_FragCoord.xy) * texel_size;
 
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index b812cf61483..427a3fd233e 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -226,6 +226,7 @@ static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH])
 		 * 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");
+			strcat(defines, "#define GPU_ARB_texture_gather\n");
 		}
 	}
 	if (GLEW_ARB_texture_query_lod) {



More information about the Bf-blender-cvs mailing list