PixelShaderGen: Set some uid fields that I missed before.

This commit is contained in:
NeoBrainX 2013-04-29 21:19:48 +02:00
parent 02afec5076
commit 9cb263ad48
2 changed files with 31 additions and 9 deletions

View File

@ -790,10 +790,10 @@ static void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE
|| ac.c == TEVALPHAARG_RASA || ac.d == TEVALPHAARG_RASA)
{
const int i = bpmem.combiners[n].alphaC.rswap;
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2 ].swap1 << (i*2);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2+1].swap1 << (i*2 + 1);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2 ].swap2 << (i*2 + 16);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2+1].swap2 << (i*2 + 17);
uid_data.tevksel[i*2 ].swap1 = bpmem.tevksel[i*2 ].swap1;
uid_data.tevksel[i*2+1].swap1 = bpmem.tevksel[i*2+1].swap1;
uid_data.tevksel[i*2 ].swap2 = bpmem.tevksel[i*2 ].swap2;
uid_data.tevksel[i*2+1].swap2 = bpmem.tevksel[i*2+1].swap2;
char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap];
out.Write("rastemp = %s.%s;\n", tevRasTable[bpmem.tevorders[n / 2].getColorChan(n & 1)], rasswap);
@ -813,13 +813,14 @@ static void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE
}
const int i = bpmem.combiners[n].alphaC.tswap;
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2 ].swap1 << (i*2);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2+1].swap1 << (i*2 + 1);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2 ].swap2 << (i*2 + 16);
uid_data.tevksel_n_swap |= bpmem.tevksel[i*2+1].swap2 << (i*2 + 17);
uid_data.tevksel[i*2 ].swap1 = bpmem.tevksel[i*2 ].swap1;
uid_data.tevksel[i*2+1].swap1 = bpmem.tevksel[i*2+1].swap1;
uid_data.tevksel[i*2 ].swap2 = bpmem.tevksel[i*2 ].swap2;
uid_data.tevksel[i*2+1].swap2 = bpmem.tevksel[i*2+1].swap2;
char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap];
int texmap = bpmem.tevorders[n/2].getTexMap(n&1);
uid_data.tevindref.SetTexmap(i, texmap);
SampleTexture<T>(out, "textemp", "tevcoord", texswap, texmap, ApiType);
}
else
@ -833,6 +834,8 @@ static void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, API_TYPE
{
int kc = bpmem.tevksel[n / 2].getKC(n & 1);
int ka = bpmem.tevksel[n / 2].getKA(n & 1);
uid_data.tevksel[n/2].set_kcsel(n & 1, kc);
uid_data.tevksel[n/2].set_kasel(n & 1, ka);
out.Write("konsttemp = float4(%s, %s);\n", tevKSelTableC[kc], tevKSelTableA[ka]);
if(kc > 7 || ka > 7)
{

View File

@ -93,6 +93,13 @@ struct pixel_shader_uid_data
else if (index == 2) { bc3 = texcoord; bi2 = texmap; }
else if (index == 3) { bc4 = texcoord; bi4 = texmap; }
}
inline void SetTexmap(int index, u32 texmap)
{
if (index == 0) { bi0 = texmap; }
else if (index == 1) { bi1 = texmap; }
else if (index == 2) { bi2 = texmap; }
else if (index == 3) { bi4 = texmap; }
}
} tevindref;
u32 tevorders_n_texcoord1 : 24; // 8 x 3 bit
@ -135,7 +142,19 @@ struct pixel_shader_uid_data
}
} tevind_n;
u32 tevksel_n_swap : 32; // 8 x 2 bit (swap1) + 8 x 2 bit (swap2)
struct
{
u32 swap1 : 2;
u32 swap2 : 2;
u32 kcsel0 : 5;
u32 kasel0 : 5;
u32 kcsel1 : 5;
u32 kasel1 : 5;
void set_kcsel(int i, u32 value) { if (i) kcsel1 = value; else kcsel0 = value; }
void set_kasel(int i, u32 value) { if( i) kasel1 = value; else kasel0 = value; }
} tevksel[8];
struct
{
union {