From 0d38698dfecd2e8aa31e74350037ab1321583060 Mon Sep 17 00:00:00 2001 From: Celegans12 <53881228+Celegans12@users.noreply.github.com> Date: Wed, 7 Oct 2026 08:39:13 +0200 Subject: [PATCH] fix(agc): include PA_SU_POLY_OFFSET_CLAMP in the initial context state A draw with depth bias enabled read PA_SU_POLY_OFFSET_CLAMP (context register 0x2df) with read(), but the context bank only held it once the title wrote it. Titles that rely on the reset value had every such draw skipped with "missing register in context bank at DWORD 0x2df". The initial context state, which CLEAR_STATE also restores, now holds the register as 0. That is the value in libSceAgc's own register defaults (sceAgcGetRegisterDefaults2, every version) and in amdgpu's GFX10 clear-state table. A clamp of 0 means no clamping, so it needs no device feature. --- .../prx/libSceAgcDriver/Execution/include/QueueState.hpp | 2 +- core/libs/prx/libSceAgcDriver/tests/Graphics.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp b/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp index 19493fc5e..d66bdb19c 100644 --- a/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp +++ b/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp @@ -151,7 +151,7 @@ inline Registers InitialContextRegisters() { {0x1b1, 0}, {0x1b6, 0}, {0x1c3, 0}, {0x1c4, 0}, {0x1c5, 0}, {0x1ff, 0}, {0x292, 2}, {0x293, 0}, {0x29b, 0}, {0x2ce, 0}, {0x2d3, 0}, {0x2d5, 0}, {0x2d6, 0}, {0x2db, 0}, - {0x2dc, 0xaa00}, {0x2e4, 0}, {0x2f8, 0}, {0x2f9, 0x2d}, + {0x2dc, 0xaa00}, {0x2df, 0}, {0x2e4, 0}, {0x2f8, 0}, {0x2f9, 0x2d}, {0x30e, 0xffffffff}, {0x30f, 0xffffffff}, {0x313, 0x6000}, {0x318, 0}, {0x31b, 0}, {0x31c, 0}, {0x31d, 0}, {0x390, 0}, {0x3b0, 0}, {0x3b8, 0} diff --git a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp index 6e73e36dc..39e72a906 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp @@ -648,6 +648,14 @@ void DepthBoundsBiasTests() { Require(state.depthBias && state.depthBiasConstant == 4.0f, "culled back faces must not constrain the front depth bias"); queue.context[0x2de] = 0x1f0u; expectFailure([&] { AgcDriver::Graphics::DecodeState(queue); }, "units other than the depth format"); + queue.context[0x2de] = 0x1e9u; + auto cleared = queue; + cleared.ClearContext(); + for (const auto& [offset, value] : queue.context) { + if (offset != 0x2dfu) cleared.context[offset] = value; + } + state = AgcDriver::Graphics::DecodeState(cleared); + Require(state.depthBias && state.depthBiasConstant == 4.0f && state.depthBiasClamp == 0.0f, "a depth bias clamp the title never writes must decode as its reset value 0"); } alignas(256) std::array dccKeys{};