Repository navigation
fix(agc): skip unused pixel stages with retained export formats - #5631
Conversation
be610b6 to
660d2e7
Compare
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Runs for this PR at head
No difference between the two GPUs. AI-assisted (Claude Code). |
|
AMD and NVIDIA runs for this PR at head
No title run. AI-assisted: yes (Claude Code ran the builds and tests). |
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Local changes used to bring Stellar Blade to the main menu on Windows, on top of main 016db92. Not intended for upstream as one commit; the pixel-stage predicate is submitted separately as boykopovar#5631. - AGC: skip unused pixel stages with retained export formats (boykopovar#5631) - AGC: buffer/sampler descriptor and shader-resource handling fixes, oversized-descriptor diagnostics, shader origin tracing - Recompiler: descriptor binding, resource materializer/tracker and SPIR-V image emission changes - VideoOut: optional continue-after-flip-failure and scripted pad input - libc: error handling when cleaning up split Windows read/write aliases Settings used for the menu runs: APS5_FLAT_3D_COLOR_TARGET=1, APS5_CONTINUE_AFTER_FLIP_FAILURE=1, APS5_HOST_IMPORT_MIB=8192, APS5_PREBUILD_THREADS=16. Diagnostic switches, off unless set: APS5_TOLERATE_OVERSIZED_DESCRIPTOR, APS5_TRACE_SHADER_ORIGINS, APS5_DUMP_SHADERS, APS5_SCRIPT_KEYS with APS5_SCRIPT_START_MS, APS5_SCRIPT_INTERVAL_MS and APS5_SCRIPT_HOLD_MS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
660d2e7 to
75083ac
Compare
|
A second title this fixes: Stray (PPSA02100, Unreal Engine 4), Windows 11, RTX 5070, MinGW GCC 15, Release, driven with Enter presses (Cross) and run without a display.
The AI-assisted: yes (Claude Code) |
|
Stray (PPSA02101, the EU version of @p3n1cillin's #5879) on Intel, as @nikowolf123 suggested in #5894. Fedora 44, Intel Arc (Meteor Lake iGPU, Mesa 26.2.3 ANV), Release. Setup.
The extra commits are needed because Stray's post-processing compute programs don't compile in time on ANV (#4977, #5405). Each run holds Enter (Cross) at the calibration screen and goes through the menu into the opening cinematic. It runs in a 12 GiB + 4 GiB swap cgroup (two of the runs with this PR: 13 GiB, no swap) at 0.1 to 0.5 FPS, and I took a screenshot every 30 s.
The table counts only runs that left the main menu. With the PR, five runs went past frame 225. I lost the log of the stopped run on the current stack, so I don't have #5897's line or the context registers for it. In the earlier ones the descriptor was the same T# ( AI-assisted: yes |
|
Rebased onto main myself: the draw-cache test conflicted with #494, so |
75083ac to
b6d9cf8
Compare
b6d9cf8 to
843f7e9
Compare
What
Skip a bound pixel program when it has no enabled consumers or execution requirements, even if
SPI_SHADER_Z_FORMATretains a previous export format. Stellar Blade (PPSA13197 v01.141) issues depth-only draws in this state during loading. Main materializes the retained shader against the next path's unrelated userdata, producing an oversized buffer descriptor and a GPU wait/watchdog failure. In matched runs this is intermittent on main rather than a deterministic boot blocker; see the runtime results below.The captured sequence clears
CB_TARGET_MASK,CB_SHADER_MASK, andDB_SHADER_CONTROL, while retaining Z export format 1 and the preceding pixel program. Full shader-code comparison matched live memory, and the userdata matched the direct command writes. That evidence points to executing an unused stage, rather than stale shader code or corrupted register writes.This change:
COVERAGE_TO_MASK_ENABLEto the existing export/execution mask.DB_ALPHA_TO_MASKis enabled. This is conservative even withALPHA_TO_MASK_DISABLE, because the current Vulkan state decoder does not apply that override.The semantics come from AMD PAL, not a new console hardware measurement:
DbShaderControl, including its explanation of no-consumer PS suppression,SpiShaderZFormat, and GFX10 register definitions. The inferred behavior and alpha-to-coverage limitation are recorded in technical debt.Tested
Controlled comparison on main
2ba3147ac804a2e6e82d558a08f752d6627d4a74(PR head660d2e76a), Windows 11 Pro 10.0.26200, AMD Radeon RX 9070 XT, Windows driver32.0.32015.2008, GCC 15.2.0 UCRT, Release, SPIRV-Tools enabled. A separate worktree contains only this PR's changes; third-party inputs use the existing pinned checkouts. No unrelated local source changes or game settings participate in these tests.Both runs use identical final regression sources. The before run builds
Graphics/src/State.cppexactly from main; the after run recompiles it with this fix.agc_driver_graphicsagc_driver_prepared_graphicsagc_driver_draw_cache_reuseagc_driver_draw_cache_reuse_offagc_driver_register_keyRegression coverage includes formats 0/1/2/3/9; every export/execution bit; valid depth, stencil-reference and sample-mask export combinations; missing execution state; disjoint and high color masks; alpha-to-coverage and its override; and fixed-function depth/stencil operations and clear modes compared with an explicitly unbound pixel program. Preparation uses a nonzero retained address, the captured valid 20-word user SGPR count with 30 unrelated userdata words, a separate poisoned 63-word count, poisoned fragment input/export state, wave32/wave64, linked fragment roles, and draw-time variant reuse. Re-enabling color,
EXEC_ON_NOOP, or alpha-to-coverage restores the real program. The cache regression switches four states over 21 draws and checks four entries and 13 hits, both with and without GPL. Both cache CTest variants now setAPS5_VERIFY_DRAW_RECIPE=1andAPS5_VERIFY_REGISTER_KEYS=1themselves, and the test asserts that fresh-decode verification actually ran with no mismatches, so standard CTest covers it without extra environment.Reproduce with
ANYPS5_GPU="AMD Radeon RX 9070 XT",ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1:cmake --build build --target agc_driver_graphics_tests agc_driver_prepared_graphics_tests agc_driver_draw_cache_reuse_tests agc_driver_register_key_tests ctest --test-dir build -R '^agc_driver_(graphics|prepared_graphics|draw_cache_reuse(_off)?|register_key)$' --output-on-failureFor the failing-before comparison, restore only
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppfrom the base revision in a disposable checkout, rebuild, and run the same command. Restore the PR version afterward. All five focused suites pass with the fix; each finishes below 30 seconds.tools/check_conventions.py --base origin/mainand whitespace checks pass. Sanitized test logs: gist.October 14: matched game runs, main against this PR. Clean
main2ba3147 against this PR's head 660d2e7, Stellar Blade PPSA13197 v01.141, same converted executable. The deployed libraries are identical exceptlibSceAgcDriver.prx(main76d86473…, PRf1dd7aac…), checked by SHA-256 on every run. Each run cleared inheritedAPS5_*/ANYPS5_*variables and set onlyANYPS5_GPU="AMD Radeon RX 9070 XT",APS5_HOST_IMPORT_MIB=8192andANYPS5_SHADER_CACHE_DIR(the run's private seed copy). The runner stopped a game whose private commit exceeded 42,000 MiB or when free memory fell below 3,000 MiB; that never happened. It also setAPS5_COMMIT_LIMIT_MIB/APS5_MIN_FREE_MIB, which AnyPS5 does not read. No tracing, image capture, runner timeout or other local patches were used. Each run started from a private copy of a shared shader-cache seed. Input was manual: only the gift dialog was claimed. The menu was confirmed by eye at the screen, then the game was closed by hand. All main runs of a seed ran before its PR runs; they did not alternate. No builds or tests ran concurrently.Seed 1 (6,818 files, 2,602,396,833 bytes), built by one cold main run, excluded:
guest sampler descriptor uses a secondary LOD bias which is not implementedbuffer descriptor uses an unsupported typeSeed 2 (10,795 files, 5,612,809,177 bytes), the final cache of PR seed-1 run 1:
buffer descriptor uses an unsupported typeMain reached the menu in 2 of 6 runs; this PR in 5 of 6. Three of six main runs ended in a host exception on a malformed descriptor during presentation, followed by
abort(); no PR run did. The failure is intermittent on main, not a deterministic boot blocker.The engine watchdog is Unreal's fixed 120 s
GameThread timed out waiting for RenderThread, followed by a deliberate guest access violation. It hit both builds, and only on seed 1. Seed 1 ends where the cold run stopped, so warm runs on it still compiled about 1,400–1,700 shaders late in loading. Runs on seed 2 added at most 22 cache files, and none hit the watchdog. This change does not address that stall.WAIT_REG_MEMtimeouts (2–5 per run) occurred on both builds with seed 1, including PR runs that reached the menu, and on neither with seed 2. Times are from process creation; "menu by" is when the menu was reported.Every main-only failure was a malformed descriptor, the failure class described in What: on main the retained pixel program reads the next draw's unrelated userdata as its resources. None occurred with this change. The native tests show the mechanism directly; the game runs show the matching outcome, though they did not trace each exception back to a specific draw. No gameplay, cold-cache reliability, other-title, Linux, console or other-GPU claim is made. The original game libraries were restored and hash-checked afterward. Per-run exits, peak commit, wait timeouts, cache totals and the only extracted log lines (paths and addresses removed) are in
runtime-runs.md.Earlier title runs (October 13, other local patches): with
APS5_FLAT_3D_COLOR_TARGET=1,APS5_CONTINUE_AFTER_FLIP_FAILURE=1and 16 prebuild threads, three fresh launches reached the menu. That is not a clean-main comparison; the matched runs above supersede it.Related open #5304 and #5521 address unused stencil export and alpha-to-coverage output support respectively; neither implements this skip predicate, and neither is a dependency.
Checklist
main; no other open PR implements the same fix.mdfiles or images added to the repository🤖 Generated with Claude Code