You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(shader): preserve adjusted sampler table reads during Windows loading - #1681
Source commit: 1aab4aaada5e642ab2caacd4691198b459c90500. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.
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 30cb03d5d47 reproduced 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_table passed 3/3 runs at 1aab4aaa with no validation errors reported. Restoring the base ResourceTracker.cpp with the same test reproduced the runtime-value error. Independent verification by tablefrogpillow
Checklist
Based on current main; no other open PR implements the same functions
One topic per PR; follow-ups go in a new PR
No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
No notes, investigation .md files or images added to the repository (attach them to this PR)
New third-party code is a submodule built from source
Generic behaviour, not specific to one title
Depends on: none
Fixes: none
Unblocks: The Game
GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, NVIDIA 621.14, Windows 11 Pro build 26300 and AMD Radeon RX Vega 56, RADV on Linux
AI-assisted: yes
Summary by CodeRabbit
Bug Fixes
Improved image-sampling consistency when adjusted sampler settings are used, helping ensure results match the expected output.
Tests
Added coverage verifying that adjusted sampler cases complete without faults and produce the same results as the reference case.
No actionable comments were generated in the recent review.
Walkthrough
Changes: Sampler dword 3 canonicalization
Layer / File(s)
Summary
Conditional canonicalization and execution check core/shader/recompiler/Optimization/src/ResourceTracker.cpp, core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
TryMakeTableColumn checks sampler dword 3 through tableSamplerDword3. The helper canonicalizes an OR-valued word only when the handle uses and memory metadata meet the specified conditions. The execution test checks that the modified shader variant does not fault and produces the reference output.
Change: Bug fix
Merge Risk: Minimal · up to 1aab4
This change keeps adjusted sampler-table reads recognizable during shader loading, and the tracker only rewrites the word when every use of the handle is an adjusted sample. The added execution test checks that the adjusted shader runs without a fault and matches the reference output. No merge-blocking risk was found.
Security architecture risk: Minimal · up to 1aab4
The shader recompiler now recognizes adjusted sampler reads without changing which table entry is selected or bypassing the existing descriptor checks.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
⏳ This installation's GitHub REST API quota is critically low (2.9% remaining as of 2026-12-02T23:03:45Z). This hourly window resets at 2026-12-02T23:40:00Z; reviews may be slow or delayed until then.
This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 51d64fa2-c37f-489a-b661-b3b2df6f91e5
Commits
Reviewing files that changed from the base of the PR and between 4131f51 and 1aab4aa.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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