From 9cb263ad48b1b5f52f69e84b534807427110b145 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 29 Apr 2013 21:19:48 +0200 Subject: [PATCH] PixelShaderGen: Set some uid fields that I missed before. --- .../Core/VideoCommon/Src/PixelShaderGen.cpp | 19 ++++++++++------- Source/Core/VideoCommon/Src/PixelShaderGen.h | 21 ++++++++++++++++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 179560ddfa..2be42bcf43 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -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(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) { diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 783f50a301..2340b96af7 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -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 {