From 579db050812ad97d23445663a631d3c4888623e4 Mon Sep 17 00:00:00 2001 From: SP4C3B4R-8 <209078228+SP4C3B4R-8@users.noreply.github.com> Date: Sat, 3 Oct 2026 13:15:28 +0200 Subject: [PATCH] fix(libSceAgcDriver): accept scissors that apply the zero window offset PA_SC_WINDOW_OFFSET is already required to be zero, so a generic, window or viewport scissor whose WINDOW_OFFSET_DISABLE bit is clear selects the same rectangle as one that sets it. Only the reserved bits are still rejected. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018m6Ad8zkQKPKZmyUQK9vfE --- core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp | 2 +- core/libs/prx/libSceAgcDriver/tests/Graphics.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp index cdeb09c36..65ad85685 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp @@ -313,7 +313,7 @@ DecodedColorFormat DecodeColorFormat(std::uint32_t format, std::uint32_t number, void intersect(VkRect2D& result, const Registers& registers, std::uint32_t offset, bool screen) { const auto tl = read(registers, offset); const auto br = read(registers, offset + 1); - if (!screen) Require((tl & 0x80008000u) == 0x80000000u && (br & 0x80008000u) == 0, "scissor window offsets or reserved bits are unsupported"); + if (!screen) Require((tl & 0x8000u) == 0 && (br & 0x80008000u) == 0, "scissor reserved bits are unsupported"); const auto x = tl & 0xffffu; const auto y = (tl >> 16u) & (screen ? 0xffffu : 0x7fffu); const auto right = br & 0xffffu; diff --git a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp index bb5e04d13..adcca892d 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp @@ -113,6 +113,12 @@ void stateTests() { queue.context[0x91] = 0x30020; state = AgcDriver::Graphics::DecodeState(queue); Require(state.scissor.offset.x == 3 && state.scissor.offset.y == 1 && state.scissor.extent.width == 29 && state.scissor.extent.height == 2, "scissor intersection changed"); + queue.context[0x90] = 0x10003; + state = AgcDriver::Graphics::DecodeState(queue); + Require(state.scissor.offset.x == 3 && state.scissor.offset.y == 1 && state.scissor.extent.width == 29 && state.scissor.extent.height == 2, "a scissor that applies the zero window offset changed"); + queue.context[0x90] = 0x80008000; + expectFailure([&] { AgcDriver::Graphics::DecodeState(queue); }, "scissor reserved bits"); + queue.context[0x90] = 0x80010003; queue.context[0x31c] |= 0x10000000; queue.context[0x325] = 0x1234; Require(AgcDriver::Graphics::DecodeState(queue).color.dccAddress == 0x123400, "DCC key address decode changed");