Eevee: Fix downsampling shader with textureGather

This was leading to issues with all raytracing and AO algorithm.

Fix T55619
This commit is contained in:
Clément Foucault 2018-09-11 16:14:29 +02:00
parent 766d9c2937
commit aa5c543a7f
Notes: blender-bot 2023-02-14 11:20:29 +01:00
Referenced by issue #55619, Fix GTAO
1 changed files with 4 additions and 3 deletions

View File

@ -49,7 +49,8 @@ void main()
#else
vec4 samp;
# ifdef GPU_ARB_texture_gather
samp = gatherLowerMip(vec2(texelPos) / vec2(mipsize));
/* + 1.0 to gather at the center of target 4 texels. */
samp = gatherLowerMip((vec2(texelPos) + 1.0) / vec2(mipsize));
# else
samp.x = sampleLowerMip(texelPos);
samp.y = sampleLowerMip(texelPos + ivec2(1, 0));
@ -67,7 +68,7 @@ void main()
val = minmax2(val, samp.x);
}
# ifdef GPU_ARB_texture_gather
samp = gatherLowerMip((vec2(texelPos) + vec2(1.0, 0.0)) / vec2(mipsize));
samp = gatherLowerMip((vec2(texelPos) + vec2(2.0, 1.0)) / vec2(mipsize));
# else
samp.y = sampleLowerMip(texelPos + ivec2(2, 0));
samp.z = sampleLowerMip(texelPos + ivec2(2, 1));
@ -77,7 +78,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 GPU_ARB_texture_gather
samp = gatherLowerMip((vec2(texelPos) + vec2(0.0, 1.0)) / vec2(mipsize));
samp = gatherLowerMip((vec2(texelPos) + vec2(1.0, 2.0)) / vec2(mipsize));
# else
samp.x = sampleLowerMip(texelPos + ivec2(0, 2));
samp.y = sampleLowerMip(texelPos + ivec2(1, 2));