From e81b62aad14ec9ef2532b4d5423e2dad69e08b6e Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 12:45:10 -0400 Subject: BPFunctions: Clean up math slightly No need for magic 342 numbers. --- Source/Core/VideoCommon/BPFunctions.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 0b468d1cf8..aa2343d97a 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -34,11 +34,22 @@ void SetGenerationMode() void SetScissor() { - const int xoff = bpmem.scissorOffset.x * 2 - 342; - const int yoff = bpmem.scissorOffset.y * 2 - 342; - - EFBRectangle rc (bpmem.scissorTL.x - xoff - 342, bpmem.scissorTL.y - yoff - 342, - bpmem.scissorBR.x - xoff - 341, bpmem.scissorBR.y - yoff - 341); + /* NOTE: the minimum value here for the scissor rect and offset is -342. + * GX internally adds on an offset of 342 to both the offset and scissor + * coords to ensure that the register was always unsigned. + * + * The code that was here before tried to "undo" this offset, but + * since we always take the difference, the +342 added to both + * sides cancels out. */ + + /* The scissor offset is always even, so to save space, the scissor offset + * register is scaled down by 2. So, if somebody calls + * GX_SetScissorBoxOffset(20, 20); the registers will be set to 10, 10. */ + const int xoff = bpmem.scissorOffset.x * 2; + const int yoff = bpmem.scissorOffset.y * 2; + + EFBRectangle rc (bpmem.scissorTL.x - xoff, bpmem.scissorTL.y - yoff, + bpmem.scissorBR.x - xoff + 1, bpmem.scissorBR.y - yoff + 1); if (rc.left < 0) rc.left = 0; if (rc.top < 0) rc.top = 0; -- cgit v1.2.3 From 56228cea5d4b0cb0b5ca60d697db7f9719e3635b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 14:57:45 -0400 Subject: BPFunctions: Remove an unused method --- Source/Core/VideoCommon/BPFunctions.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index aa2343d97a..ae93e8077a 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -244,12 +244,6 @@ u8 *GetPointer(const u32 &address) return Memory::GetPointer(address); } -// Never used. All backends call SetSamplerState in VertexManager::Flush -void SetTextureMode(const BPCmd &bp) -{ - g_renderer->SetSamplerState(bp.address & 3, (bp.address & 0xE0) == 0xA0); -} - void SetInterlacingMode(const BPCmd &bp) { // TODO -- cgit v1.2.3 From fe645b888b589b7e7d9cc34be7809e2ff6d62cc3 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 15:04:29 -0400 Subject: BPFunctions: Remove use of a dumb method GetPointer serves no purpose. --- Source/Core/VideoCommon/BPFunctions.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index ae93e8077a..4d3be45498 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -239,11 +239,6 @@ bool GetConfig(const int &type) } } -u8 *GetPointer(const u32 &address) -{ - return Memory::GetPointer(address); -} - void SetInterlacingMode(const BPCmd &bp) { // TODO -- cgit v1.2.3 From 08611c3f363b67e9a9aedef43d9e18bab1d232cf Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 15:08:11 -0400 Subject: PixelShaderManager: Fizzle out fog changes when disabled here This lets us remove a use of GetConfig. --- Source/Core/VideoCommon/BPFunctions.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 4d3be45498..89ace7baa5 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -229,8 +229,6 @@ bool GetConfig(const int &type) { case CONFIG_ISWII: return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; - case CONFIG_DISABLEFOG: - return g_ActiveConfig.bDisableFog; case CONFIG_SHOWEFBREGIONS: return g_ActiveConfig.bShowEFBCopyRegions; default: -- cgit v1.2.3 From 833b7ee584c8ed828dea99f71c6874e73a8c3f32 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 15:10:19 -0400 Subject: BPFunctions: Remove the rest of GetConfig --- Source/Core/VideoCommon/BPFunctions.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index 89ace7baa5..a5cb6d9f66 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -223,20 +223,6 @@ skip: Renderer::StorePixelFormat(new_format); } -bool GetConfig(const int &type) -{ - switch (type) - { - case CONFIG_ISWII: - return SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; - case CONFIG_SHOWEFBREGIONS: - return g_ActiveConfig.bShowEFBCopyRegions; - default: - PanicAlert("GetConfig Error: Unknown Config Type!"); - return false; - } -} - void SetInterlacingMode(const BPCmd &bp) { // TODO -- cgit v1.2.3 From 9d161b4170a5c1df8065895666b8b2c1e06f94e7 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 3 May 2014 17:16:18 -0400 Subject: BPStructs: Consistently put the two shared copy args first And rename them so they make a bit more sense. --- Source/Core/VideoCommon/BPFunctions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/BPFunctions.cpp') diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index a5cb6d9f66..76745e89e0 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -90,8 +90,9 @@ void SetColorMask() g_renderer->SetColorMask(); } -void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, - const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) +void CopyEFB(u32 dstAddr, const EFBRectangle& srcRect, + unsigned int dstFormat, PEControl::PixelFormat srcFormat, + bool isIntensity, bool scaleByHalf) { // bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) if (g_ActiveConfig.bEFBCopyEnable) -- cgit v1.2.3