fix(agc): accept TRUNC_COORD on unnormalized samplers #12983

Merged
Oscar45397 merged 1 commit from upstream-pr/12983 into main 2026-10-30 09:19:59 +00:00
Oscar45397 commented 2026-10-29 19:20:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Oscar45397 on 2026-10-29T19:20:15Z.


What

An S# with FORCE_UNNORMALIZED and TRUNC_COORD set was refused (guest sampler descriptor uses unnormalized coordinates with TRUNC_COORD, which is not implemented). Skyrim (PPSA03747) stops on it about once in 15 runs.

  • TRUNC_COORD is already accepted and not applied for normalized coordinates. Its debt entry records the RDNA 2 measurement: 1 truncates the scaled coordinate to 8 fractional bits, 0 rounds it. The unnormalized path now treats it the same way, so the host sampler is the one the same S# gets without the bit.
  • With unnormalized coordinates the coordinate is already in texels, and Vulkan's nearest filter takes the floor, which is what truncation gives except within the host's sub-texel rounding of a texel edge. The bilinear weight can differ by the 1/256 texel the existing entry describes.
  • The unnormalized debt entry no longer lists TRUNC_COORD among the bits that throw, and the TRUNC_COORD entry now says it covers both coordinate modes. MC_COORD_TRUNC still throws.

Tested

