diff --git a/Source/Core/VideoCommon/BPMemory.h b/Source/Core/VideoCommon/BPMemory.h index 2c5a0811f0..2bb35d92c0 100644 --- a/Source/Core/VideoCommon/BPMemory.h +++ b/Source/Core/VideoCommon/BPMemory.h @@ -411,9 +411,6 @@ union TEXSCALE u32 rid : 8; }; u32 hex; - - float getScaleS(int i){return 1.0f/(float)(1<<(i?ss1:ss0));} - float getScaleT(int i){return 1.0f/(float)(1<<(i?ts1:ts0));} }; union RAS1_IREF diff --git a/Source/Core/VideoCommon/ConstantManager.h b/Source/Core/VideoCommon/ConstantManager.h index da3d19962f..85630966c5 100644 --- a/Source/Core/VideoCommon/ConstantManager.h +++ b/Source/Core/VideoCommon/ConstantManager.h @@ -16,7 +16,7 @@ struct PixelShaderConstants int4 alpha; float4 texdims[8]; int4 zbias[2]; - float4 indtexscale[2]; + int4 indtexscale[2]; int4 indtexmtx[6]; int4 fogcolor; int4 fogi[1]; diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 22ffa87eb5..942c557aa2 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -259,7 +259,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T DeclareUniform(out, ApiType, C_ALPHA, "int4", I_ALPHA); DeclareUniform(out, ApiType, C_TEXDIMS, "float4", I_TEXDIMS"[8]"); DeclareUniform(out, ApiType, C_ZBIAS, "int4", I_ZBIAS"[2]"); - DeclareUniform(out, ApiType, C_INDTEXSCALE, "float4", I_INDTEXSCALE"[2]"); + DeclareUniform(out, ApiType, C_INDTEXSCALE, "int4", I_INDTEXSCALE"[2]"); DeclareUniform(out, ApiType, C_INDTEXMTX, "int4", I_INDTEXMTX"[6]"); DeclareUniform(out, ApiType, C_FOGCOLOR, "int4", I_FOGCOLOR); DeclareUniform(out, ApiType, C_FOGI, "int4", I_FOGI"[1]"); @@ -352,7 +352,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T " int3 comp16 = int3(1, 256, 0), comp24 = int3(1, 256, 256*256);\n" " int alphabump=0;\n" " int3 tevcoord=int3(0, 0, 0);\n" - " int2 wrappedcoord=int2(0,0); float2 tempcoord=float2(0.0,0.0);\n\n"); + " int2 wrappedcoord=int2(0,0), tempcoord=int2(0,0);\n\n"); if (ApiType == API_OPENGL) { @@ -441,13 +441,13 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T if (texcoord < numTexgen) { out.SetConstantsUsed(C_INDTEXSCALE+i/2,C_INDTEXSCALE+i/2); - out.Write("\ttempcoord = round(float2(fixpoint_uv%d.xy) * " I_INDTEXSCALE"[%d].%s) / 128.0;\n", texcoord, i / 2, (i & 1) ? "zw" : "xy"); // TODO: Make indtexscale an integer + out.Write("\ttempcoord = fixpoint_uv%d >> " I_INDTEXSCALE"[%d].%s;\n", texcoord, i / 2, (i & 1) ? "zw" : "xy"); } else - out.Write("\ttempcoord = float2(0.0, 0.0);\n"); + out.Write("\ttempcoord = int2(0, 0);\n"); out.Write("\tint3 iindtex%d = ", i); - SampleTexture(out, "tempcoord", "abg", texmap, ApiType); + SampleTexture(out, "(float2(tempcoord)/128.0)", "abg", texmap, ApiType); } } diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 91d74edf4a..86111334ce 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -202,10 +202,10 @@ void PixelShaderManager::SetViewportChanged() void PixelShaderManager::SetIndTexScaleChanged(bool high) { - constants.indtexscale[high][0] = bpmem.texscale[high].getScaleS(0); - constants.indtexscale[high][1] = bpmem.texscale[high].getScaleT(0); - constants.indtexscale[high][2] = bpmem.texscale[high].getScaleS(1); - constants.indtexscale[high][3] = bpmem.texscale[high].getScaleT(1); + constants.indtexscale[high][0] = bpmem.texscale[high].ss0; + constants.indtexscale[high][1] = bpmem.texscale[high].ts0; + constants.indtexscale[high][2] = bpmem.texscale[high].ss1; + constants.indtexscale[high][3] = bpmem.texscale[high].ts1; dirty = true; }