Merge pull request #3570 from endrift/indtev-reduce-shifting

VideoBackend: Remove extraneous shifts from indirect texture lookups
This commit is contained in:
Ryan Houdek 2016-03-10 13:12:47 -05:00
commit 4c4eaaa1d6
1 changed files with 9 additions and 9 deletions

View File

@ -717,11 +717,11 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
int mtxidx = 2*(bpmem.tevind[n].mid-1);
out.SetConstantsUsed(C_INDTEXMTX+mtxidx, C_INDTEXMTX+mtxidx);
out.Write("\tint2 indtevtrans%d = int2(idot(" I_INDTEXMTX"[%d].xyz, iindtevcrd%d), idot(" I_INDTEXMTX"[%d].xyz, iindtevcrd%d)) >> 3;\n", n, mtxidx, n, mtxidx+1, n);
out.Write("\tint2 indtevtrans%d = int2(idot(" I_INDTEXMTX"[%d].xyz, iindtevcrd%d), idot(" I_INDTEXMTX"[%d].xyz, iindtevcrd%d));\n", n, mtxidx, n, mtxidx+1, n);
// TODO: should use a shader uid branch for this for better performance
out.Write("\tif (" I_INDTEXMTX"[%d].w >= 0) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w);\n", n, n, mtxidx);
out.Write("\tif (" I_INDTEXMTX"[%d].w >= -3) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w + 3;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w - 3);\n", n, n, mtxidx);
}
else if (bpmem.tevind[n].mid <= 7 && bHasTexCoord)
{ // s matrix
@ -729,10 +729,10 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
int mtxidx = 2*(bpmem.tevind[n].mid-5);
out.SetConstantsUsed(C_INDTEXMTX+mtxidx, C_INDTEXMTX+mtxidx);
out.Write("\tint2 indtevtrans%d = int2(fixpoint_uv%d * iindtevcrd%d.xx) >> 8;\n", n, texcoord, n);
out.Write("\tint2 indtevtrans%d = int2(fixpoint_uv%d * iindtevcrd%d.xx);\n", n, texcoord, n);
out.Write("\tif (" I_INDTEXMTX"[%d].w >= 0) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w);\n", n, n, mtxidx);
out.Write("\tif (" I_INDTEXMTX"[%d].w >= -8) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w + 8;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w - 8);\n", n, n, mtxidx);
}
else if (bpmem.tevind[n].mid <= 11 && bHasTexCoord)
{ // t matrix
@ -740,10 +740,10 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE
int mtxidx = 2*(bpmem.tevind[n].mid-9);
out.SetConstantsUsed(C_INDTEXMTX+mtxidx, C_INDTEXMTX+mtxidx);
out.Write("\tint2 indtevtrans%d = int2(fixpoint_uv%d * iindtevcrd%d.yy) >> 8;\n", n, texcoord, n);
out.Write("\tint2 indtevtrans%d = int2(fixpoint_uv%d * iindtevcrd%d.yy);\n", n, texcoord, n);
out.Write("\tif (" I_INDTEXMTX"[%d].w >= 0) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w);\n", n, n, mtxidx);
out.Write("\tif (" I_INDTEXMTX"[%d].w >= -8) indtevtrans%d = indtevtrans%d >> " I_INDTEXMTX"[%d].w + 8;\n", mtxidx, n, n, mtxidx);
out.Write("\telse indtevtrans%d = indtevtrans%d << (-" I_INDTEXMTX"[%d].w - 8);\n", n, n, mtxidx);
}
else
{