Merge pull request #452 from SP4C3B4R-8/fix/scissor-window-offset

fix(libSceAgcDriver): accept scissors that apply the zero window offset
This commit is contained in:
Dean
2026-10-04 15:48:01 +13:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
@@ -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;
@@ -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");