From d0301ca89d318d8d6e3e7fde9c4b60e470e184e4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 7 Jan 2013 13:47:34 -0600 Subject: Revert 30dd9c2 e9d00bf db5f4c8 and bff0fae --- Source/Core/VideoCommon/Src/BPFunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp index b9a76ba7b6..cddeae3000 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.cpp +++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp @@ -236,7 +236,7 @@ bool GetConfig(const int &type) case CONFIG_DISABLEFOG: return g_ActiveConfig.bDisableFog; case CONFIG_SHOWEFBREGIONS: - return g_ActiveConfig.bShowEFBCopyRegions; + return false; default: PanicAlert("GetConfig Error: Unknown Config Type!"); return false; -- cgit v1.2.3 From 446d9279b10a3eb688d2b16036a9f3f832a1c6e4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 8 Jan 2013 11:14:53 -0600 Subject: Fix clearing of render targets. We were skipping every other one. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 9fc18ef1bd..e3152455df 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -208,7 +208,7 @@ void TextureCache::ClearRenderTargets() if (iter->second->type == TCET_EC_VRAM) { delete iter->second; - textures.erase(iter++); + textures.erase(iter); } } -- cgit v1.2.3 From 09197e0ffcd78a54cae9a80889bef6e6e9440511 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 31 Dec 2012 16:21:23 +0100 Subject: X11: Disable OSD hotkeys when the corresponding option is disabled. --- Source/Core/VideoCommon/Src/RenderBase.cpp | 184 +++++++++++++++-------------- Source/Core/VideoCommon/Src/RenderBase.h | 2 +- 2 files changed, 95 insertions(+), 91 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 577570c568..8e1d012fa2 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -91,6 +91,9 @@ Renderer::Renderer() : frame_data(NULL), bLastFrameDumped(false) #if defined _WIN32 || defined HAVE_LIBAV bAVIDumping = false; #endif + + OSDChoice = 0; + OSDTime = 0; } Renderer::~Renderer() @@ -263,108 +266,109 @@ void Renderer::SetScreenshot(const char *filename) // Create On-Screen-Messages void Renderer::DrawDebugText() { + if (!g_Config.bOSDHotKey) + return; + // OSD Menu messages - if (g_ActiveConfig.bOSDHotKey) + if (OSDChoice > 0) { - if (OSDChoice > 0) - { - OSDTime = Common::Timer::GetTimeMs() + 3000; - OSDChoice = -OSDChoice; - } - if ((u32)OSDTime > Common::Timer::GetTimeMs()) - { - const char* res_text = ""; - switch (g_ActiveConfig.iEFBScale) - { - case 0: - res_text = "Auto (fractional)"; - break; - case 1: - res_text = "Auto (integral)"; - break; - case 2: - res_text = "Native"; - break; - case 3: - res_text = "1.5x"; - break; - case 4: - res_text = "2x"; - break; - case 5: - res_text = "2.5x"; - break; - case 6: - res_text = "3x"; - break; - case 7: - res_text = "4x"; - break; - } + OSDTime = Common::Timer::GetTimeMs() + 3000; + OSDChoice = -OSDChoice; + } - const char* ar_text = ""; - switch(g_ActiveConfig.iAspectRatio) - { - case ASPECT_AUTO: - ar_text = "Auto"; - break; - case ASPECT_FORCE_16_9: - ar_text = "16:9"; - break; - case ASPECT_FORCE_4_3: - ar_text = "4:3"; - break; - case ASPECT_STRETCH: - ar_text = "Stretch"; - break; - } + if ((u32)OSDTime <= Common::Timer::GetTimeMs()) + return; - const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ? - (g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled"; + const char* res_text = ""; + switch (g_ActiveConfig.iEFBScale) + { + case 0: + res_text = "Auto (fractional)"; + break; + case 1: + res_text = "Auto (integral)"; + break; + case 2: + res_text = "Native"; + break; + case 3: + res_text = "1.5x"; + break; + case 4: + res_text = "2x"; + break; + case 5: + res_text = "2.5x"; + break; + case 6: + res_text = "3x"; + break; + case 7: + res_text = "4x"; + break; + } - // The rows - const std::string lines[] = - { - std::string("3: Internal Resolution: ") + res_text, - std::string("4: Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""), - std::string("5: Copy EFB: ") + efbcopy_text, - std::string("6: Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"), - }; + const char* ar_text = ""; + switch(g_ActiveConfig.iAspectRatio) + { + case ASPECT_AUTO: + ar_text = "Auto"; + break; + case ASPECT_FORCE_16_9: + ar_text = "16:9"; + break; + case ASPECT_FORCE_4_3: + ar_text = "4:3"; + break; + case ASPECT_STRETCH: + ar_text = "Stretch"; + break; + } - enum { lines_count = sizeof(lines)/sizeof(*lines) }; + const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ? + (g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled"; - std::string final_yellow, final_cyan; + // The rows + const std::string lines[] = + { + std::string("3: Internal Resolution: ") + res_text, + std::string("4: Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""), + std::string("5: Copy EFB: ") + efbcopy_text, + std::string("6: Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"), + }; - // If there is more text than this we will have a collision - if (g_ActiveConfig.bShowFPS) - { - final_yellow = final_cyan = "\n\n"; - } + enum { lines_count = sizeof(lines)/sizeof(*lines) }; - // The latest changed setting in yellow - for (int i = 0; i != lines_count; ++i) - { - if (OSDChoice == -i - 1) - final_yellow += lines[i]; - final_yellow += '\n'; - } + std::string final_yellow, final_cyan; - // The other settings in cyan - for (int i = 0; i != lines_count; ++i) - { - if (OSDChoice != -i - 1) - final_cyan += lines[i]; - final_cyan += '\n'; - } + // If there is more text than this we will have a collision + if (g_ActiveConfig.bShowFPS) + { + final_yellow = final_cyan = "\n\n"; + } - // Render a shadow - g_renderer->RenderText(final_cyan.c_str(), 21, 21, 0xDD000000); - g_renderer->RenderText(final_yellow.c_str(), 21, 21, 0xDD000000); - //and then the text - g_renderer->RenderText(final_cyan.c_str(), 20, 20, 0xFF00FFFF); - g_renderer->RenderText(final_yellow.c_str(), 20, 20, 0xFFFFFF00); - } + // The latest changed setting in yellow + for (int i = 0; i != lines_count; ++i) + { + if (OSDChoice == -i - 1) + final_yellow += lines[i]; + final_yellow += '\n'; } + + // The other settings in cyan + for (int i = 0; i != lines_count; ++i) + { + if (OSDChoice != -i - 1) + final_cyan += lines[i]; + final_cyan += '\n'; + } + + // Render a shadow + g_renderer->RenderText(final_cyan.c_str(), 21, 21, 0xDD000000); + g_renderer->RenderText(final_yellow.c_str(), 21, 21, 0xDD000000); + //and then the text + g_renderer->RenderText(final_cyan.c_str(), 20, 20, 0xFF00FFFF); + g_renderer->RenderText(final_yellow.c_str(), 20, 20, 0xFFFFFF00); } // TODO: remove diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 4da80c9752..5376577cbd 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -39,7 +39,7 @@ // TODO: Move these out of here. extern int frameCount; -extern int OSDChoice, OSDTime; +extern int OSDChoice; extern bool bLastFrameDumped; -- cgit v1.2.3 From 876eee5e601915dd361a16899754d35b43cae80c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 16:01:15 +0100 Subject: PixelShaderGen: Don't disable depth texture emulation if z writing is disabled (this is what VideoSoftware is doing). --- Source/Core/VideoCommon/Src/BPMemory.h | 2 +- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index 9284674aa1..cd2aa1e4c5 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -793,7 +793,7 @@ union PE_CONTROL { u32 pixel_format : 3; // PIXELFMT_X u32 zformat : 3; // Z Compression for 16bit Z format - u32 zcomploc : 1; // 1: before tex stage + u32 early_ztest : 1; // 1: before tex stage u32 unused : 17; u32 rid : 8; }; diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index cc48276253..36aa4e930d 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -109,7 +109,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo uid->values[0] |= bpmem.genMode.numtexgens << 4; // 4 uid->values[0] |= dstAlphaMode << 8; // 2 - bool DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.zcomploc && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth; + bool DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth; uid->values[0] |= DepthTextureEnable << 10; // 1 @@ -170,7 +170,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo if (DepthTextureEnable) { ptr[0] |= bpmem.ztex2.op << 11; // 2 - ptr[0] |= bpmem.zcontrol.zcomploc << 13; // 1 + ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 ptr[0] |= bpmem.zmode.testenable << 14; // 1 ptr[0] |= bpmem.zmode.updateenable << 15; // 1 } @@ -528,7 +528,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType nIndirectStagesUsed |= 1 << bpmem.tevind[i].bt; } } - DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.zcomploc && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth ; + DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth ; // Declare samplers if(ApiType != API_D3D11) @@ -769,12 +769,11 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType if (DepthTextureEnable) { // use the texture input of the last texture stage (textemp), hopefully this has been read and is in correct format... - if (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.zcomploc && bpmem.zmode.testenable && bpmem.zmode.updateenable) + // Note: depth textures are disabled if early depth test is enabled + if (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable) { - if (bpmem.ztex2.op == ZTEXTURE_ADD) - WRITE(p, "zCoord = dot(" I_ZBIAS"[0].xyzw, textemp.xyzw) + " I_ZBIAS"[1].w + zCoord;\n"); - else - WRITE(p, "zCoord = dot(" I_ZBIAS"[0].xyzw, textemp.xyzw) + " I_ZBIAS"[1].w;\n"); + WRITE(p, "zCoord = dot(" I_ZBIAS"[0].xyzw, textemp.xyzw) + " I_ZBIAS"[1].w %s;\n", + (bpmem.ztex2.op == ZTEXTURE_ADD) ? "+ zCoord" : ""); // scale to make result from frac correct WRITE(p, "zCoord = zCoord * (16777215.0f/16777216.0f);\n"); @@ -1264,7 +1263,7 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode // depth channel. // 2 - in the next pass disable depth chanel update, but proccess the color data normally // this way is the only CORRECT way to emulate perfectly the zcomplock behaviour - if (!(bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable)) + if (!(bpmem.zcontrol.early_ztest && bpmem.zmode.updateenable)) { WRITE(p, "discard;\n"); if (ApiType != API_D3D11) -- cgit v1.2.3 From b06f30f8452af075f5929e37f168e54bfd37083a Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 16:40:15 +0100 Subject: Remove the per pixel depth option. Depth calculations are always done in the pixel shader now. Due to the unpredictability of our zcomploc hacks this commit probably changes the behavior of some games which use zcomploc. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 173 ++++++++++-------------- Source/Core/VideoCommon/Src/PixelShaderGen.h | 2 +- Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 1 + Source/Core/VideoCommon/Src/VideoConfig.cpp | 4 - Source/Core/VideoCommon/Src/VideoConfig.h | 1 - 5 files changed, 71 insertions(+), 110 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 36aa4e930d..dbc65669ff 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -27,7 +27,12 @@ #include "VideoConfig.h" #include "NativeVertexFormat.h" -static int AlphaPreTest(); + +#define ALPHATEST_PASS 2 +#define ALPHATEST_FAIL 1 +#define ALPHATEST_UNDETERMINED 0 + +static unsigned int AlphaPreTest(); static void StageHash(int stage, u32* out) { @@ -109,29 +114,17 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo uid->values[0] |= bpmem.genMode.numtexgens << 4; // 4 uid->values[0] |= dstAlphaMode << 8; // 2 - bool DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth; - - uid->values[0] |= DepthTextureEnable << 10; // 1 - bool enablePL = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting; - uid->values[0] |= enablePL << 11; // 1 + uid->values[0] |= enablePL << 10; // 1 - if (!enablePL) uid->values[0] |= xfregs.numTexGen.numTexGens << 12; // 4 - u32 alphaPreTest = AlphaPreTest()+1; + if (!enablePL) uid->values[0] |= xfregs.numTexGen.numTexGens << 11; // 4 - uid->values[0] |= alphaPreTest << 16; // 2 - - if (alphaPreTest == 1 || (alphaPreTest && !DepthTextureEnable && dstAlphaMode == DSTALPHA_ALPHA_PASS)) - { - // Courtesy of PreAlphaTest, we're done already ;) - // NOTE: The comment header of generated shaders depends on the value of bpmem.genmode.numindstages.. shouldnt really bother about that though. - uid->num_values = 1; - return; - } + u32 alphaPreTest = AlphaPreTest(); + uid->values[0] |= alphaPreTest << 15; // 2 // numtexgens should be <= 8 for (unsigned int i = 0; i < bpmem.genMode.numtexgens; ++i) - uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1 + uid->values[0] |= xfregs.texMtxInfo[i].projection << (17+i); // 1 uid->values[1] = bpmem.genMode.numindstages; // 3 u32 indirectStagesUsed = 0; @@ -164,18 +157,17 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo ptr[0] |= bpmem.alphaFunc.comp1 << 3; // 3 ptr[0] |= bpmem.alphaFunc.logic << 6; // 2 - if (alphaPreTest == 0 || alphaPreTest == 2) + if (alphaPreTest != ALPHATEST_FAIL) { ptr[0] |= bpmem.fog.c_proj_fsel.fsel << 8; // 3 - if (DepthTextureEnable) - { - ptr[0] |= bpmem.ztex2.op << 11; // 2 - ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 - ptr[0] |= bpmem.zmode.testenable << 14; // 1 - ptr[0] |= bpmem.zmode.updateenable << 15; // 1 - } + ptr[0] |= bpmem.ztex2.op << 11; // 2 +// ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 + ptr[0] |= bpmem.zmode.testenable << 14; // 1 } + ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 + ptr[0] |= bpmem.zmode.updateenable << 15; // 1 + if (dstAlphaMode != DSTALPHA_ALPHA_PASS) { if (bpmem.fog.c_proj_fsel.fsel != 0) @@ -204,9 +196,8 @@ void GetSafePixelShaderId(PIXELSHADERUIDSAFE *uid, DSTALPHA_MODE dstAlphaMode, u *ptr++ = bpmem.ztex2.hex; // 2 *ptr++ = bpmem.zcontrol.hex; // 3 *ptr++ = bpmem.zmode.hex; // 4 - *ptr++ = g_ActiveConfig.bEnablePerPixelDepth; // 5 - *ptr++ = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting; // 6 - *ptr++ = xfregs.numTexGen.hex; // 7 + *ptr++ = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting; // 5 + *ptr++ = xfregs.numTexGen.hex; // 6 if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { @@ -218,28 +209,28 @@ void GetSafePixelShaderId(PIXELSHADERUIDSAFE *uid, DSTALPHA_MODE dstAlphaMode, u } for (unsigned int i = 0; i < 8; ++i) - *ptr++ = xfregs.texMtxInfo[i].hex; // 8-15 + *ptr++ = xfregs.texMtxInfo[i].hex; // 7-14 for (unsigned int i = 0; i < 16; ++i) - *ptr++ = bpmem.tevind[i].hex; // 16-31 + *ptr++ = bpmem.tevind[i].hex; // 15-30 - *ptr++ = bpmem.tevindref.hex; // 32 + *ptr++ = bpmem.tevindref.hex; // 31 for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i) // up to 16 times { - *ptr++ = bpmem.combiners[i].colorC.hex; // 33+5*i - *ptr++ = bpmem.combiners[i].alphaC.hex; // 34+5*i - *ptr++ = bpmem.tevind[i].hex; // 35+5*i - *ptr++ = bpmem.tevksel[i/2].hex; // 36+5*i - *ptr++ = bpmem.tevorders[i/2].hex; // 37+5*i + *ptr++ = bpmem.combiners[i].colorC.hex; // 32+5*i + *ptr++ = bpmem.combiners[i].alphaC.hex; // 33+5*i + *ptr++ = bpmem.tevind[i].hex; // 34+5*i + *ptr++ = bpmem.tevksel[i/2].hex; // 35+5*i + *ptr++ = bpmem.tevorders[i/2].hex; // 36+5*i } - ptr = &uid->values[113]; + ptr = &uid->values[112]; - *ptr++ = bpmem.alphaFunc.hex; // 113 + *ptr++ = bpmem.alphaFunc.hex; // 112 - *ptr++ = bpmem.fog.c_proj_fsel.hex; // 114 - *ptr++ = bpmem.fogRange.Base.hex; // 115 + *ptr++ = bpmem.fog.c_proj_fsel.hex; // 113 + *ptr++ = bpmem.fogRange.Base.hex; // 114 _assert_((ptr - uid->values) == uid->GetNumValues()); } @@ -481,7 +472,6 @@ static const char *tevIndFmtScale[] = {"255.0f", "31.0f", "15.0f", "7.0f" }; static char swapModeTable[4][5]; static char text[16384]; -static bool DepthTextureEnable; struct RegisterState { @@ -528,7 +518,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType nIndirectStagesUsed |= 1 << bpmem.tevind[i].bt; } } - DepthTextureEnable = (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable && bpmem.zmode.updateenable) || g_ActiveConfig.bEnablePerPixelDepth ; // Declare samplers if(ApiType != API_D3D11) @@ -584,14 +573,14 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType { WRITE(p, " out float4 ocol0 : COLOR0,%s%s\n in float4 rawpos : %s,\n", dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND ? "\n out float4 ocol1 : COLOR1," : "", - DepthTextureEnable ? "\n out float depth : DEPTH," : "", + "\n out float depth : DEPTH,", ApiType & API_OPENGL ? "WPOS" : ApiType & API_D3D9_SM20 ? "POSITION" : "VPOS"); } else { WRITE(p, " out float4 ocol0 : SV_Target0,%s%s\n in float4 rawpos : SV_Position,\n", dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND ? "\n out float4 ocol1 : SV_Target1," : "", - DepthTextureEnable ? "\n out float depth : SV_Depth," : ""); + "\n out float depth : SV_Depth,"); } WRITE(p, " in float4 colors_0 : COLOR0,\n"); @@ -622,32 +611,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType } WRITE(p, " ) {\n"); - int Pretest = AlphaPreTest(); - if(Pretest >= 0 && !DepthTextureEnable) - { - if (!Pretest) - { - // alpha test will always fail, so restart the shader and just make it an empty function - WRITE(p, "ocol0 = 0;\n"); - if(DepthTextureEnable) - WRITE(p, "depth = 1.f;\n"); - if(dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) - WRITE(p, "ocol1 = 0;\n"); - WRITE(p, "discard;\n"); - if(ApiType != API_D3D11) - WRITE(p, "return;\n"); - } - else if (dstAlphaMode == DSTALPHA_ALPHA_PASS) - { - WRITE(p, " ocol0 = " I_ALPHA"[0].aaaa;\n"); - } - if(!Pretest || dstAlphaMode == DSTALPHA_ALPHA_PASS) - { - WRITE(p, "}\n"); - return text; - } - } - WRITE(p, " float4 c0 = " I_COLORS"[1], c1 = " I_COLORS"[2], c2 = " I_COLORS"[3], prev = float4(0.0f, 0.0f, 0.0f, 0.0f), textemp = float4(0.0f, 0.0f, 0.0f, 0.0f), rastemp = float4(0.0f, 0.0f, 0.0f, 0.0f), konsttemp = float4(0.0f, 0.0f, 0.0f, 0.0f);\n" " float3 comp16 = float3(1.0f, 255.0f, 0.0f), comp24 = float3(1.0f, 255.0f, 255.0f*255.0f);\n" " float4 alphabump=float4(0.0f,0.0f,0.0f,0.0f);\n" @@ -755,33 +718,27 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) WRITE(p, "prev = frac(prev * (255.0f/256.0f)) * (256.0f/255.0f);\n"); - if(Pretest == -1) - { + // TODO: ALPHATEST_FAIL should be handled by disabling color writes in the render state + int Pretest = AlphaPreTest(); + if (Pretest == ALPHATEST_UNDETERMINED) WriteAlphaTest(p, ApiType, dstAlphaMode); - } - if((bpmem.fog.c_proj_fsel.fsel != 0) || DepthTextureEnable) - { - // the screen space depth value = far z + (clip z / clip w) * z range - WRITE(p, "float zCoord = " I_ZBIAS"[1].x + (clipPos.z / clipPos.w) * " I_ZBIAS"[1].y;\n"); - } + // the screen space depth value = far z + (clip z / clip w) * z range + WRITE(p, "float zCoord = " I_ZBIAS"[1].x + (clipPos.z / clipPos.w) * " I_ZBIAS"[1].y;\n"); - if (DepthTextureEnable) + // Note: depth textures are disabled if early depth test is enabled + if (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable) { // use the texture input of the last texture stage (textemp), hopefully this has been read and is in correct format... - // Note: depth textures are disabled if early depth test is enabled - if (bpmem.ztex2.op != ZTEXTURE_DISABLE && !bpmem.zcontrol.early_ztest && bpmem.zmode.testenable) - { - WRITE(p, "zCoord = dot(" I_ZBIAS"[0].xyzw, textemp.xyzw) + " I_ZBIAS"[1].w %s;\n", - (bpmem.ztex2.op == ZTEXTURE_ADD) ? "+ zCoord" : ""); + WRITE(p, "zCoord = dot(" I_ZBIAS"[0].xyzw, textemp.xyzw) + " I_ZBIAS"[1].w %s;\n", + (bpmem.ztex2.op == ZTEXTURE_ADD) ? "+ zCoord" : ""); - // scale to make result from frac correct - WRITE(p, "zCoord = zCoord * (16777215.0f/16777216.0f);\n"); - WRITE(p, "zCoord = frac(zCoord);\n"); - WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n"); - } - WRITE(p, "depth = zCoord;\n"); + // scale to make result from frac correct + WRITE(p, "zCoord = zCoord * (16777215.0f/16777216.0f);\n"); + WRITE(p, "zCoord = frac(zCoord);\n"); + WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n"); } + WRITE(p, "depth = zCoord;\n"); if (dstAlphaMode == DSTALPHA_ALPHA_PASS) WRITE(p, " ocol0 = float4(prev.rgb, " I_ALPHA"[0].a);\n"); @@ -1191,37 +1148,46 @@ static const char *tevAlphaFunclogicTable[] = " != ", // xor " == " // xnor }; -static int AlphaPreTest() + +static unsigned int AlphaPreTest() { u32 op = bpmem.alphaFunc.logic; - u32 comp[2] = {bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1}; + u32 comp[2] = { bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1 }; // First kill all the simple cases switch(op) { case 0: // AND - if (comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) return true; - if (comp[0] == ALPHACMP_NEVER || comp[1] == ALPHACMP_NEVER) return false; + if (comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) + return ALPHATEST_PASS; + if (comp[0] == ALPHACMP_NEVER || comp[1] == ALPHACMP_NEVER) + return ALPHATEST_FAIL; break; + case 1: // OR - if (comp[0] == ALPHACMP_ALWAYS || comp[1] == ALPHACMP_ALWAYS) return true; - if (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)return false; + if (comp[0] == ALPHACMP_ALWAYS || comp[1] == ALPHACMP_ALWAYS) + return ALPHATEST_PASS; + if (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER) + return ALPHATEST_FAIL; break; + case 2: // XOR if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_NEVER) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_ALWAYS)) - return true; + return ALPHATEST_PASS; if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)) - return false; + return ALPHATEST_FAIL; break; + case 3: // XNOR if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_NEVER) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_ALWAYS)) - return false; + return ALPHATEST_FAIL; if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)) - return true; + return ALPHATEST_PASS; break; + default: PanicAlert("bad logic for alpha test? %08x", op); } - return -1; + return ALPHATEST_UNDETERMINED; } @@ -1248,8 +1214,7 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode WRITE(p, "ocol0 = 0;\n"); if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) WRITE(p, "ocol1 = 0;\n"); - if (DepthTextureEnable) - WRITE(p, "depth = 1.f;\n"); + WRITE(p, "depth = 1.f;\n"); // HAXX: zcomploc is a way to control whether depth test is done before // or after texturing and alpha test. PC GPU does depth test before texturing ONLY if depth value is diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 31242a916e..12a499a472 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -45,7 +45,7 @@ #define C_PMATERIALS (C_PLIGHTS + 40) #define C_PENVCONST_END (C_PMATERIALS + 4) #define PIXELSHADERUID_MAX_VALUES 70 -#define PIXELSHADERUID_MAX_VALUES_SAFE 120 +#define PIXELSHADERUID_MAX_VALUES_SAFE 119 // DO NOT make anything in this class virtual. template diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 07ace04b97..cad117c2c8 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -465,6 +465,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) //write the true depth value, if the game uses depth textures pixel shaders will override with the correct values //if not early z culling will improve speed + // TODO: Can probably be dropped? if (is_d3d) { WRITE(p, "o.pos.z = " I_DEPTHPARAMS".x * o.pos.w + o.pos.z * " I_DEPTHPARAMS".y;\n"); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index c702b577e2..7418d60741 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -75,7 +75,6 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200); iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0); iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0); - iniFile.Get("Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth, 0); iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native @@ -134,7 +133,6 @@ void VideoConfig::GameIniLoad(const char *ini_file) iniFile.GetIfExists("Video_Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation); iniFile.GetIfExists("Video_Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle); iniFile.GetIfExists("Video_Settings", "EnablePixelLighting", &bEnablePixelLighting); - iniFile.GetIfExists("Video_Settings", "EnablePerPixelDepth", &bEnablePerPixelDepth); iniFile.GetIfExists("Video_Settings", "MSAA", &iMultisampleMode); iniFile.GetIfExists("Video_Settings", "EFBScale", &iEFBScale); // integral iniFile.GetIfExists("Video_Settings", "DstAlphaPass", &bDstAlphaPass); @@ -203,7 +201,6 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); iniFile.Set("Settings", "EnablePixelLighting", bEnablePixelLighting); - iniFile.Set("Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); @@ -269,7 +266,6 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) SET_IF_DIFFERS("Video_Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation); SET_IF_DIFFERS("Video_Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle); SET_IF_DIFFERS("Video_Settings", "EnablePixelLighting", bEnablePixelLighting); - SET_IF_DIFFERS("Video_Settings", "EnablePerPixelDepth", bEnablePerPixelDepth); SET_IF_DIFFERS("Video_Settings", "MSAA", iMultisampleMode); SET_IF_DIFFERS("Video_Settings", "EFBScale", iEFBScale); // integral SET_IF_DIFFERS("Video_Settings", "DstAlphaPass", bDstAlphaPass); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index fe883e0dbe..4364bea6ea 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -133,7 +133,6 @@ struct VideoConfig bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess bool bUseBBox; bool bEnablePixelLighting; - bool bEnablePerPixelDepth; int iLog; // CONF_ bits int iSaveTargetId; // TODO: Should be dropped -- cgit v1.2.3 From c80f6e8b84cd98120ad55a6830a68039ab6a2a48 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 16:51:01 +0100 Subject: Reword a comment about early_ztest a bit. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index dbc65669ff..e1507e8389 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -1216,18 +1216,16 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode WRITE(p, "ocol1 = 0;\n"); WRITE(p, "depth = 1.f;\n"); - // HAXX: zcomploc is a way to control whether depth test is done before - // or after texturing and alpha test. PC GPU does depth test before texturing ONLY if depth value is - // not updated during shader execution. + // HAXX: zcomploc (aka early_ztest) is a way to control whether depth test is done before + // or after texturing and alpha test. PC GPUs have no way to support this + // feature properly as of 2012: depth buffer and depth test are not + // programmable and the depth test is always done after texturing. + // Most importantly, PC GPUs do not allow writing to the z buffer without + // writing a color value (unless color writing is disabled altogether). // We implement "depth test before texturing" by discarding the fragment // when the alpha test fail. This is not a correct implementation because - // even if the depth test fails the fragment could be alpha blended. - // this implemnetation is a trick to keep speed. - // the correct, but slow, way to implement a correct zComploc is : - // 1 - if zcomplock is enebled make a first pass, with color channel write disabled updating only - // depth channel. - // 2 - in the next pass disable depth chanel update, but proccess the color data normally - // this way is the only CORRECT way to emulate perfectly the zcomplock behaviour + // even if the depth test fails the fragment could be alpha blended, but + // we don't have a choice. if (!(bpmem.zcontrol.early_ztest && bpmem.zmode.updateenable)) { WRITE(p, "discard;\n"); @@ -1236,7 +1234,6 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode } WRITE(p, "}\n"); - } static const char *tevFogFuncsTable[] = -- cgit v1.2.3 From d26bcb0847ad27235020ecaf749154d388f0e162 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 17:18:45 +0100 Subject: Move alpha pretest to BPMemory.h and rename a bunch of alpha testing related stuff --- Source/Core/VideoCommon/Src/BPMemory.cpp | 35 +++++++++++ Source/Core/VideoCommon/Src/BPMemory.h | 13 +++- Source/Core/VideoCommon/Src/BPStructs.cpp | 6 +- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 70 ++++------------------ Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 2 +- Source/Core/VideoCommon/Src/PixelShaderManager.h | 2 +- Source/Core/VideoCommon/Src/VertexManagerBase.cpp | 2 +- 7 files changed, 63 insertions(+), 67 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPMemory.cpp b/Source/Core/VideoCommon/Src/BPMemory.cpp index c452b238b6..ca0e748cb0 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.cpp +++ b/Source/Core/VideoCommon/Src/BPMemory.cpp @@ -151,3 +151,38 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size #undef SET_REG_NAME } } + +AlphaTest::TEST_RESULT AlphaTest::TestResult() +{ + switch(logic) + { + case 0: // AND + if (comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) + return PASS; + if (comp0 == ALPHACMP_NEVER || comp1 == ALPHACMP_NEVER) + return FAIL; + break; + + case 1: // OR + if (comp0 == ALPHACMP_ALWAYS || comp1 == ALPHACMP_ALWAYS) + return PASS; + if (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER) + return FAIL; + break; + + case 2: // XOR + if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_NEVER) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_ALWAYS)) + return PASS; + if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER)) + return FAIL; + break; + + case 3: // XNOR + if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_NEVER) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_ALWAYS)) + return FAIL; + if ((comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) || (comp0 == ALPHACMP_NEVER && comp1 == ALPHACMP_NEVER)) + return PASS; + break; + } + return UNDETERMINED; +} diff --git a/Source/Core/VideoCommon/Src/BPMemory.h b/Source/Core/VideoCommon/Src/BPMemory.h index cd2aa1e4c5..85e95f4f8b 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.h +++ b/Source/Core/VideoCommon/Src/BPMemory.h @@ -857,7 +857,7 @@ union TevKSel int getKA(int i) {return i?kasel1:kasel0;} }; -union AlphaFunc +union AlphaTest { struct { @@ -868,6 +868,15 @@ union AlphaFunc u32 logic : 2; }; u32 hex; + + enum TEST_RESULT + { + UNDETERMINED = 0, + FAIL = 1, + PASS = 2, + }; + + TEST_RESULT TestResult(); }; union UPE_Copy @@ -981,7 +990,7 @@ struct BPMemory TevReg tevregs[4]; //0xE0 FogRangeParams fogRange; FogParams fog; //0xEE,0xEF,0xF0,0xF1,0xF2 - AlphaFunc alphaFunc; //0xF3 + AlphaTest alpha_test; //0xF3 ZTex1 ztex1; //0xf4,0xf5 ZTex2 ztex2; TevKSel tevksel[8];//0xf6,0xf7,f8,f9,fa,fb,fc,fd diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 0bde9cc613..88556cbee8 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -357,9 +357,9 @@ void BPWritten(const BPCmd& bp) PixelShaderManager::SetFogColorChanged(); break; case BPMEM_ALPHACOMPARE: // Compare Alpha Values - PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alphaFunc.ref0, - bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic); - PixelShaderManager::SetAlpha(bpmem.alphaFunc); + PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alpha_test.ref0, + bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1, bpmem.alpha_test.logic); + PixelShaderManager::SetAlpha(bpmem.alpha_test); break; case BPMEM_BIAS: // BIAS PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias); diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index e1507e8389..b408b1bceb 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -28,12 +28,6 @@ #include "NativeVertexFormat.h" -#define ALPHATEST_PASS 2 -#define ALPHATEST_FAIL 1 -#define ALPHATEST_UNDETERMINED 0 - -static unsigned int AlphaPreTest(); - static void StageHash(int stage, u32* out) { out[0] |= bpmem.combiners[stage].colorC.hex & 0xFFFFFF; // 24 @@ -119,7 +113,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo if (!enablePL) uid->values[0] |= xfregs.numTexGen.numTexGens << 11; // 4 - u32 alphaPreTest = AlphaPreTest(); + AlphaTest::TEST_RESULT alphaPreTest = bpmem.alpha_test.TestResult(); uid->values[0] |= alphaPreTest << 15; // 2 // numtexgens should be <= 8 @@ -153,11 +147,11 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo ptr += 4; // max: ptr = &uid->values[66] } - ptr[0] |= bpmem.alphaFunc.comp0; // 3 - ptr[0] |= bpmem.alphaFunc.comp1 << 3; // 3 - ptr[0] |= bpmem.alphaFunc.logic << 6; // 2 + ptr[0] |= bpmem.alpha_test.comp0; // 3 + ptr[0] |= bpmem.alpha_test.comp1 << 3; // 3 + ptr[0] |= bpmem.alpha_test.logic << 6; // 2 - if (alphaPreTest != ALPHATEST_FAIL) + if (alphaPreTest != AlphaTest::FAIL) { ptr[0] |= bpmem.fog.c_proj_fsel.fsel << 8; // 3 ptr[0] |= bpmem.ztex2.op << 11; // 2 @@ -227,7 +221,7 @@ void GetSafePixelShaderId(PIXELSHADERUIDSAFE *uid, DSTALPHA_MODE dstAlphaMode, u ptr = &uid->values[112]; - *ptr++ = bpmem.alphaFunc.hex; // 112 + *ptr++ = bpmem.alpha_test.hex; // 112 *ptr++ = bpmem.fog.c_proj_fsel.hex; // 113 *ptr++ = bpmem.fogRange.Base.hex; // 114 @@ -719,8 +713,8 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType WRITE(p, "prev = frac(prev * (255.0f/256.0f)) * (256.0f/255.0f);\n"); // TODO: ALPHATEST_FAIL should be handled by disabling color writes in the render state - int Pretest = AlphaPreTest(); - if (Pretest == ALPHATEST_UNDETERMINED) + AlphaTest::TEST_RESULT Pretest = bpmem.alpha_test.TestResult(); + if (Pretest == AlphaTest::UNDETERMINED) WriteAlphaTest(p, ApiType, dstAlphaMode); // the screen space depth value = far z + (clip z / clip w) * z range @@ -1149,48 +1143,6 @@ static const char *tevAlphaFunclogicTable[] = " == " // xnor }; -static unsigned int AlphaPreTest() -{ - u32 op = bpmem.alphaFunc.logic; - u32 comp[2] = { bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1 }; - - // First kill all the simple cases - switch(op) - { - case 0: // AND - if (comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) - return ALPHATEST_PASS; - if (comp[0] == ALPHACMP_NEVER || comp[1] == ALPHACMP_NEVER) - return ALPHATEST_FAIL; - break; - - case 1: // OR - if (comp[0] == ALPHACMP_ALWAYS || comp[1] == ALPHACMP_ALWAYS) - return ALPHATEST_PASS; - if (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER) - return ALPHATEST_FAIL; - break; - - case 2: // XOR - if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_NEVER) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_ALWAYS)) - return ALPHATEST_PASS; - if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)) - return ALPHATEST_FAIL; - break; - - case 3: // XNOR - if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_NEVER) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_ALWAYS)) - return ALPHATEST_FAIL; - if ((comp[0] == ALPHACMP_ALWAYS && comp[1] == ALPHACMP_ALWAYS) || (comp[0] == ALPHACMP_NEVER && comp[1] == ALPHACMP_NEVER)) - return ALPHATEST_PASS; - break; - - default: PanicAlert("bad logic for alpha test? %08x", op); - } - return ALPHATEST_UNDETERMINED; -} - - static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode) { static const char *alphaRef[2] = @@ -1202,12 +1154,12 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode // using discard then return works the same in cg and dx9 but not in dx11 WRITE(p, "if(!( "); - int compindex = bpmem.alphaFunc.comp0 % 8; + int compindex = bpmem.alpha_test.comp0; WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[0]);//lookup the first component from the alpha function table - WRITE(p, "%s", tevAlphaFunclogicTable[bpmem.alphaFunc.logic % 4]);//lookup the logic op + WRITE(p, "%s", tevAlphaFunclogicTable[bpmem.alpha_test.logic]);//lookup the logic op - compindex = bpmem.alphaFunc.comp1 % 8; + compindex = bpmem.alpha_test.comp1; WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table WRITE(p, ")) {\n"); diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index 258ec04413..eaaf99fbc8 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -373,7 +373,7 @@ void PixelShaderManager::SetColorChanged(int type, int num, bool high) PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]); } -void PixelShaderManager::SetAlpha(const AlphaFunc& alpha) +void PixelShaderManager::SetAlpha(const AlphaTest& alpha) { if ((alpha.hex & 0xffff) != lastAlpha) { diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.h b/Source/Core/VideoCommon/Src/PixelShaderManager.h index a336287a6f..12d749c871 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.h +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.h @@ -38,7 +38,7 @@ public: // constant management, should be called after memory is committed static void SetColorChanged(int type, int index, bool high); - static void SetAlpha(const AlphaFunc& alpha); + static void SetAlpha(const AlphaTest& alpha); static void SetDestAlpha(const ConstantAlpha& alpha); static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt); static void SetZTextureBias(u32 bias); diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 5be72e4fcf..cd5a01c6b3 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -202,7 +202,7 @@ void VertexManager::Flush() } PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphafunc=0x%x", bpmem.genMode.numtevstages+1, bpmem.genMode.numindstages, - bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable, (bpmem.alphaFunc.hex>>16)&0xff); + bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable, (bpmem.alpha_test.hex>>16)&0xff); #endif u32 usedtextures = 0; -- cgit v1.2.3 From be706a397720d94729518595339211ebc15be588 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 17:23:01 +0100 Subject: Disable color writing when alpha test always fails. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index b408b1bceb..88cf77631f 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -712,7 +712,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) WRITE(p, "prev = frac(prev * (255.0f/256.0f)) * (256.0f/255.0f);\n"); - // TODO: ALPHATEST_FAIL should be handled by disabling color writes in the render state AlphaTest::TEST_RESULT Pretest = bpmem.alpha_test.TestResult(); if (Pretest == AlphaTest::UNDETERMINED) WriteAlphaTest(p, ApiType, dstAlphaMode); -- cgit v1.2.3 From 4925a28f94d8a9925a85824ec89513c6774bdc30 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 17:29:16 +0100 Subject: PixelShaderGen: Shader uid maintainance --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 88cf77631f..fdb5f21a51 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -151,23 +151,17 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo ptr[0] |= bpmem.alpha_test.comp1 << 3; // 3 ptr[0] |= bpmem.alpha_test.logic << 6; // 2 - if (alphaPreTest != AlphaTest::FAIL) - { - ptr[0] |= bpmem.fog.c_proj_fsel.fsel << 8; // 3 - ptr[0] |= bpmem.ztex2.op << 11; // 2 -// ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 - ptr[0] |= bpmem.zmode.testenable << 14; // 1 - } - - ptr[0] |= bpmem.zcontrol.early_ztest << 13; // 1 - ptr[0] |= bpmem.zmode.updateenable << 15; // 1 + ptr[0] |= bpmem.ztex2.op << 8; // 2 + ptr[0] |= bpmem.zcontrol.early_ztest << 10; // 1 + ptr[0] |= bpmem.zmode.testenable << 11; // 1 + ptr[0] |= bpmem.zmode.updateenable << 12; // 1 if (dstAlphaMode != DSTALPHA_ALPHA_PASS) { if (bpmem.fog.c_proj_fsel.fsel != 0) { - ptr[0] |= bpmem.fog.c_proj_fsel.proj << 16; // 1 - ptr[0] |= bpmem.fogRange.Base.Enabled << 17; // 1 + ptr[0] |= bpmem.fog.c_proj_fsel.proj << 13; // 1 + ptr[0] |= bpmem.fogRange.Base.Enabled << 14; // 1 } } -- cgit v1.2.3 From d3882771aadd1ab1813f383a14af66819e01e68b Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 8 Jan 2013 18:27:31 +0100 Subject: Fix an assert that had been wrong for ages, apparently. --- Source/Core/VideoCommon/Src/PixelShaderGen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.h b/Source/Core/VideoCommon/Src/PixelShaderGen.h index 12a499a472..9c8bfce256 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.h +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.h @@ -45,7 +45,7 @@ #define C_PMATERIALS (C_PLIGHTS + 40) #define C_PENVCONST_END (C_PMATERIALS + 4) #define PIXELSHADERUID_MAX_VALUES 70 -#define PIXELSHADERUID_MAX_VALUES_SAFE 119 +#define PIXELSHADERUID_MAX_VALUES_SAFE 115 // DO NOT make anything in this class virtual. template -- cgit v1.2.3 From d9ea718559a1b820278f7517be7b95a0d2263bd2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 8 Jan 2013 23:46:30 -0500 Subject: Fix an issue where an iterator would become invalidated in TextureCache::ClearRenderTargets() --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index e3152455df..cfbd4eb6c8 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -204,12 +204,16 @@ void TextureCache::ClearRenderTargets() iter = textures.begin(), tcend = textures.end(); - for (; iter!=tcend; ++iter) + while (iter != tcend) + { if (iter->second->type == TCET_EC_VRAM) { delete iter->second; - textures.erase(iter); + textures.erase(iter++); } + else + ++iter; + } } bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsigned int levels) -- cgit v1.2.3 From 304814e7cca0d9ac1497a955f7a6741a62fe4396 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Wed, 9 Jan 2013 10:19:18 +0100 Subject: Video_Software: Implement proper RGBA8 texture loading from tmem. For RGBA8 textures, AR and GB tiles are stored in separate tmem banks. TextureDecoder did not support that previously. --- Source/Core/VideoCommon/Src/TextureDecoder.cpp | 22 ++++++++++++++++++++++ Source/Core/VideoCommon/Src/TextureDecoder.h | 1 + 2 files changed, 23 insertions(+) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index 180c901730..362a42e015 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -2515,6 +2515,28 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth } } +void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth) +{ + u16 sBlk = s >> 2; + u16 tBlk = t >> 2; + u16 widthBlks = (imageWidth >> 2) + 1; + u32 base_ar = (tBlk * widthBlks + sBlk) << 4; + u32 base_gb = (tBlk * widthBlks + sBlk) << 4; + u16 blkS = s & 3; + u16 blkT = t & 3; + u32 blk_off = (blkT << 2) + blkS; + + u32 offset_ar = (base_ar + blk_off) << 1; + u32 offset_gb = (base_gb + blk_off) << 1; + const u8* val_addr_ar = src_ar + offset_ar; + const u8* val_addr_gb = src_gb + offset_gb; + + dst[3] = val_addr_ar[0]; // A + dst[0] = val_addr_ar[1]; // R + dst[1] = val_addr_gb[0]; // G + dst[2] = val_addr_gb[1]; // B +} + const char* texfmt[] = { // pixel diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.h b/Source/Core/VideoCommon/Src/TextureDecoder.h index 1901c86d27..dd4b17eea3 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.h +++ b/Source/Core/VideoCommon/Src/TextureDecoder.h @@ -86,6 +86,7 @@ enum PC_TexFormat PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly = false); PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt); void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt); +void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth); void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center); #endif -- cgit v1.2.3 From e7c883d6be5979cc142c942efef354317998fcbc Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Thu, 10 Jan 2013 15:12:21 +0100 Subject: VideoCommon: Implement proper RGBA8 texture loading from tmem. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 39 ++++++++++++++++++------ Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 16 ++++++++-- Source/Core/VideoCommon/Src/TextureDecoder.cpp | 14 ++++++++- Source/Core/VideoCommon/Src/TextureDecoder.h | 1 + 4 files changed, 57 insertions(+), 13 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 88556cbee8..c975b12240 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -497,18 +497,39 @@ void BPWritten(const BPCmd& bp) // if this is different from 0, manual TMEM management is used (GX_PreloadEntireTexture). if (bp.newvalue != 0) { - // NOTE(neobrain): Apparently tmemodd doesn't affect hardware behavior at all (libogc uses it just as a buffer and switches its contents with tmemeven whenever this is called) + // TODO: Not quite sure if this is completely correct (likely not) + // NOTE: libogc's implementation of GX_PreloadEntireTexture seems flawed, so it's not necessarily a good reference for RE'ing this feature. + BPS_TmemConfig& tmem_cfg = bpmem.tmem_config; - u8* ram_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); - u32 tmem_addr = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; - u32 size = tmem_cfg.preload_tile_info.count * 32; + u8* src_ptr = Memory::GetPointer(tmem_cfg.preload_addr << 5); // TODO: Should we add mask here on GC? + u32 size = tmem_cfg.preload_tile_info.count * TMEM_LINE_SIZE; + u32 tmem_addr_even = tmem_cfg.preload_tmem_even * TMEM_LINE_SIZE; + + if (tmem_cfg.preload_tile_info.type != 3) + { + if (tmem_addr_even + size > TMEM_SIZE) + size = TMEM_SIZE - tmem_addr_even; - // Check if the game has overflowed TMEM, and copy up to the limit. - // Paper Mario does this when entering the Great Boogly Tree (Chap 2) - if ((tmem_addr + size) > TMEM_SIZE) - size = TMEM_SIZE - tmem_addr; + memcpy(texMem + tmem_addr_even, src_ptr, size); + } + else // RGBA8 tiles (and CI14, but that might just be stupid libogc!) + { + // AR and GB tiles are stored in separate TMEM banks => can't use a single memcpy for everything + u32 tmem_addr_odd = tmem_cfg.preload_tmem_odd * TMEM_LINE_SIZE; - memcpy(texMem + tmem_addr, ram_ptr, size); + for (int i = 0; i < tmem_cfg.preload_tile_info.count; ++i) + { + if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE || + tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE) + break; + + memcpy(texMem + tmem_addr_even, src_ptr, TMEM_LINE_SIZE); + memcpy(texMem + tmem_addr_odd, src_ptr + TMEM_LINE_SIZE, TMEM_LINE_SIZE); + tmem_addr_even += TMEM_LINE_SIZE; + tmem_addr_odd += TMEM_LINE_SIZE; + src_ptr += TMEM_LINE_SIZE * 2; + } + } } break; diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index cfbd4eb6c8..e0fc11fe1b 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -333,6 +333,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, if (from_tmem) src_data = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE]; else src_data = Memory::GetPointer(address); + // TODO: This doesn't hash GB tiles for preloaded RGBA8 textures (instead, it's hashing more data from the low tmem bank than it should) tex_hash = GetHash64(src_data, texture_size, g_ActiveConfig.iSafeTextureCache_ColorSamples); if (isPaletteTexture) { @@ -413,10 +414,19 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, } } - // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems here when preloading is enabled if (!using_custom_texture) - pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth, - expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); + { + if (!(texformat == GX_TF_RGBA8 && from_tmem)) + { + pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth, + expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); + } + else + { + u8* src_data_gb = &texMem[bpmem.tex[stage/4].texImage2[stage%4].tmem_odd * TMEM_LINE_SIZE]; + pcfmt = TexDecoder_DecodeRGBA8FromTmem(temp, src_data, src_data_gb, expandedWidth, expandedHeight); + } + } // TODO: Cleanup. Plus, we still autogenerate mipmaps in certain cases (we shouldn't do that) bool isPow2; diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index 362a42e015..44efcf8bae 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -2519,7 +2519,7 @@ void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* sr { u16 sBlk = s >> 2; u16 tBlk = t >> 2; - u16 widthBlks = (imageWidth >> 2) + 1; + u16 widthBlks = (imageWidth >> 2) + 1; // TODO: Looks wrong. Shouldn't this be ((imageWidth-1)>>2)+1 ? u32 base_ar = (tBlk * widthBlks + sBlk) << 4; u32 base_gb = (tBlk * widthBlks + sBlk) << 4; u16 blkS = s & 3; @@ -2537,6 +2537,18 @@ void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* sr dst[2] = val_addr_gb[1]; // B } +PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height) +{ + // TODO for someone who cares: Make this less slow! + for (int y = 0; y < height; ++y) + for (int x = 0; x < width; ++x) + { + TexDecoder_DecodeTexelRGBA8FromTmem(dst, src_ar, src_gb, x, y, width-1); + dst += 4; + } + + return PC_TEX_FMT_RGBA32; +} const char* texfmt[] = { // pixel diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.h b/Source/Core/VideoCommon/Src/TextureDecoder.h index dd4b17eea3..fae70897f5 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.h +++ b/Source/Core/VideoCommon/Src/TextureDecoder.h @@ -87,6 +87,7 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt); void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt); void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth); +PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height); void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center); #endif -- cgit v1.2.3 From f21f097e7a831e752ab36974897b2ba57e266dfc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 10 Jan 2013 21:44:12 -0500 Subject: Redundant line of code in VertexShaderManager::Dirty() Also cleaned it up. --- .../Core/VideoCommon/Src/VertexShaderManager.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index d960710ada..84340c6b98 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -169,14 +169,24 @@ void VertexShaderManager::Shutdown() void VertexShaderManager::Dirty() { - nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256; - nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96; - nPostTransformMatricesChanged[0] = 0; nPostTransformMatricesChanged[1] = 256; - nLightsChanged[0] = 0; nLightsChanged[1] = 0x80; + nTransformMatricesChanged[0] = 0; + nTransformMatricesChanged[1] = 256; + + nNormalMatricesChanged[0] = 0; + nNormalMatricesChanged[1] = 96; + + nPostTransformMatricesChanged[0] = 0; + nPostTransformMatricesChanged[1] = 256; + + nLightsChanged[0] = 0; + nLightsChanged[1] = 0x80; + bPosNormalMatrixChanged = true; - bTexMatricesChanged[0] = bTexMatricesChanged[1] = true; + bTexMatricesChanged[0] = true; + bTexMatricesChanged[1] = true; + bProjectionChanged = true; - bPosNormalMatrixChanged = bTexMatricesChanged[0] = bTexMatricesChanged[1] = true; + nMaterialsChanged = 15; } -- cgit v1.2.3 From ad05d568b9fce5f983dd06cfedb0904ada8ce9ab Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 11 Jan 2013 15:47:38 +0100 Subject: PixelShaderGen: Change error strings to be unique so that we can identify unexpected behavior more easily. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index fdb5f21a51..f10fd437a8 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -287,10 +287,10 @@ static const char *tevKSelTableC[] = // KCSEL "0.375f,0.375f,0.375f", // 3_8 = 0x05 "0.25f,0.25f,0.25f", // 1_4 = 0x06 "0.125f,0.125f,0.125f", // 1_8 = 0x07 - "ERROR", // 0x08 - "ERROR", // 0x09 - "ERROR", // 0x0a - "ERROR", // 0x0b + "ERROR1", // 0x08 + "ERROR2", // 0x09 + "ERROR3", // 0x0a + "ERROR4", // 0x0b I_KCOLORS"[0].rgb", // K0 = 0x0C I_KCOLORS"[1].rgb", // K1 = 0x0D I_KCOLORS"[2].rgb", // K2 = 0x0E @@ -323,14 +323,14 @@ static const char *tevKSelTableA[] = // KASEL "0.375f",// 3_8 = 0x05 "0.25f", // 1_4 = 0x06 "0.125f",// 1_8 = 0x07 - "ERROR", // 0x08 - "ERROR", // 0x09 - "ERROR", // 0x0a - "ERROR", // 0x0b - "ERROR", // 0x0c - "ERROR", // 0x0d - "ERROR", // 0x0e - "ERROR", // 0x0f + "ERROR5", // 0x08 + "ERROR6", // 0x09 + "ERROR7", // 0x0a + "ERROR8", // 0x0b + "ERROR9", // 0x0c + "ERROR10", // 0x0d + "ERROR11", // 0x0e + "ERROR12", // 0x0f I_KCOLORS"[0].r", // K0_R = 0x10 I_KCOLORS"[1].r", // K1_R = 0x11 I_KCOLORS"[2].r", // K2_R = 0x12 @@ -405,7 +405,7 @@ static const char *tevCInputTable[] = // CC "float3(0.5f, 0.5f, 0.5f)", // HALF "(ckonsttemp.rgb)", //"konsttemp.rgb", // KONST "float3(0.0f, 0.0f, 0.0f)", // ZERO - "PADERROR", "PADERROR", "PADERROR", "PADERROR" + "PADERROR1", "PADERROR2", "PADERROR3", "PADERROR4" }; static const char *tevAInputTable[] = // CA @@ -427,17 +427,17 @@ static const char *tevAInputTable[] = // CA "crastemp", // RASA, "ckonsttemp", // KONST, (hw1 had quarter) "float4(0.0f, 0.0f, 0.0f, 0.0f)", // ZERO - "PADERROR", "PADERROR", "PADERROR", "PADERROR", - "PADERROR", "PADERROR", "PADERROR", "PADERROR", + "PADERROR5", "PADERROR6", "PADERROR7", "PADERROR8", + "PADERROR9", "PADERROR10", "PADERROR11", "PADERROR12", }; static const char *tevRasTable[] = { "colors_0", "colors_1", - "ERROR", //2 - "ERROR", //3 - "ERROR", //4 + "ERROR13", //2 + "ERROR14", //3 + "ERROR15", //4 "alphabump", // use bump alpha "(alphabump*(255.0f/248.0f))", //normalized "float4(0.0f, 0.0f, 0.0f, 0.0f)", // zero -- cgit v1.2.3 From dfc0c4b08d339502989fdfaf21e89f8ed77366a3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 11 Jan 2013 19:38:04 -0500 Subject: Fix two signed/unsigned mismatch warnings. Also tidied up SDCardUtil - made the variables make more sense (typewise) --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index f10fd437a8..e21efa5ce1 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -28,7 +28,7 @@ #include "NativeVertexFormat.h" -static void StageHash(int stage, u32* out) +static void StageHash(u32 stage, u32* out) { out[0] |= bpmem.combiners[stage].colorC.hex & 0xFFFFFF; // 24 u32 alphaC = bpmem.combiners[stage].alphaC.hex & 0xFFFFF0; // 24, strip out tswap and rswap for now @@ -141,7 +141,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo } u32* ptr = &uid->values[2]; - for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i) + for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i) { StageHash(i, ptr); ptr += 4; // max: ptr = &uid->values[66] @@ -204,7 +204,7 @@ void GetSafePixelShaderId(PIXELSHADERUIDSAFE *uid, DSTALPHA_MODE dstAlphaMode, u *ptr++ = bpmem.tevindref.hex; // 31 - for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i) // up to 16 times + for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i) // up to 16 times { *ptr++ = bpmem.combiners[i].colorC.hex; // 32+5*i *ptr++ = bpmem.combiners[i].alphaC.hex; // 33+5*i -- cgit v1.2.3 From 2cd415dd837d24e384524a7f0b39d547f890535f Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 11 Jan 2013 22:00:36 -0600 Subject: Fix the signed/unsigned comparison warnings created by a recent commit. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index e21efa5ce1..c1ebdbcc89 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -141,7 +141,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo } u32* ptr = &uid->values[2]; - for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i) + for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1u; ++i) { StageHash(i, ptr); ptr += 4; // max: ptr = &uid->values[66] @@ -204,7 +204,7 @@ void GetSafePixelShaderId(PIXELSHADERUIDSAFE *uid, DSTALPHA_MODE dstAlphaMode, u *ptr++ = bpmem.tevindref.hex; // 31 - for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i) // up to 16 times + for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1u; ++i) // up to 16 times { *ptr++ = bpmem.combiners[i].colorC.hex; // 32+5*i *ptr++ = bpmem.combiners[i].alphaC.hex; // 33+5*i -- cgit v1.2.3 From f7b0c8684bc56efe256232d618de3376ed965232 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 12 Jan 2013 15:06:06 +0100 Subject: BPMemory: Expose more register descriptions for FifoPlayer --- Source/Core/VideoCommon/Src/BPMemory.cpp | 135 ++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPMemory.cpp b/Source/Core/VideoCommon/Src/BPMemory.cpp index ca0e748cb0..38489bcf7a 100644 --- a/Source/Core/VideoCommon/Src/BPMemory.cpp +++ b/Source/Core/VideoCommon/Src/BPMemory.cpp @@ -55,6 +55,11 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size snprintf(name, name_size, #reg); \ (void)(reg); + case BPMEM_GENMODE: // 0x00 + SetRegName(BPMEM_GENMODE); + // TODO: Description + break; + case BPMEM_DISPLAYCOPYFILER: // 0x01 // TODO: This is actually the sample pattern used for copies from an antialiased EFB SetRegName(BPMEM_DISPLAYCOPYFILER); @@ -75,6 +80,28 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size } break; + case BPMEM_BLENDMODE: // 0x41 + { + SetRegName(BPMEM_BLENDMODE); + BlendMode mode; mode.hex = cmddata; + const char* dstfactors[] = { "0", "1", "src_color", "1-src_color", "src_alpha", "1-src_alpha", "dst_alpha", "1-dst_alpha" }; + const char* srcfactors[] = { "0", "1", "dst_color", "1-dst_color", "src_alpha", "1-src_alpha", "dst_alpha", "1-dst_alpha" }; + const char* logicmodes[] = { "0", "s & d", "s & ~d", "s", "~s & d", "d", "s ^ d", "s | d", "~(s | d)", "~(s ^ d)", "~d", "s | ~d", "~s", "~s | d", "~(s & d)", "1" }; + snprintf(desc, desc_size, "Enable: %s\n" + "Logic ops: %s\n" + "Dither: %s\n" + "Color write: %s\n" + "Alpha write: %s\n" + "Dest factor: %s\n" + "Source factor: %s\n" + "Subtract: %s\n" + "Logic mode: %s\n", + no_yes[mode.blendenable], no_yes[mode.logicopenable], no_yes[mode.dither], + no_yes[mode.colorupdate], no_yes[mode.alphaupdate], dstfactors[mode.dstfactor], + srcfactors[mode.srcfactor], no_yes[mode.subtract], logicmodes[mode.logicmode]); + } + break; + case BPMEM_EFB_BR: // 0x4A { // TODO: Misleading name, should be BPMEM_EFB_WH instead @@ -148,7 +175,113 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size // TODO: Description break; -#undef SET_REG_NAME + case BPMEM_TEV_COLOR_ENV: // 0xC0 + case BPMEM_TEV_COLOR_ENV+2: + case BPMEM_TEV_COLOR_ENV+4: + case BPMEM_TEV_COLOR_ENV+8: + case BPMEM_TEV_COLOR_ENV+10: + case BPMEM_TEV_COLOR_ENV+12: + case BPMEM_TEV_COLOR_ENV+14: + case BPMEM_TEV_COLOR_ENV+16: + case BPMEM_TEV_COLOR_ENV+18: + case BPMEM_TEV_COLOR_ENV+20: + case BPMEM_TEV_COLOR_ENV+22: + case BPMEM_TEV_COLOR_ENV+24: + case BPMEM_TEV_COLOR_ENV+26: + case BPMEM_TEV_COLOR_ENV+28: + case BPMEM_TEV_COLOR_ENV+30: + { + SetRegName(BPMEM_TEV_COLOR_ENV); + TevStageCombiner::ColorCombiner cc; cc.hex = cmddata; + const char* tevin[] = + { + "prev.rgb", "prev.aaa", + "c0.rgb", "c0.aaa", + "c1.rgb", "c1.aaa", + "c2.rgb", "c2.aaa", + "tex.rgb", "tex.aaa", + "ras.rgb", "ras.aaa", + "ONE", "HALF", "konst.rgb", "ZERO", + }; + const char* tevbias[] = { "0", "+0.5", "-0.5", "compare" }; + const char* tevop[] = { "add", "sub" }; + const char* tevscale[] = { "1", "2", "4", "0.5" }; + const char* tevout[] = { "prev.rgb", "c0.rgb", "c1.rgb", "c2.rgb" }; + snprintf(desc, desc_size, "tev stage: %d\n" + "a: %s\n" + "b: %s\n" + "c: %s\n" + "d: %s\n" + "bias: %s\n" + "op: %s\n" + "clamp: %s\n" + "scale factor: %s\n" + "dest: %s\n", + (data[0] - BPMEM_TEV_COLOR_ENV)/2, tevin[cc.a], tevin[cc.b], tevin[cc.c], tevin[cc.d], + tevbias[cc.bias], tevop[cc.op], no_yes[cc.clamp], tevscale[cc.shift], tevout[cc.dest]); + break; + } + + case BPMEM_TEV_ALPHA_ENV: // 0xC1 + case BPMEM_TEV_ALPHA_ENV+2: + case BPMEM_TEV_ALPHA_ENV+4: + case BPMEM_TEV_ALPHA_ENV+6: + case BPMEM_TEV_ALPHA_ENV+8: + case BPMEM_TEV_ALPHA_ENV+10: + case BPMEM_TEV_ALPHA_ENV+12: + case BPMEM_TEV_ALPHA_ENV+14: + case BPMEM_TEV_ALPHA_ENV+16: + case BPMEM_TEV_ALPHA_ENV+18: + case BPMEM_TEV_ALPHA_ENV+20: + case BPMEM_TEV_ALPHA_ENV+22: + case BPMEM_TEV_ALPHA_ENV+24: + case BPMEM_TEV_ALPHA_ENV+26: + case BPMEM_TEV_ALPHA_ENV+28: + case BPMEM_TEV_ALPHA_ENV+30: + { + SetRegName(BPMEM_TEV_ALPHA_ENV); + TevStageCombiner::AlphaCombiner ac; ac.hex = cmddata; + const char* tevin[] = + { + "prev", "c0", "c1", "c2", + "tex", "ras", "konst", "ZERO", + }; + const char* tevbias[] = { "0", "+0.5", "-0.5", "compare" }; + const char* tevop[] = { "add", "sub" }; + const char* tevscale[] = { "1", "2", "4", "0.5" }; + const char* tevout[] = { "prev", "c0", "c1", "c2" }; + snprintf(desc, desc_size, "tev stage: %d\n" + "a: %s\n" + "b: %s\n" + "c: %s\n" + "d: %s\n" + "bias: %s\n" + "op: %s\n" + "clamp: %s\n" + "scale factor: %s\n" + "dest: %s\n" + "ras sel: %d\n" + "tex sel: %d\n", + (data[0] - BPMEM_TEV_ALPHA_ENV)/2, tevin[ac.a], tevin[ac.b], tevin[ac.c], tevin[ac.d], + tevbias[ac.bias], tevop[ac.op], no_yes[ac.clamp], tevscale[ac.shift], tevout[ac.dest], + ac.rswap, ac.tswap); + break; + } + + case BPMEM_ALPHACOMPARE: // 0xF3 + { + SetRegName(BPMEM_ALPHACOMPARE); + AlphaTest test; test.hex = cmddata; + const char* functions[] = { "NEVER", "LESS", "EQUAL", "LEQUAL", "GREATER", "NEQUAL", "GEQUAL", "ALWAYS" }; + const char* logic[] = { "AND", "OR", "XOR", "XNOR" }; + snprintf(desc, desc_size, "test 1: %s (ref: %#02x)\n" + "test 2: %s (ref: %#02x)\n" + "logic: %s\n", + functions[test.comp0], test.ref0, functions[test.comp1], test.ref1, logic[test.logic]); + break; + } + +#undef SetRegName } } -- cgit v1.2.3 From ddf23094c299cb061baaa7a110ecb7413130d094 Mon Sep 17 00:00:00 2001 From: lioncash Date: Tue, 15 Jan 2013 21:15:31 -0500 Subject: Fix two unsigned/signed mismatch warnings. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 2 +- Source/Core/VideoCommon/Src/LightingShaderGen.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index c975b12240..9ba2afbbd1 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -517,7 +517,7 @@ void BPWritten(const BPCmd& bp) // AR and GB tiles are stored in separate TMEM banks => can't use a single memcpy for everything u32 tmem_addr_odd = tmem_cfg.preload_tmem_odd * TMEM_LINE_SIZE; - for (int i = 0; i < tmem_cfg.preload_tile_info.count; ++i) + for (u32 i = 0; i < tmem_cfg.preload_tile_info.count; ++i) { if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE || tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE) diff --git a/Source/Core/VideoCommon/Src/LightingShaderGen.cpp b/Source/Core/VideoCommon/Src/LightingShaderGen.cpp index a506acadfc..f32e5dfeee 100644 --- a/Source/Core/VideoCommon/Src/LightingShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/LightingShaderGen.cpp @@ -23,7 +23,7 @@ int GetLightingShaderId(u32* out) { - for (int i = 0; i < xfregs.numChan.numColorChans; ++i) + for (u32 i = 0; i < xfregs.numChan.numColorChans; ++i) { out[i] = xfregs.color[i].enablelighting ? (u32)xfregs.color[i].hex : -- cgit v1.2.3 From 87431666639c7036ea0f5b0d499df639cefb3d51 Mon Sep 17 00:00:00 2001 From: lioncash Date: Wed, 16 Jan 2013 09:42:51 -0500 Subject: Made several variables/parameters unsigned in the DX9, DX11 and OGL plugins. They make more sense like this (given their names). This also gets rid of some more typecasts in some cases. --- .../Core/VideoCommon/Src/FramebufferManagerBase.h | 2 +- Source/Core/VideoCommon/Src/RenderBase.cpp | 22 ++++++++++---------- Source/Core/VideoCommon/Src/RenderBase.h | 24 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index e529bb1a39..902e781a70 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -17,7 +17,7 @@ struct XFBSourceBase // TODO: only DX9 uses the width/height params virtual void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, int width, int height) const = 0; + const MathUtil::Rectangle &drawrc, u32 width, u32 height) const = 0; virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0; diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 8e1d012fa2..1ea7afbc1e 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -60,12 +60,12 @@ std::string Renderer::s_sScreenshotName; volatile bool Renderer::s_bScreenshot; // The framebuffer size -int Renderer::s_target_width; -int Renderer::s_target_height; +unsigned int Renderer::s_target_width; +unsigned int Renderer::s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. -int Renderer::s_backbuffer_width; -int Renderer::s_backbuffer_height; +unsigned int Renderer::s_backbuffer_width; +unsigned int Renderer::s_backbuffer_height; TargetRectangle Renderer::target_rc; @@ -163,7 +163,7 @@ int Renderer::EFBToScaledY(int y) }; } -void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) +void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY) { if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1) { @@ -172,15 +172,15 @@ void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) } else { - scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; - scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; + scaledX = x * (efb_scale_numeratorX / efb_scale_denominatorX); + scaledY = y * (efb_scale_numeratorY / efb_scale_denominatorY); } } // return true if target size changed -bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) +bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier) { - int newEFBWidth, newEFBHeight; + u32 newEFBWidth, newEFBHeight; // TODO: Ugly. Clean up switch (s_LastEFBScale) @@ -374,7 +374,7 @@ void Renderer::DrawDebugText() // TODO: remove extern bool g_aspect_wide; -void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) +void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height) { float FloatGLWidth = (float)backbuffer_width; float FloatGLHeight = (float)backbuffer_height; @@ -492,7 +492,7 @@ void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) target_rc.bottom = YOffset + iHeight; } -void Renderer::SetWindowSize(int width, int height) +void Renderer::SetWindowSize(u32 width, u32 height) { if (width < 1) width = 1; diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 5376577cbd..38cab83562 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -67,14 +67,14 @@ public: virtual void RestoreState() = 0; // Ideal internal resolution - determined by display resolution (automatic scaling) and/or a multiple of the native EFB resolution - static int GetTargetWidth() { return s_target_width; } - static int GetTargetHeight() { return s_target_height; } + static u32 GetTargetWidth() { return s_target_width; } + static u32 GetTargetHeight() { return s_target_height; } // Display resolution - static int GetBackbufferWidth() { return s_backbuffer_width; } - static int GetBackbufferHeight() { return s_backbuffer_height; } + static u32 GetBackbufferWidth() { return s_backbuffer_width; } + static u32 GetBackbufferHeight() { return s_backbuffer_height; } - static void SetWindowSize(int width, int height); + static void SetWindowSize(u32 width, u32 height); // EFB coordinate conversion functions @@ -82,7 +82,7 @@ public: virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; static const TargetRectangle& GetTargetRectangle() { return target_rc; } - static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height); + static void UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height); // Use this to upscale native EFB coordinates to IDEAL internal resolution @@ -132,8 +132,8 @@ public: protected: - static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY); - static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1); + static void CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY); + static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier = 1); static void CheckFifoRecording(); static void RecordVideoMemory(); @@ -151,12 +151,12 @@ protected: bool bLastFrameDumped; // The framebuffer size - static int s_target_width; - static int s_target_height; + static u32 s_target_width; + static u32 s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. - static int s_backbuffer_width; - static int s_backbuffer_height; + static u32 s_backbuffer_width; + static u32 s_backbuffer_height; static TargetRectangle target_rc; -- cgit v1.2.3 From 0ef3bd9c778a786ec439950f65c863d64ccf98b6 Mon Sep 17 00:00:00 2001 From: lioncash Date: Wed, 16 Jan 2013 15:46:11 -0500 Subject: Revert "Made several variables/parameters unsigned in the DX9, DX11 and OGL plugins. They make more sense like this (given their names)." Turns out I was wrong in my previous commit. My bad. This reverts commit 87431666639c7036ea0f5b0d499df639cefb3d51. --- .../Core/VideoCommon/Src/FramebufferManagerBase.h | 2 +- Source/Core/VideoCommon/Src/RenderBase.cpp | 22 ++++++++++---------- Source/Core/VideoCommon/Src/RenderBase.h | 24 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index 902e781a70..e529bb1a39 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -17,7 +17,7 @@ struct XFBSourceBase // TODO: only DX9 uses the width/height params virtual void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc, u32 width, u32 height) const = 0; + const MathUtil::Rectangle &drawrc, int width, int height) const = 0; virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0; diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 1ea7afbc1e..8e1d012fa2 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -60,12 +60,12 @@ std::string Renderer::s_sScreenshotName; volatile bool Renderer::s_bScreenshot; // The framebuffer size -unsigned int Renderer::s_target_width; -unsigned int Renderer::s_target_height; +int Renderer::s_target_width; +int Renderer::s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. -unsigned int Renderer::s_backbuffer_width; -unsigned int Renderer::s_backbuffer_height; +int Renderer::s_backbuffer_width; +int Renderer::s_backbuffer_height; TargetRectangle Renderer::target_rc; @@ -163,7 +163,7 @@ int Renderer::EFBToScaledY(int y) }; } -void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY) +void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) { if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1) { @@ -172,15 +172,15 @@ void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int } else { - scaledX = x * (efb_scale_numeratorX / efb_scale_denominatorX); - scaledY = y * (efb_scale_numeratorY / efb_scale_denominatorY); + scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; + scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; } } // return true if target size changed -bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier) +bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) { - u32 newEFBWidth, newEFBHeight; + int newEFBWidth, newEFBHeight; // TODO: Ugly. Clean up switch (s_LastEFBScale) @@ -374,7 +374,7 @@ void Renderer::DrawDebugText() // TODO: remove extern bool g_aspect_wide; -void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height) +void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) { float FloatGLWidth = (float)backbuffer_width; float FloatGLHeight = (float)backbuffer_height; @@ -492,7 +492,7 @@ void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height) target_rc.bottom = YOffset + iHeight; } -void Renderer::SetWindowSize(u32 width, u32 height) +void Renderer::SetWindowSize(int width, int height) { if (width < 1) width = 1; diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 38cab83562..5376577cbd 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -67,14 +67,14 @@ public: virtual void RestoreState() = 0; // Ideal internal resolution - determined by display resolution (automatic scaling) and/or a multiple of the native EFB resolution - static u32 GetTargetWidth() { return s_target_width; } - static u32 GetTargetHeight() { return s_target_height; } + static int GetTargetWidth() { return s_target_width; } + static int GetTargetHeight() { return s_target_height; } // Display resolution - static u32 GetBackbufferWidth() { return s_backbuffer_width; } - static u32 GetBackbufferHeight() { return s_backbuffer_height; } + static int GetBackbufferWidth() { return s_backbuffer_width; } + static int GetBackbufferHeight() { return s_backbuffer_height; } - static void SetWindowSize(u32 width, u32 height); + static void SetWindowSize(int width, int height); // EFB coordinate conversion functions @@ -82,7 +82,7 @@ public: virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; static const TargetRectangle& GetTargetRectangle() { return target_rc; } - static void UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height); + static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height); // Use this to upscale native EFB coordinates to IDEAL internal resolution @@ -132,8 +132,8 @@ public: protected: - static void CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY); - static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier = 1); + static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY); + static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1); static void CheckFifoRecording(); static void RecordVideoMemory(); @@ -151,12 +151,12 @@ protected: bool bLastFrameDumped; // The framebuffer size - static u32 s_target_width; - static u32 s_target_height; + static int s_target_width; + static int s_target_height; // TODO: Add functionality to reinit all the render targets when the window is resized. - static u32 s_backbuffer_width; - static u32 s_backbuffer_height; + static int s_backbuffer_width; + static int s_backbuffer_height; static TargetRectangle target_rc; -- cgit v1.2.3 From 6c0f6ffecff631344fe52972e267753e19e8d121 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 19 Jan 2013 22:34:07 +0100 Subject: Fix a dumb regression from revision 4925a28f94d8. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index c1ebdbcc89..448501aad0 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -158,10 +158,11 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo if (dstAlphaMode != DSTALPHA_ALPHA_PASS) { + ptr[0] |= bpmem.fog.c_proj_fsel.fsel << 13; // 3 if (bpmem.fog.c_proj_fsel.fsel != 0) { - ptr[0] |= bpmem.fog.c_proj_fsel.proj << 13; // 1 - ptr[0] |= bpmem.fogRange.Base.Enabled << 14; // 1 + ptr[0] |= bpmem.fog.c_proj_fsel.proj << 16; // 1 + ptr[0] |= bpmem.fogRange.Base.Enabled << 17; // 1 } } -- cgit v1.2.3 From f69b6b595ef80acf5ce776a80b1df27033bc7fdf Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 24 Jan 2013 13:10:13 +0100 Subject: change projection_type to u32 Fix issue 5740 thx @ erwan_taf for debuging all the week --- Source/Core/VideoCommon/Src/Statistics.h | 2 +- .../Core/VideoCommon/Src/VertexShaderManager.cpp | 61 ++++++++++++---------- Source/Core/VideoCommon/Src/XFMemory.h | 15 ++++-- 3 files changed, 46 insertions(+), 32 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/Statistics.h b/Source/Core/VideoCommon/Src/Statistics.h index 7238398b42..e173bfc682 100644 --- a/Source/Core/VideoCommon/Src/Statistics.h +++ b/Source/Core/VideoCommon/Src/Statistics.h @@ -43,7 +43,7 @@ struct Statistics int numUniquePixelShaders; - float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5, proj_6; + float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5; float gproj_0, gproj_1, gproj_2, gproj_3, gproj_4, gproj_5; float gproj_6, gproj_7, gproj_8, gproj_9, gproj_10, gproj_11, gproj_12, gproj_13, gproj_14, gproj_15; diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 84340c6b98..1dce567b0d 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -350,26 +350,28 @@ void VertexShaderManager::SetConstants() if (bProjectionChanged) { bProjectionChanged = false; + + float *rawProjection = xfregs.projection.rawProjection; - if (xfregs.rawProjection[6] == 0) + switch(xfregs.projection.type) { - // Perspective + case GX_PERSPECTIVE: - g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW; + g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW; g_fProjectionMatrix[1] = 0.0f; - g_fProjectionMatrix[2] = xfregs.rawProjection[1]; + g_fProjectionMatrix[2] = rawProjection[1]; g_fProjectionMatrix[3] = 0.0f; g_fProjectionMatrix[4] = 0.0f; - g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH; - g_fProjectionMatrix[6] = xfregs.rawProjection[3]; + g_fProjectionMatrix[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH; + g_fProjectionMatrix[6] = rawProjection[3]; g_fProjectionMatrix[7] = 0.0f; g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[9] = 0.0f; - g_fProjectionMatrix[10] = xfregs.rawProjection[4]; + g_fProjectionMatrix[10] = rawProjection[4]; - g_fProjectionMatrix[11] = xfregs.rawProjection[5]; + g_fProjectionMatrix[11] = rawProjection[5]; g_fProjectionMatrix[12] = 0.0f; g_fProjectionMatrix[13] = 0.0f; @@ -394,24 +396,24 @@ void VertexShaderManager::SetConstants() SETSTAT_FT(stats.gproj_13, g_fProjectionMatrix[13]); SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]); SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]); - } - else - { - // Orthographic Projection - g_fProjectionMatrix[0] = xfregs.rawProjection[0]; + break; + + case GX_ORTHOGRAPHIC: + + g_fProjectionMatrix[0] = rawProjection[0]; g_fProjectionMatrix[1] = 0.0f; g_fProjectionMatrix[2] = 0.0f; - g_fProjectionMatrix[3] = xfregs.rawProjection[1]; + g_fProjectionMatrix[3] = rawProjection[1]; g_fProjectionMatrix[4] = 0.0f; - g_fProjectionMatrix[5] = xfregs.rawProjection[2]; + g_fProjectionMatrix[5] = rawProjection[2]; g_fProjectionMatrix[6] = 0.0f; - g_fProjectionMatrix[7] = xfregs.rawProjection[3]; + g_fProjectionMatrix[7] = rawProjection[3]; g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[9] = 0.0f; - g_fProjectionMatrix[10] = (g_ProjHack1.value + xfregs.rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign); - g_fProjectionMatrix[11] = (g_ProjHack2.value + xfregs.rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign); + g_fProjectionMatrix[10] = (g_ProjHack1.value + rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign); + g_fProjectionMatrix[11] = (g_ProjHack2.value + rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign); g_fProjectionMatrix[12] = 0.0f; g_fProjectionMatrix[13] = 0.0f; @@ -424,7 +426,7 @@ void VertexShaderManager::SetConstants() */ g_fProjectionMatrix[14] = 0.0f; - g_fProjectionMatrix[15] = (g_ProjHack3 && xfregs.rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled + g_fProjectionMatrix[15] = (g_ProjHack3 && rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]); SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]); @@ -442,18 +444,21 @@ void VertexShaderManager::SetConstants() SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]); SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]); SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]); - SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]); - SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]); - SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]); - SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]); - SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]); - SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]); - SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]); + SETSTAT_FT(stats.proj_0, rawProjection[0]); + SETSTAT_FT(stats.proj_1, rawProjection[1]); + SETSTAT_FT(stats.proj_2, rawProjection[2]); + SETSTAT_FT(stats.proj_3, rawProjection[3]); + SETSTAT_FT(stats.proj_4, rawProjection[4]); + SETSTAT_FT(stats.proj_5, rawProjection[5]); + break; + + default: + ERROR_LOG(VIDEO, "unknown projection type: %d", xfregs.projection.type); } - PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]); + PRIM_LOG("Projection: %f %f %f %f %f %f\n", rawProjection[0], rawProjection[1], rawProjection[2], rawProjection[3], rawProjection[4], rawProjection[5]); - if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.rawProjection[6] == 0) + if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.projection.type == GX_PERSPECTIVE) { Matrix44 mtxA; Matrix44 mtxB; diff --git a/Source/Core/VideoCommon/Src/XFMemory.h b/Source/Core/VideoCommon/Src/XFMemory.h index ee3c3b0fdc..fc199b8c32 100644 --- a/Source/Core/VideoCommon/Src/XFMemory.h +++ b/Source/Core/VideoCommon/Src/XFMemory.h @@ -61,6 +61,9 @@ #define LIGHTATTN_NONE 2 #define LIGHTATTN_DIR 3 +#define GX_PERSPECTIVE 0 +#define GX_ORTHOGRAPHIC 1 + #define XFMEM_SIZE 0x8000 #define XFMEM_POSMATRICES 0x000 #define XFMEM_POSMATRICES_END 0x100 @@ -235,6 +238,12 @@ struct Viewport float farZ; }; +struct Projection +{ + float rawProjection[6]; + u32 type; // only GX_PERSPECTIVE or GX_ORTHOGRAPHIC are allowed +}; + struct XFRegisters { u32 error; // 0x1000 @@ -257,10 +266,10 @@ struct XFRegisters u32 unk5; // 0x1015 u32 unk6; // 0x1016 u32 unk7; // 0x1017 - u32 MatrixIndexA; // 0x1018 - u32 MatrixIndexB; // 0x1019 + u32 MatrixIndexA; // 0x1018 + u32 MatrixIndexB; // 0x1019 Viewport viewport; // 0x101a - 0x101f - float rawProjection[7]; // 0x1020 - 0x1026 + Projection projection; // 0x1020 - 0x1026 u32 unk8[24]; // 0x1027 - 0x103e NumTexGen numTexGen; // 0x103f TexMtxInfo texMtxInfo[8]; // 0x1040 - 0x1047 -- cgit v1.2.3 From 2db0c4270eda2e652bb39e394aa8a576785a2354 Mon Sep 17 00:00:00 2001 From: lioncash Date: Thu, 24 Jan 2013 08:21:08 -0500 Subject: Fix a potential memory leak on non-windows systems. Also added a FIXME to BPStructs.cpp and BPMemLoader.cpp --- Source/Core/VideoCommon/Src/BPStructs.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 9ba2afbbd1..add40d99c3 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -519,6 +519,7 @@ void BPWritten(const BPCmd& bp) for (u32 i = 0; i < tmem_cfg.preload_tile_info.count; ++i) { + // FIXME: Duplicate conditions. if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE || tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE) break; -- cgit v1.2.3 From d60cc373d1b389215eb63c4e20fe24e902680c7a Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 24 Jan 2013 16:11:07 +0100 Subject: Revert "Revert 30dd9c2 e9d00bf db5f4c8 and bff0fae" This reverts commit d0301ca89d318d8d6e3e7fde9c4b60e470e184e4. Conflicts: .gitignore --- Source/Core/VideoCommon/Src/BPFunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp index cddeae3000..b9a76ba7b6 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.cpp +++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp @@ -236,7 +236,7 @@ bool GetConfig(const int &type) case CONFIG_DISABLEFOG: return g_ActiveConfig.bDisableFog; case CONFIG_SHOWEFBREGIONS: - return false; + return g_ActiveConfig.bShowEFBCopyRegions; default: PanicAlert("GetConfig Error: Unknown Config Type!"); return false; -- cgit v1.2.3