fix(shader): preserve adjusted sampler table reads during Windows loading #27779
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27779"
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 lgqdaxia on 2026-11-27T10:39:22Z.
What
A Windows loading draw failed with
GetSamplerResource dword 0 is not a valid runtime value. The shader read a sampler from an indexed table and ORed a lane mask into bits 12–29 of its fourth word before an adjusted image sample. The table recognizer lost the underlying read and sent the descriptor down the runtime-value path.The table recognizer now uses the existing sample-adjust rule. It removes an OR operand only when its possible bits are confined to the reserved field and every consumer of the handle uses adjusted sampling. The selected entry still supplies its filter, LOD and border settings. Original sample-adjust rule
Tested
On Windows, the image-table regression dispatches six workgroups across float, unsigned and signed texture records. The control on main at
30cb03d5d47reproduced the loading error. With the change, its complete GPU readback matched the unmodified table fixture. The Khronos validation layer was active in both runs, with zero validation errors and zero skipped cases.A separate pixel-draw fixture on the bindless development branch selects two different LOD biases from one sampler table. Both the descriptor-set and bindless controls reproduced the error. With the change, both modes produced the expected mip stripe at all 2,048 pixels. In the Windows loading draw that previously failed, the planner recovered a four-word sampler column with 128 records and reported zero malformed records. Bindless development branch
On Linux with RADV and a Radeon RX Vega 56,
agc_driver_image_tablepassed 3/3 runs at1aab4aaawith no validation errors reported. Restoring the baseResourceTracker.cppwith the same test reproduced the runtime-value error. Independent verification by tablefrogpillowChecklist
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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by arcwiser on 2026-11-27T10:40:48Z.
Review: APPROVED
Reviewed the complete two-file diff and surrounding table-planning/direct-sampler paths at
1aab4aaada. The new canonicalization is appropriately conservative: it is limited to sampler dword 3 with a top-level OR, requires every direct handle consumer to be a sampler-taking image instruction using that same handle, and requires every consumer's memory plan to carryRdnaImageSampleFlagAdjust. A shared ordinary-sample consumer therefore leaves the descriptor unchanged. The recovered operand still goes through the existing scalar-read, record-stride, and source validation, while the regression compares the full output against the unmodified table fixture across all existing record classes.Local validation:
git diff --check f73d791b3df4...HEADandpython tools/check_conventions.py --base f73d791b3df4dcaa773297a93f5ae2c062ee95a3passed. I could not run the registered GPU target here: this checkout has no initialized submodules or configured build, andcheck_test_registration.pyaccordingly reports the missingbuild/CMakeCache.txt. The PR's paired main/head Vulkan run and separate bindless fixture provide direct coverage of the affected path. I found no blocking issue.AI-assisted review: yes (Codex); I independently inspected the implementation, regression construction, original sample-adjust rule in #7290, relevant consumers, and local static checks.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T11:35:25Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change based on the inspected code; the described regression test covers adjusted sampler table reads.
What I ran
Reviewed head
1aab4aaada5e642ab2caacd4691198b459c90500from the prepared diff and repository reader context. No tests or build commands were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests, build, or hardware behavior were run. The PR description's reported Windows regression runs were not independently verified. Reviewed files:
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cppandcore/shader/recompiler/Optimization/src/ResourceTracker.cpp. Excluded files: none listed in the manifest;files.jsonwas not available as a review document.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T12:37:44Z.
Review: APPROVED
I read the diff at
1aab4aaada. Windows 11, GCC 15.2, merged intomainatdaa61711afetogether with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_image_table: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.The red check is macOS
frame_capture_minimize_replay, whichmainhas fixed since.Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:02:27Z.
Review: COMMENTED
Could the image-table fixture use the same sampler handle in both an adjusted and an ordinary sample? The added test only exercises the all-adjusted case. The mixed-use fixture would protect the new
handle.Uses()gate against stripping a dword-3 expression when an ordinary use still needs it.Source review at
1aab4aaada. The head trial-merges onto6ef4f2f73b. Focused Linux checks are queued.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T01:31:25Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at head
6347478b25acb6d5a23ffdb5940eff1e940ea3a0preserve sampler table reads for adjusted sampling and retain validation when a sampler also has an ordinary sample use.What I ran
Reviewed every changed line in both files listed under
reviewedinfiles.json, plus the relevant table-planning and sampler-handling code at the pinned head. No tests or builds were run.Reader commands
Results
Negative control
The test change includes a mixed-use case that expects an ordinary sampler use to remain rejected; I did not run that GPU test or its negative control.
Findings
Blocking
None.
Non-blocking
None.
Sources
The table sampler adjustment is guarded by each handle use's sampling flags, then canonicalizes only the sampler dword expression (ResourceTracker.cpp at the reviewed head). Table columns use that result for sampler dword 3 (ResourceTracker.cpp at the reviewed head). The regression adds adjusted-only and mixed ordinary/adjusted cases (ImageTable.cpp at the reviewed head).
Not verified
The Windows and Linux GPU results in the PR description are author-reported and were not reproduced. No other files were excluded by the manifest; both changed files were read.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T04:15:30Z.
Review: APPROVED
Reviewed — looks good
The reviewed change safely removes reserved sample-adjust bits from table-backed sampler reads only when every direct consumer uses adjusted sampling.
What I ran
Reviewed head
dd0f964d16d7314824aa72e3d35490073136280d. No merged-preview check was run. I inspected the prepared diff and full text for both changed files. The pinned reader search found the canonicalization helper, but its logging step failed because the run folder is read-only. No tests or builds were run.Results
Negative control
The mixed-use regression test includes an ordinary-sampling control and checks that mixed adjusted and ordinary uses are rejected. It was not run, so whether the new test fails under a negative control was not confirmed.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The reported Windows and Linux GPU runs were not independently confirmed. No test execution, build, merged-preview check, or console behavior was verified. Both files listed under
reviewedinfiles.jsonwere read;files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-04T16:09:13Z.
Review: APPROVED
Re-verified head
dd0f964d16on Windows 11 with GCC 15.2, applied alone to main484b0368d3. The two new commits extendImageTable.cppwith the mixed-use case. Run withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer(layer 1.4.363).agc_driver_image_tableResourceTracker.cpprevertedThe negative fails with "GetSamplerResource dword 0 is not a valid runtime value" on the adjusted sample. Each log shows the loader inserting the layer, and none has a
VUID-.Not checked: a title.
AI-assisted: yes (Claude Code)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.