Windows 11 Home 26200, Ryzen 9 5900X, NVIDIA GeForce RTX 3080 (driver 610.88), WinLibs GCC 15.2.0 r7, Release, on main bb04a4f1ea.

  • GuestSamplerResource.cpp (in agc_driver_graphics): the rejection check is replaced by decoding an unnormalized point and bilinear S# with TRUNC_COORD and requiring the same host sampler as without it.
  • ImageSampleUnnormalized.cpp: the bilinear clamp-to-last-texel, point clamp-to-last-texel and point clamp-to-border samplers are also run with TRUNC_COORD set. Every sample is checked against the CPU reference (floor for point, bilinear weights otherwise) and must equal the sample without the bit.
  • With main's refusal put back, both tests fail on it (uses unnormalized coordinates with TRUNC_COORD, which is not implemented).
  • ctest -R '^(agc_driver_graphics|agc_driver_image_sample_unnormalized|agc_driver_image_sample_shared_sampler|agc_driver_image_sample_vcc_sampler)$' -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation on main bb04a4f1ea and on this branch (head c720a286f7), same machine, 3 runs each: 4 of 4 pass on both in every run. Neither log has a VUID- line, a validation warning or the missing-layer message; VK_LOADER_DEBUG=layer shows the layer inserted in all 3 Vulkan processes of each run on both sides.
  • Overlaps: #11126 rewrites the unnormalized debt entry and the clamp-mode checks next to the removed line. Whichever lands second keeps both changes and drops TRUNC_COORD from that entry's list of bits that throw. #7085 edits the FORCE_UNNORMALIZED debt entry just above these two lines; the edits do not touch the same text, so a merge only needs both kept.
  • No title was run.

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
  • 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: PPSA03747 #11508
  • GPUs tested: NVIDIA GeForce RTX 3080, driver 32.0.16.1088, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5074189672 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12983). Originally posted by [Oscar45397](https://github.com/Oscar45397) on 2026-10-29T19:20:15Z. --- ### What An S# with `FORCE_UNNORMALIZED` and `TRUNC_COORD` set was refused (`guest sampler descriptor uses unnormalized coordinates with TRUNC_COORD, which is not implemented`). Skyrim (PPSA03747) stops on it about once in 15 runs. - `TRUNC_COORD` is already accepted and not applied for normalized coordinates. Its debt entry records the RDNA 2 measurement: 1 truncates the scaled coordinate to 8 fractional bits, 0 rounds it. The unnormalized path now treats it the same way, so the host sampler is the one the same S# gets without the bit. - With unnormalized coordinates the coordinate is already in texels, and Vulkan's nearest filter takes the floor, which is what truncation gives except within the host's sub-texel rounding of a texel edge. The bilinear weight can differ by the 1/256 texel the existing entry describes. - The unnormalized debt entry no longer lists `TRUNC_COORD` among the bits that throw, and the `TRUNC_COORD` entry now says it covers both coordinate modes. `MC_COORD_TRUNC` still throws. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Home 26200, Ryzen 9 5900X, NVIDIA GeForce RTX 3080 (driver 610.88), WinLibs GCC 15.2.0 r7, Release, on `main` bb04a4f1ea. - `GuestSamplerResource.cpp` (in `agc_driver_graphics`): the rejection check is replaced by decoding an unnormalized point and bilinear S# with `TRUNC_COORD` and requiring the same host sampler as without it. - `ImageSampleUnnormalized.cpp`: the bilinear clamp-to-last-texel, point clamp-to-last-texel and point clamp-to-border samplers are also run with `TRUNC_COORD` set. Every sample is checked against the CPU reference (floor for point, bilinear weights otherwise) and must equal the sample without the bit. - With `main`'s refusal put back, both tests fail on it (`uses unnormalized coordinates with TRUNC_COORD, which is not implemented`). - `ctest -R '^(agc_driver_graphics|agc_driver_image_sample_unnormalized|agc_driver_image_sample_shared_sampler|agc_driver_image_sample_vcc_sampler)$' -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` on `main` bb04a4f1ea and on this branch (head c720a286f7), same machine, 3 runs each: 4 of 4 pass on both in every run. Neither log has a `VUID-` line, a validation warning or the missing-layer message; `VK_LOADER_DEBUG=layer` shows the layer inserted in all 3 Vulkan processes of each run on both sides. - Overlaps: #11126 rewrites the unnormalized debt entry and the clamp-mode checks next to the removed line. Whichever lands second keeps both changes and drops `TRUNC_COORD` from that entry's list of bits that throw. #7085 edits the `FORCE_UNNORMALIZED` debt entry just above these two lines; the edits do not touch the same text, so a merge only needs both kept. - No title was run. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA03747 #11508 - [x] GPUs tested: NVIDIA GeForce RTX 3080, driver 32.0.16.1088, Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-29 22:06:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T22:06:03Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The sampler change and targeted GPU evidence are scoped and documented, but the PR still has unresolved overlap with #7085 and #11126 without an agreed order or matching Depends on declaration.

What I ran

Exact head: c720a286f73b445764803744e53072fea12236d3; base branch: main at d820fef1827f27247cd28da7b4eec7891904bae5. The merge preview against current main is clean (1dba04aa5e1d0922fa8d83562759ac1fcbbc5387). Environment: Linux x86_64; no build or CTest run.

git diff --check upstream/main...refs/review/pr-12983-head
python3 tools/check_conventions.py --base upstream/main
git merge-tree --write-tree upstream/main refs/review/pr-12983-head
git merge-tree --write-tree refs/review/pr-12983-head refs/review/pr-11126-head
git merge-tree --write-tree refs/review/pr-12983-head refs/review/pr-7085-head

Results

Check Result
Diff whitespace check Pass; no output.
Repository conventions Pass on the exact PR head.
Merge preview against current main Clean.
Pairwise merge preview with #11126 Content conflicts in GuestSamplerResource.cpp and docs/dev/debt/libSceAgcDriver.md.
Pairwise merge preview with #7085 Content conflict in docs/dev/debt/libSceAgcDriver.md.
Hosted CI Windows, conventions, eligibility, intake, labels and report pass; Linux and specialized jobs skipped.
Focused GPU tests The PR author reports four focused tests passed 3/3 on both main and this head on an RTX 3080 with Vulkan validation enabled. I did not independently rerun them.
Exact pairwise merge conflict output
#11126
CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp
CONFLICT (content): Merge conflict in docs/dev/debt/libSceAgcDriver.md
#7085
CONFLICT (content): Merge conflict in docs/dev/debt/libSceAgcDriver.md

Negative control

Assertion Change in the control Result
The focused tests detect the current rejection of unnormalized TRUNC_COORD The author reports restoring the rejection from main on both main and the change Author reports both affected tests fail with the expected rejection. I did not rerun this control.

Findings

Blocking

The overlap workflow lists #7085 and #11126 as conflicting PRs, and pairwise merge previews confirm the conflicts. The current checklist says Depends on: none, while the repository requires authors to agree on ordering for overlapping PRs and declare it with Depends on. Please coordinate the order with both authors and update the checklist to the agreed dependencies (or document the agreement and why no dependency is required); I will re-check the combined merge state afterward. Pinned contribution rule

Non-blocking

The added GPU checks establish the behavior on the reported NVIDIA setup. They do not independently establish console behavior; the updated debt entry keeps the precision difference and unmeasured host-driver behavior documented. No title was run, as stated in the PR.

Sources

Not verified

I did not build or run CTest, repeat the reported GPU tests, or verify behavior on a console or another GPU vendor. Linux and specialized hosted CI jobs were skipped.

To get this to a good state

Please coordinate merge order with the authors of #7085 and #11126, then update Depends on to reflect that agreement. I will rerun the pairwise merge previews and static checks on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5705588755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12983#pullrequestreview-5705588755). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T22:06:03Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The sampler change and targeted GPU evidence are scoped and documented, but the PR still has unresolved overlap with #7085 and #11126 without an agreed order or matching `Depends on` declaration. ## What I ran Exact head: `c720a286f73b445764803744e53072fea12236d3`; base branch: `main` at `d820fef1827f27247cd28da7b4eec7891904bae5`. The merge preview against current `main` is clean (`1dba04aa5e1d0922fa8d83562759ac1fcbbc5387`). Environment: Linux x86_64; no build or CTest run. ```sh git diff --check upstream/main...refs/review/pr-12983-head python3 tools/check_conventions.py --base upstream/main git merge-tree --write-tree upstream/main refs/review/pr-12983-head git merge-tree --write-tree refs/review/pr-12983-head refs/review/pr-11126-head git merge-tree --write-tree refs/review/pr-12983-head refs/review/pr-7085-head ``` ## Results | Check | Result | |---|---| | Diff whitespace check | Pass; no output. | | Repository conventions | Pass on the exact PR head. | | Merge preview against current `main` | Clean. | | Pairwise merge preview with #11126 | Content conflicts in `GuestSamplerResource.cpp` and `docs/dev/debt/libSceAgcDriver.md`. | | Pairwise merge preview with #7085 | Content conflict in `docs/dev/debt/libSceAgcDriver.md`. | | Hosted CI | Windows, conventions, eligibility, intake, labels and report pass; Linux and specialized jobs skipped. | | Focused GPU tests | The PR author reports four focused tests passed 3/3 on both main and this head on an RTX 3080 with Vulkan validation enabled. I did not independently rerun them. | <details> <summary>Exact pairwise merge conflict output</summary> ```text #11126 CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp CONFLICT (content): Merge conflict in docs/dev/debt/libSceAgcDriver.md #7085 CONFLICT (content): Merge conflict in docs/dev/debt/libSceAgcDriver.md ``` </details> ## Negative control | Assertion | Change in the control | Result | |---|---|---| | The focused tests detect the current rejection of unnormalized `TRUNC_COORD` | The author reports restoring the rejection from `main` on both `main` and the change | Author reports both affected tests fail with the expected rejection. I did not rerun this control. | ## Findings ### Blocking The overlap workflow lists #7085 and #11126 as conflicting PRs, and pairwise merge previews confirm the conflicts. The current checklist says `Depends on: none`, while the repository requires authors to agree on ordering for overlapping PRs and declare it with `Depends on`. Please coordinate the order with both authors and update the checklist to the agreed dependencies (or document the agreement and why no dependency is required); I will re-check the combined merge state afterward. [Pinned contribution rule](https://github.com/boykopovar/AnyPS5/blob/d820fef1827f27247cd28da7b4eec7891904bae5/CONTRIBUTING.md#L69) ### Non-blocking The added GPU checks establish the behavior on the reported NVIDIA setup. They do not independently establish console behavior; the updated debt entry keeps the precision difference and unmeasured host-driver behavior documented. No title was run, as stated in the PR. ## Sources - [Changed sampler decoder at this PR head](https://github.com/boykopovar/AnyPS5/blob/c720a286f73b445764803744e53072fea12236d3/core/libs/prx/libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp) - [Changed focused GPU test at this PR head](https://github.com/boykopovar/AnyPS5/blob/c720a286f73b445764803744e53072fea12236d3/core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleUnnormalized.cpp) - [Contribution overlap rule pinned to current main](https://github.com/boykopovar/AnyPS5/blob/d820fef1827f27247cd28da7b4eec7891904bae5/CONTRIBUTING.md#L69) ## Not verified I did not build or run CTest, repeat the reported GPU tests, or verify behavior on a console or another GPU vendor. Linux and specialized hosted CI jobs were skipped. ## To get this to a good state Please coordinate merge order with the authors of #7085 and #11126, then update `Depends on` to reflect that agreement. I will rerun the pairwise merge previews and static checks on the new head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12983
No description provided.