summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authormagumagu <magumagu9@gmail.com>2015-02-18 19:29:02 -0800
committermagumagu <magumagu9@gmail.com>2015-02-18 19:41:00 -0800
commit4cdf9f543f1de00076a7d2c02963aec2f9e544ef (patch)
tree2eb1be55be8d3704a8301b9dd4e747fa954fa886 /Source/Core/VideoCommon/PixelShaderGen.cpp
parentc8c61041ba6a3a9e8787d754c2aa672c76f65178 (diff)
Partially fix WWE12 titantron videos.
The obvious question here is, why does it matter if we round or truncate? The key is that GC/Wii does fixed-point interpolation, where PC GPUs do floating-point interpolation. Discarding fractional bits makes the conversion from floating-point to fixed point give more consistent results. I'm not confident this is really the right fix, or that my explanation is completely correct; ideally, we don't want to depend on floating-point interpolation at all.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 7c76628dd4..f4244aaa89 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -192,6 +192,12 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
"int3 iround(float3 x) { return int3(round(x)); }\n"
"int4 iround(float4 x) { return int4(round(x)); }\n\n");
+ out.Write("int itrunc(float x) { return int (trunc(x)); }\n"
+ "int2 itrunc(float2 x) { return int2(trunc(x)); }\n"
+ "int3 itrunc(float3 x) { return int3(trunc(x)); }\n"
+ "int4 itrunc(float4 x) { return int4(trunc(x)); }\n\n");
+
+
if (ApiType == API_OPENGL)
{
// Declare samplers
@@ -430,7 +436,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.SetConstantsUsed(C_TEXDIMS, C_TEXDIMS+numTexgen-1);
for (unsigned int i = 0; i < numTexgen; ++i)
{
- out.Write("\tint2 fixpoint_uv%d = iround(", i);
+ out.Write("\tint2 fixpoint_uv%d = itrunc(", i);
// optional perspective divides
uid_data->texMtxInfo_n_projection |= xfmem.texMtxInfo[i].projection << i;
if (xfmem.texMtxInfo[i].projection == XF_TEXPROJ_STQ)