From e99364c7c928bc4bf1002d1ef2f9e06b603be1ae Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sat, 16 Jan 2016 13:01:04 +1300 Subject: [PATCH] UID Change: Fix bug with indirect stage UIDs Bug Fix: The normal stage UIDs were randomly overwriting indirect stage texture map UID fields. It was possible for multiple shaders with diffrent indirect texture targets to map to the same UID. Once again, it dpesn't look like this bug was ever triggered. --- Source/Core/VideoCommon/PixelShaderGen.cpp | 4 ---- Source/Core/VideoCommon/PixelShaderGen.h | 21 +-------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 80e84a59f0..296d947dbe 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -849,7 +849,6 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE ac.b == TEVALPHAARG_RASA || ac.c == TEVALPHAARG_RASA || ac.d == TEVALPHAARG_RASA) { const int i = bpmem.combiners[n].alphaC.rswap; - uid_data->stagehash[n].ac |= bpmem.combiners[n].alphaC.rswap; uid_data->stagehash[n].tevksel_swap1a = bpmem.tevksel[i * 2].swap1; uid_data->stagehash[n].tevksel_swap2a = bpmem.tevksel[i * 2].swap2; uid_data->stagehash[n].tevksel_swap1b = bpmem.tevksel[i * 2 + 1].swap1; @@ -875,7 +874,6 @@ 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->stagehash[n].ac |= bpmem.combiners[n].alphaC.tswap << 2; uid_data->stagehash[n].tevksel_swap1c = bpmem.tevksel[i * 2].swap1; uid_data->stagehash[n].tevksel_swap2c = bpmem.tevksel[i * 2].swap2; uid_data->stagehash[n].tevksel_swap1d = bpmem.tevksel[i * 2 + 1].swap1; @@ -884,8 +882,6 @@ static void WriteStage(T& out, pixel_shader_uid_data* uid_data, int n, API_TYPE uid_data->stagehash[n].tevorders_texmap = bpmem.tevorders[n / 2].getTexMap(n & 1); const char* texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap]; - uid_data->SetTevindrefTexmap(i, texmap); - out.Write("\ttextemp = "); SampleTexture(out, "float2(tevcoord.xy)", texswap, texmap, ApiType); } diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h index 9f019202fe..2ab23f38b4 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.h +++ b/Source/Core/VideoCommon/PixelShaderGen.h @@ -85,31 +85,12 @@ struct pixel_shader_uid_data tevindref_bi4 = texmap; } } - inline void SetTevindrefTexmap(int index, u32 texmap) - { - if (index == 0) - { - tevindref_bi0 = texmap; - } - else if (index == 1) - { - tevindref_bi1 = texmap; - } - else if (index == 2) - { - tevindref_bi2 = texmap; - } - else if (index == 3) - { - tevindref_bi4 = texmap; - } - } struct { // TODO: Can save a lot space by removing the padding bits u32 cc : 24; - u32 ac : 24; + u32 ac : 24; // tswap and rswap are left blank (encoded into the tevksel fields below) u32 tevorders_texmap : 3; u32 tevorders_texcoord : 3;