diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-14 00:09:48 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-14 00:09:48 +0300 |
commit | 04067a54c04472cff2e35a077d77630522e94e7f (patch) | |
tree | 317a627f760ec6b6c81c6aa276bc37c180420af2 /source | |
parent | 53ed27052327ee8295380409ac6473f9114d44b1 (diff) |
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
Diffstat (limited to 'source')
3 files changed, 5 insertions, 4 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 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) { |