fix(shader): plan table S#s of image_sample_a through reserved dword 3 bits #27856
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27856"
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 meh7an on 2026-11-27T15:41:59Z.
What
A direct S# of an
image_sample_aread already drops every value ORed into dword 3 that sets only bits 12-29 (canonicalizeSampleAdjustDword3,samplerDword3ReservedMask = 0x3ffff000). An S# read from a table could not.TryMakeTableColumnneeds each S# dword to be a scalar read, so a table S# whose dword 3 isread | vwas not planned as a table. The sampler then fell back to a direct source and failed withGetSamplerResource dword 0 is not a valid runtime value. The error names dword 0 because validation reports the first dword that is not a runtime value.PlanTableColumnPasspasses whether the use is an_asample (RdnaImageSampleFlagAdjust) toPlanTableColumnandTryMakeTableColumn._asample,TryMakeTableColumnplans dword 3 from its canonical value, the same one a direct S# of that read uses.canonicalizeSampleAdjustDword3can record the ORs it strips. The planned-read check accepts a stripped OR whose users are table handles, so the read stays planning-only and is not left as a GPU read.image_sampleforms are unchanged: a computed dword 3 there is still refused.fix-shader-adjusted-table-sampler-dword3.md. What the console's_aread does with bits 12-29 is not measured, as for direct S#s.Tested
Windows 11 Pro (build 26300), NVIDIA GeForce RTX 2080 Ti, driver 621.40, WinLibs GCC 15.2.0, Release.
verifyAdjustedTableSamplerDword3(runs inagc_shader_bindless):TableWholeCodereads its S# from the per-lane-keyed heap and ORs(ballot & 0xff) << 12into dword 3.image_sample_athe sampler is planned through a sampler table, and all 12 table reads (T# and S#) are planning-only.image_sampleit still fails withGetSamplerResource dword 0 is not a valid runtime value.TryMakeTableColumn, the test fails withGetSamplerResource dword 0 is not a valid runtime value.b464859c1f8and this branch,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the 63ctestentries that runagc_shader_memory_tests,agc_driver_image_table_tests,agc_driver_storage_cache_entries_testsandagc_driver_storage_cache_budget_tests(built withANYPS5_AGC_EXECUTION_TESTS=StorageCacheEntries;ImageTable;StorageCacheBudget).VUID-lines on both. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS. The branch was then rebased ontod309fc274a3; the 46 commits in between change none of the code or test files this PR touches.v_readlane_b32of a per-lane index, twos_buffer_loads) and OR a value built from user data into dword 3 (s_or_b32, bits 12-27) beforeimage_sample_a.0x1060741a00) stopped the run.9e576183ebe, with #27560, #26606 and #27648 (open) and #27649 (merged since), plus local changes the title needs to boot. The offline replay of the dumped request (agc_shader_replay --prepare) failed before and prepares after.Checklist
main; no other open PR implements the same functions.tools/pr_overlap.py --branchfound no conflicting lines with the open pull requests it could compare. Among those it could not compare because they conflict withmain, #20248, #20519, #22424, #10193, #13928 and #13929 add parameters toPlanTableColumn/TryMakeTableColumnor change their call sites, and #9790, #9969, #15555, #18106 and #18107 rewrite the planned-read loop. None of them plans_atable S#s, so whichever lands later only needs a rebaseNotImplemented_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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T15:51:12Z.
Review: COMMENTED
Actionable comments posted: 2
94dd43fc-caa9-4a1f-bef9-cb61a6ece410Reviewing files that changed from the base of the PR and between
9008767802and00ace24e46.core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppdocs/dev/debt/changes/fix-shader-adjusted-table-sampler-dword3.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T15:51:23Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected planner code and regression test support merging.
What I ran
00ace24e4637f78d9ca56c9848556dddfcbd82b9usingrepo_read.py.ResourceTracker.cpparound canonicalization, table planning, table-read classification, and sampler handling; read the added regression test and debt entry.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
ShaderMemory.cppfull text was excluded from the review folder for size. I read the changed test lines throughrepo_read.py.core/shader/recompiler/Optimization/src/ResourceTracker.cpp, changed lines incore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp, anddocs/dev/debt/changes/fix-shader-adjusted-table-sampler-dword3.md. The manifest lists these three changed files; the full test file was excluded, while the other two were included.To get this to a good state
Nothing is required.
Pull request closed