VideoCommon: fix indirect texture coordinate computation in TEV.

Even if an indirect texture stage doesn't actually sample a texture, we
still need to emit the relevant math.

Fixes Issue 7092.
This commit is contained in:
magumagu 2014-05-04 21:36:09 -07:00
parent 07fbb13bba
commit 52c42a2946

View File

@ -550,7 +550,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP
{
int texcoord = bpmem.tevorders[n/2].getTexCoord(n&1);
bool bHasTexCoord = (u32)texcoord < bpmem.genMode.numtexgens;
bool bHasIndStage = bpmem.tevind[n].IsActive() && bpmem.tevind[n].bt < bpmem.genMode.numindstages;
bool bHasIndStage = bpmem.tevind[n].bt < bpmem.genMode.numindstages;
// HACK to handle cases where the tex gen is not enabled
if (!bHasTexCoord)
texcoord = 0;
@ -579,6 +579,8 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP
// TODO: Should we reset alphabump to 0 here?
}
if (bpmem.tevind[n].mid != 0)
{
// format
const char *tevIndFmtMask[] = { "255", "31", "15", "7" };
out.Write("\tint3 iindtevcrd%d = iindtex%d & %s;\n", n, bpmem.tevind[n].bt, tevIndFmtMask[bpmem.tevind[n].fmt]);
@ -595,8 +597,6 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP
// multiply by offset matrix and scale - calculations are likely to overflow badly,
// yet it works out since we only care about the lower 23 bits (+1 sign bit) of the result
if (bpmem.tevind[n].mid != 0)
{
if (bpmem.tevind[n].mid <= 3)
{
int mtxidx = 2*(bpmem.tevind[n].mid-1);