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 822de6e9e1
This commit is contained in:
2018-08-13 23:09:48 +02:00
parent 53ed270523
commit 04067a54c0
3 changed files with 5 additions and 4 deletions

View File

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

View File

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

View File

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