From b85b35d5ea6af0dbd7ea74b47e2564a805d9bfe5 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 27 Nov 2021 17:07:02 -0800 Subject: VideoCommon: Create dedicated structs for scissor pos/offset --- Source/Core/VideoCommon/BPStructs.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoCommon/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 503ef6154f..7e5ecf1689 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -815,19 +815,10 @@ std::pair GetBPRegInfo(u8 cmd, u32 cmddata) fmt::to_string(TevStageIndirect{.fullhex = cmddata})); case BPMEM_SCISSORTL: // 0x20 - { - const X12Y12 top_left{.hex = cmddata}; - return std::make_pair(RegName(BPMEM_SCISSORTL), - fmt::format("Scissor Top: {}\nScissor Left: {}", top_left.y, top_left.x)); - } + return std::make_pair(RegName(BPMEM_SCISSORTL), fmt::to_string(ScissorPos{.hex = cmddata})); case BPMEM_SCISSORBR: // 0x21 - { - const X12Y12 bottom_right{.hex = cmddata}; - return std::make_pair( - RegName(BPMEM_SCISSORBR), - fmt::format("Scissor Bottom: {}\nScissor Right: {}", bottom_right.y, bottom_right.x)); - } + return std::make_pair(RegName(BPMEM_SCISSORBR), fmt::to_string(ScissorPos{.hex = cmddata})); case BPMEM_LINEPTWIDTH: // 0x22 return std::make_pair(RegName(BPMEM_LINEPTWIDTH), fmt::to_string(LPSize{.hex = cmddata})); @@ -1002,11 +993,8 @@ std::pair GetBPRegInfo(u8 cmd, u32 cmddata) // TODO: Description case BPMEM_SCISSOROFFSET: // 0x59 - { - const S32X10Y10 xy{.hex = cmddata}; return std::make_pair(RegName(BPMEM_SCISSOROFFSET), - fmt::format("Scissor X offset: {}\nScissor Y offset: {}", xy.x, xy.y)); - } + fmt::to_string(ScissorOffset{.hex = cmddata})); case BPMEM_PRELOAD_ADDR: // 0x60 return DescriptionlessReg(BPMEM_PRELOAD_ADDR); -- cgit v1.2.3 From 076392a0f65fa11b8c3475b762b8b9794057ae11 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 12 Nov 2021 11:48:26 -0800 Subject: VideoCommon: Rework scissor handling This increases accuracy, fixing the white rendering in Major Minor's Majestic March. However, the hardware backends can only have one viewport and scissor rectangle at a time, while sometimes multiple are needed to accurately emulate what is happening. If possible, this will need to be fixed later. --- Source/Core/VideoCommon/BPStructs.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 7e5ecf1689..c6746d444a 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -131,8 +131,6 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future) case BPMEM_SCISSORTL: // Scissor Rectable Top, Left case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right case BPMEM_SCISSOROFFSET: // Scissor Offset - SetScissor(); - SetViewport(); VertexShaderManager::SetViewportChanged(); GeometryShaderManager::SetViewportChanged(); return; @@ -1272,8 +1270,7 @@ void BPReload() // let's not risk actually replaying any writes. // note that PixelShaderManager is already covered since it has its own DoState. SetGenerationMode(); - SetScissor(); - SetViewport(); + SetScissorAndViewport(); SetDepthMode(); SetBlendMode(); OnPixelFormatChange(); -- cgit v1.2.3