From 2018df9939d302dc6ebec0f4eb61e6d50bee07c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 18 Aug 2017 14:23:25 +0200 Subject: [PATCH] Eevee: MinmaxZ: Avoid unecessary conversions. --- .../draw/engines/eevee/shaders/effect_minmaxz_frag.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 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 71e249e1599..ce6f3568cdf 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_minmaxz_frag.glsl @@ -42,9 +42,9 @@ void main() val = minmax(val, val4); /* if we are reducing an odd-width texture then fetch the edge texels */ - if (((mipsize.x & 1) != 0) && (int(gl_FragCoord.x)*2 == mipsize.x-3)) { + if (((mipsize.x & 1) != 0) && (texelPos.x == mipsize.x - 3)) { /* if both edges are odd, fetch the top-left corner texel */ - if (((mipsize.y & 1) != 0) && (int(gl_FragCoord.y)*2 == mipsize.y-3)) { + if (((mipsize.y & 1) != 0) && (texelPos.y == mipsize.y - 3)) { val = minmax(val, sampleLowerMip(texelPos + ivec2(2, 2))); } float val2 = sampleLowerMip(texelPos + ivec2(2, 0)); @@ -53,7 +53,7 @@ void main() val = minmax(val, val3); } /* if we are reducing an odd-height texture then fetch the edge texels */ - if (((mipsize.y & 1) != 0) && (int(gl_FragCoord.y)*2 == mipsize.y-3)) { + if (((mipsize.y & 1) != 0) && (texelPos.y == mipsize.y - 3)) { float val2 = sampleLowerMip(texelPos + ivec2(0, 2)); float val3 = sampleLowerMip(texelPos + ivec2(1, 2)); val = minmax(val, val2);