From edebadc0936c13de5c70b149fd99cfea684d4adc Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 14 Jan 2016 01:57:01 +1000 Subject: PixelShaderGen: Use bitwise AND for wrapping indirect texture coordinates (x % y) is not defined in GLSL when sign(x) != sign(y). This also has the added benefit of behaving the same as sampler wrapping modes, in regards to negative inputs. --- Source/Core/VideoBackends/Software/Tev.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoBackends/Software/Tev.cpp') diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 939b9f98a4..a09b9cbb00 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -374,15 +374,15 @@ static inline s32 WrapIndirectCoord(s32 coord, int wrapMode) case ITW_OFF: return coord; case ITW_256: - return (coord % (256 << 7)); + return (coord & ((256 << 7) - 1)); case ITW_128: - return (coord % (128 << 7)); + return (coord & ((128 << 7) - 1)); case ITW_64: - return (coord % (64 << 7)); + return (coord & ((64 << 7) - 1)); case ITW_32: - return (coord % (32 << 7)); + return (coord & ((32 << 7) - 1)); case ITW_16: - return (coord % (16 << 7)); + return (coord & ((16 << 7) - 1)); case ITW_0: return 0; default: -- cgit v1.2.3