Repository navigation
fix(agc): include the polygon offset scale and offset registers in the initial context state - #23816
Conversation
|
Ran it on NVIDIA. The description covers an AMD RX 6800 only. Setup
Arms
Command ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
VK_LOADER_LAYERS_DISABLE=~implicit~ \
ctest -V -R '^agc_driver_(graphics|pm4([a-z0-9_]*)|depth_bias_per_face([a-z_]*))$'34 tests: Results
Not tested: Hogwarts Legacy itself, and the wider set of 70 programs from the description. Run and written up with AI assistance. |
|
NVIDIA Linux run with the Khronos validation layer of the current head Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
The pattern covers the new decode case ( Negative control: this PR's tests with No new AI-assisted: yes (Claude Code) |
|
Results from another title ID of the game, on Linux with NVIDIA. I tested your Hogwarts Legacy (PPSA01603, 01.000.013), Ubuntu 26.04.1 (kernel 7.0), RTX 4070 Ti on NVIDIA 615.71, i7-13700K, GCC 15.2 Release. 600 s runs with the same scripted presses through the Accessibility screen, the EULA and the reward screens.
Update (11-20, 3:15 AM PST): with this route, all 9 On all three Update (11-25, 6:10 PM PST): the head is now AI-assisted: yes |
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the inspected code and provided evidence support merging.
What I ran
Reviewed head 61640c56c2c16149bdf7ae2feb488f0240e2decf. No commands or tests were run; repo_read.py was used to inspect the prepared bundle and targeted source ranges.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Initialization and decode paths inspected |
| Tests | not run | Results in the PR description were author supplied |
| Other reviewed files | passed | Debt note and changed test hunk inspected |
Findings
Blocking
None.
Non-blocking
None.
Sources
The added defaults are in core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp:233. The depth-bias decoder reads these values in core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:619-631; ClearStateContextRegisters derives its values from BuildInitialContextRegisters in core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp:272-278. The new regression case is at core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:3624-3634.
Not verified
The full text for core/libs/prx/libSceAgcDriver/tests/Graphics.cpp was excluded from the review folder, so only the changed range was read through repo_read.py. Other excluded-file details could not be checked because review/files.json was not available via the reader. The author's test runs and game behavior reports were not independently reproduced. No programmatic checks were run.
To get this to a good state
Nothing is required.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
61640c5 to
3ac761e
Compare
|
@birdmarty I added a run of the rebased head on current AI-assisted: yes |
…e initial context state A draw with depth bias on both faces compares the front and back PA_SU_POLY_OFFSET scale and offset registers (context registers 0x2e0-0x2e3) with read(), but the context bank only held them once the title wrote them. Titles that set only one face's pair had every such draw fail with "missing register in context bank at DWORD 0x2e2". Hogwarts Legacy (PPSA01593) writes only the front pair and stopped on the black screen before character creation. The initial context state, which CLEAR_STATE also restores, now holds the four registers as 0, the value in amdgpu's GFX10 clear-state table, as was done for PA_SU_POLY_OFFSET_CLAMP. A face whose pair was never written then draws without bias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3ac761e to
26aab4f
Compare
What
A draw with depth bias on both faces reads the front and back polygon offset registers,
PA_SU_POLY_OFFSET_FRONT_SCALE/_OFFSETandPA_SU_POLY_OFFSET_BACK_SCALE/_OFFSET(context0x2e0-0x2e3), withread()indecodeDepthBias. The context bank only held them once the title wrote them, so a title that sets one face's pair and relies on the reset value of the other stopped with:Hogwarts Legacy (PPSA01593 v01.000.013) does this. It stopped on the black screen before character creation. A diagnostic build counted every write to
0x2de-0x2e3and every context clear, push, pop and queue reset over one run:FRONT_SCALEandFRONT_OFFSET: 274,062 writes each, all throughSET_CONTEXT_REG_INDIRECT;BACK_SCALEandBACK_OFFSET: no writes, on any queue;The failing draws had
PA_SU_SC_MODE_CNTL0x1a40(no culling, depth bias on both faces) and a 16-bit depth target, with front values 48/2 and 128/4. So the driver did not lose a value; the title never sets the back pair.The initial context state, which
CLEAR_STATEand a push-clearCONTEXT_STATEalso restore, now holds the four registers as 0. That is their value in amdgpu's GFX10 clear-state table (clearstate_gfx10.hL747-L751), the table #1086 used forPA_SU_POLY_OFFSET_CLAMP(0x2df) next to them. libSceAgc's register defaults list0x2deand0x2dfbut not these four. A face whose pair was never written now draws without bias. With the front pair written, such a draw takes the existing per-face path from #1924: front faces biased, back faces not. The console's reset value is not measured; the debt fragment records that.What stays the same: the initial registers seed a queue's context,
CLEAR_STATE, a push-clearCONTEXT_STATEand the decoding of a registered shader's state, and a written value replaces them.decodeDepthBiasis the only reader of0x2e0-0x2e3. So the change only affects a draw that reads one of them before the title writes it: such a draw stopped, and now draws without bias on that face. Nothing hashes or walks the whole initial set.Changes
Execution/include/QueueState.hpp:0x2e0-0x2e3start at 0 inBuildInitialContextRegisters.tests/Graphics.cpp: after fix(agc): include PA_SU_POLY_OFFSET_CLAMP in the initial context state #1086's clamp case, a cleared context where only one face's pair was written, withPA_SU_SC_MODE_CNTL0x1a40, must decode per face with the other face's slope and constant 0, once for each face. Without theQueueState.hppchange it stops withmissing register in context bank.docs/dev/debt/changes/fix-agc-poly-offset-initial-state.md: the reset value comes from the GFX10 clear-state table and is not measured on a console.Tested
Windows 11 Pro (build 26300), MinGW-w64 GCC 15.3.0, Release build with tests, AMD Radeon RX 6800.
Tests on
main(d2082a7) and this change, same machine and GPU. The set has 70 test programs:agc_driver_graphics_tests(the new decode case);agc_driver_pm4_testsandagc_driver_pm4_replay_tests(theCLEAR_STATEand context-stack checks that compare against the initial registers);agc_driver_depth_bias_per_face_tests(per-face depth bias draws on the GPU);mainANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(1.4.363),VK_LOADER_DEBUG=layer,ctest -VInsert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requested by env var VK_INSTANCE_LAYERSVUID-linespublic_headersEvery failure is one
mainalso has, and none is in the depth bias, PM4 or graphics tests:agc_driver_msaa_dcc_unwatchfails in every run on this machine, the open AGC (NVIDIA RTX 4060, Windows): agc_driver_msaa_dcc_unwatch refuses its 8-sample FMASK case after the DCC range turns compared #22930 and agc_driver_msaa_dcc_unwatch fails on NVIDIA RTX 5080 (610.88) and passes on an AMD iGPU of the same machine #22931.agc_storage_write_back_host_retilefails now and then in a parallel run. It failed once onmainhere and passes when run alone.agc_driver_recorderfails with the validation layer on both sides. Onmain(d7be678), run alone with the layer, it failed 3 of 5 times.The seven skips are the same on both sides: Linux-only imports and comparisons, and two label-order tests.
agc_shader_memory_testsdoes not link with this toolchain on either side (ld: .rsrc merge failure: multiple non-default manifests), so its tests are not counted.With
main'sQueueState.hpp, the new case inagc_driver_graphicsfails withAGC graphics: missing register in context bank at DWORD 0x2e0 (736).Rebased onto
origin/main0af6efa as 26aab4f (identicalcore/diff to 61640c5 and 3ac761e, to trigger a fresh Windows CI run after the 90-minute timeout):agc_driver_graphics,agc_driver_pm4,agc_driver_pm4_replay, andagc_driver_depth_bias_per_face*pass 6 / 6 on bothorigin/main0af6efa and 26aab4f with 3 Khronos validation layer inserts and 0VUID-lines;check_conventionsanddebt_fold --checkpass.tools/check_conventions.py --base origin/mainandtools/debt_fold.py --check: passed.tools/pr_overlap.py: no open pull request changes the same lines. 33 that conflict withmainshare files and could not be compared; the six of those that touchQueueState.hpp(#1395, #20845, #22434, #22535, #22647, #22687) do not touch the polygon offset registers.Hogwarts Legacy (PPSA01593 v01.000.013), #23362, same machine, on an earlier
main(6efc0f7) with #20827:vertex fetch exceeds descriptor record count: OOB_SELECT 2, stride 12, NUM_RECORDS 83, vertex index 114. That is fix(agc): follow RDNA 2's range checks for strided vertex fetches with OOB_SELECT 2 and 3 #9915's case and unrelated to this change.An outside data point on Linux and NVIDIA, on another release of the game (PPSA01603, 01.000.013, RTX 4070 Ti, NVIDIA 615.71):
mainstopped at 539 s on the samemissing register in context bank at DWORD 0x2e2 (738), and with this change's commit it ran the full 600 s to character creation (#23362 comment).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)mainand this change, no new VUIDs🤖 Generated with Claude Code