Setting Indirect Texture Matrix
Posted: Sat May 24, 2008 10:28 pm
As mentioned here this is a quick and dirty function to experiment with the indirect texture matrix:
Is anyone working on the GXSetTevIndBump* functions? Are they just utility functions on top of the existing functions, or do they work on some undocumented registers?
And I'm a bit confused about the "s" part of the function above: Is it "officially" part of the matrix, or does it refer to Block 525 in Figure 15? And in my experiments GX_SetIndTexCoordScale didn't seem to make any difference to the coordinates. Does it scale the incoming tex coordinates, or the outgoing coordinates (Block 252)?
Code: Select all
void GX_SetIndirectMatrix(u8 indtexid, int ma, int mb, int mc, int md, int me, int mf, int s)
{
switch (indtexid) {
case GX_ITM_0: {
u32 val1 = (0x06000000|(_SHIFTL(s,22,2))|(_SHIFTL(mb,11,11))|(_SHIFTL(ma,0,11)));
u32 val2 = (0x07000000|(_SHIFTL(s>>2,22,2))|(_SHIFTL(md,11,11))|(_SHIFTL(mc,0,11)));
u32 val3 = (0x08000000|(_SHIFTL(s>>4,22,2))|(_SHIFTL(mf,11,11))|(_SHIFTL(me,0,11)));
GX_LOAD_BP_REG(val1);
GX_LOAD_BP_REG(val2);
GX_LOAD_BP_REG(val3);
break;
}
case GX_ITM_1: {
u32 val1 = (0x09000000|(_SHIFTL(s,22,2))|(_SHIFTL(mb,11,11))|(_SHIFTL(ma,0,11)));
u32 val2 = (0x0a000000|(_SHIFTL(s>>2,22,2))|(_SHIFTL(md,11,11))|(_SHIFTL(mc,0,11)));
u32 val3 = (0x0b000000|(_SHIFTL(s>>4,22,2))|(_SHIFTL(mf,11,11))|(_SHIFTL(me,0,11)));
GX_LOAD_BP_REG(val1);
GX_LOAD_BP_REG(val2);
GX_LOAD_BP_REG(val3);
break;
}
case GX_ITM_2: {
u32 val1 = (0x0c000000|(_SHIFTL(s,22,2))|(_SHIFTL(mb,11,11))|(_SHIFTL(ma,0,11)));
u32 val2 = (0x0d000000|(_SHIFTL(s>>2,22,2))|(_SHIFTL(md,11,11))|(_SHIFTL(mc,0,11)));
u32 val3 = (0x0e000000|(_SHIFTL(s>>4,22,2))|(_SHIFTL(mf,11,11))|(_SHIFTL(me,0,11)));
GX_LOAD_BP_REG(val1);
GX_LOAD_BP_REG(val2);
GX_LOAD_BP_REG(val3);
break;
}
}
}
And I'm a bit confused about the "s" part of the function above: Is it "officially" part of the matrix, or does it refer to Block 525 in Figure 15? And in my experiments GX_SetIndTexCoordScale didn't seem to make any difference to the coordinates. Does it scale the incoming tex coordinates, or the outgoing coordinates (Block 252)?