From cff952c397833873055e42a85b76ff8a621a0792 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 12 Sep 2013 13:55:38 +0200 Subject: PixelShaderGen: Use integer math for indirect tev stage texcoord calculation. --- Source/Core/VideoBackends/Software/Tev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 ad21496e88..0c80e04c93 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -478,7 +478,7 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) case ITBA_OFF: AlphaBump = 0; break; - case ITBA_S: + case ITBA_S: AlphaBump = indmap[TextureSampler::ALP_SMP]; break; case ITBA_T: -- cgit v1.2.3 From 0238a568162099f0ee1db3d584e42db734f4e509 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 10 Oct 2013 21:09:00 +0200 Subject: PixelShaderGen: Change indirect texture matrix uniforms to use integers. --- Source/Core/VideoBackends/Software/Tev.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 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 0c80e04c93..49899f642c 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -544,19 +544,21 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) switch (indirect.mid & 12) { case 0: - shift = 3 + (17 - scale); - indtevtrans[0] = indmtx.col0.ma * indcoord[0] + indmtx.col1.mc * indcoord[1] + indmtx.col2.me * indcoord[2]; - indtevtrans[1] = indmtx.col0.mb * indcoord[0] + indmtx.col1.md * indcoord[1] + indmtx.col2.mf * indcoord[2]; + // matrix values are S0.10, output format is S17.7, so divide by 8 + shift = (17 - scale); + indtevtrans[0] = (indmtx.col0.ma * indcoord[0] + indmtx.col1.mc * indcoord[1] + indmtx.col2.me * indcoord[2]) >> 3; + indtevtrans[1] = (indmtx.col0.mb * indcoord[0] + indmtx.col1.md * indcoord[1] + indmtx.col2.mf * indcoord[2]) >> 3; break; case 4: // s matrix - shift = 8 + (17 - scale); - indtevtrans[0] = s * indcoord[0]; - indtevtrans[1] = t * indcoord[0]; + // s is S17.7, matrix elements are divided by 256, output is S17.7, so divide by 256. - TODO: Maybe, since s is actually stored as S24, we should divide by 256*64? + shift = (17 - scale); + indtevtrans[0] = s * indcoord[0] / 256; + indtevtrans[1] = t * indcoord[0] / 256; break; case 8: // t matrix - shift = 8 + (17 - scale); - indtevtrans[0] = s * indcoord[1]; - indtevtrans[1] = t * indcoord[1]; + shift = (17 - scale); + indtevtrans[0] = s * indcoord[1] / 256; + indtevtrans[1] = t * indcoord[1] / 256; break; default: return; -- cgit v1.2.3 From 3a6389992e65df1609d3a200807b6a1f4c389808 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sat, 2 Nov 2013 11:42:30 +0100 Subject: PixelShaderGen: Treat UV coordinates like S17.7 integers (they're still stored as float, though). --- Source/Core/VideoBackends/Software/Tev.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 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 49899f642c..3b517175eb 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -528,9 +528,9 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) return; } - s64 indtevtrans[2] = { 0,0 }; + s32 indtevtrans[2] = { 0,0 }; - // matrix multiply + // matrix multiply - results might overflow, but we don't care since we only use the lower 24 bits of the result. int indmtxid = indirect.mid & 3; if (indmtxid) { -- cgit v1.2.3