fix(shader): plan a table T# that several image operations share #5550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5550"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-13T23:39:17Z.
What
Crimson Desert (PPSA25286) stops at start-up while it prepares one of its vertex programs:
The program reads a T# from a descriptor table at a wave-uniform key and uses it twice:
TryMakeTableImagealready plans this shape (32-byte entries, a uniform key) as a bindless image table. It refused this one because it requires the eight scalar reads to have no user other than the oneGetImageResourceit is planning.SplitDescriptorPhisruns first. When it finds a Phi in the chain behind a T#, here in the lane condition of thev_cndmask_b32that builds the key, it gives each image operation its own copy of theGetImageResourceover the same eight reads. The query and the sample therefore have two handles, each read has two users, and the table is refused.GetHandlethen rejects the scalar reads with the message above.A read now passes the check when every user is a
GetImageResourcebuilt from exactly these eight reads. Each copy is planned as the same table. Both get the same descriptor source, so the query and the sample share one table image and one set of slots.agc_shader_bindlessgains a case for this: a loop whose counter is part of the key, withimage_get_resinfoandimage_sample_lzon the same table T#. The loop Phi makes the split give the two operations separate copies, as in the title. The case checks that the plan has one table source and one image for both operations, that the capture binds the table slots, and that the program compiles to valid SPIR-V.Instructions of the new case, after the four
s_load_dwordx4the existingwholeCodestarts with:#5188 also targets
GetImageResource dword 0 is not a valid runtime value, for a T# read at an offset the CPU walk can evaluate. With #5188 applied, the title still stops on this shader, because its key is not one the walk can evaluate. #5089 changes the same file for per-lane T#s in waterfall loops, and #1184, #757, #758 and #4475 extend the table planning.tools/pr_overlap.py --branchfinds no overlap with any of them.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
main7a0c838ca:main'sResourceTracker.cppand the new case,agc_shader_bindlessfails with the title's message,GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x00000034(...). With the change it passes.libSceAgcDriverpass on an RTX 4070 Ti (NVIDIA 580.142), the shader and driver tests included.agc_driver_stencil_ref_exportis skipped, as onmain, because the device lacksVK_EXT_shader_stencil_export.agc_shader_replay, fails resource analysis with the message above onmain. With the change,--prepareproduces 36,023 SPIR-V words.--to-inteland run on Linux. Both runs include #5464, #3925 and #5523, which get the title past its earlier stops, and differ only inResourceTracker.cpp:Shader 0x20ac0f4100 could not be prepared after registration).VGT_SHADER_STAGES_EN=0x60212d: combined tessellation and geometry is unsupported by the reference path.-fsyntax-only -Wall -Wextracompile of both changed files has no errors. Its warnings,-Wclass-memaccessfromIrValue.hppand-Wmissing-field-initializersin the test file, are the same onmain.tools/check_conventions.py --base upstream/mainpasses.main34355eeea.agc_shader_bindlessandagc_shader_memorypass in 3 runs each; that run had no baseline without the change.Not checked on a console.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T01:33:13Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL926Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T03:23:11Z.
Windows test of #5550: Windows 10 (19045), MinGW-w64 GCC 15.2, Release,
ninja -j 4, ctest called directly; ctest ran without-V, so the logs of the passing runs do not show which GPU, if any, the tests used (not verified). Tree:main34355eeea+ merge of PR headcd1757e03659f4a363e1b73a2d8a3711808e084b(local merge3d6a86e14, no conflict). Logs:rtx5550_*_N.log,rtx5550_result.txt.2 ctest targets, 3 runs each, exit code 0 in 6 of 6 runs:
agc_shader_bindless,agc_shader_memory.Not tested: that the new or changed tests fail without the change (no baseline run), other ctest targets, the AMD GPU unless named above, Linux, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T03:24:26Z.
Thanks, @xXPBSXx. I've added the Windows run to the description.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T10:26:28Z.
Title evidence: Onimusha: Way of the Sword (PPSA27836 01.000.001, RE Engine), Windows 11 Pro 26200, RTX 5070. On
main0b97f8b9fplus the start-up fixes listed in #5769, it stops preparing pixel programs that read their T# from 48-byte records at +16 (s_buffer_load_dwordx8atkey * 0x30), the key loaded through areadfirstlaneinside a bit-mask loop:A later program reads the same table T# for two image operations. With #5620 and #5550 both merged, both pass and the title stops next at
static bindless image capacity exceeded(#5720). Not run with only one of the two.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T10:27:50Z.
Thanks for the Onimusha run. The later program, with one table T# used by two image operations, is the shape this PR handles (the copies of
GetImageResourcethatSplitDescriptorPhismakes over the same eight reads). The 48-byte records at +16 behind a bit-mask loop sound like #5620's part.AI-assisted: yes