test(agc): bias the clamped LOD case by -0.75 so NVIDIA's mip switch cannot flip it #23992

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/23992 into main 2026-11-27 05:57:46 +00:00
MichonGoddijn231849 commented 2026-11-20 00:20:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-11-20T00:20:37Z.


What

agc_driver_image_sample_lod_clamp and agc_driver_image_sample_lod_clamp_shader_lane fail on several NVIDIA GPUs with image_sample_d_cl with T# MIN_LOD 256 over BASE_LEVEL 1 with S# MAX_LOD 4095, mip filter 1 and LOD bias -96: thread 2 component 0 is 2.000000, expected 1. That covers the RTX 3070 Ti and RTX 4070 SUPER reported in #23232, and my RTX 5080 on driver 610.74. The cause is the host's nearest-mip choice, not the translation:

  • Lane 2's gradient gives LOD 1.75, and the -96/256 bias brings it to 1.375.
  • Vulkan's rounding reads level 1 there. NVIDIA switches levels near frac(LOD) ≈ 0.29, so it reads level 2.
  • That switch point is in the Mip selection and blending on NVIDIA debt entry, measured on the same RTX 5080 and driver.

This PR changes only that case's bias, from -96 to -192 (-0.75). Every lane's expected LOD then sits a quarter level away from both 0.29 and 0.5, so either rounding gives the same level.

The new bias also covers more. In the shader-clamp lane (APS5_NO_IMAGE_VIEW_MIN_LOD=1 APS5_NO_GPL=1), this case is the only RunAndCheck case with a bias. There, the image_sample_cl lanes clamp at 1 and then add the bias:

  • with -96, clamp-then-bias (0.625) and bias-then-clamp (1.0) both read level 1;
  • with -192, they read levels 0 and 1, so the order is now checked.

Measurement of the switch point: Lyrnc's --lod-bias-probe from #23232, changed locally to sweep the S# bias from -40 to -132 in steps of 4 on lane 2 (gradient-only shader, MIN_LOD 0, BASE_LEVEL 0 and 1, LOD 1.75):

last bias reading level 2 first bias reading level 1
AMD Radeon iGPU (gfx1036) -64 (LOD 1.5) -68
RTX 5080, 610.74 -116 (LOD 1.297) -120 (LOD 1.281)

I also ran candidate biases on both GPUs and both lanes:

Bias Result
-128, -64 Rejected by the fixture's own check: a lane lands on a 0.5 rounding tie
-144, -160 AMD passes; NVIDIA fails image_sample_cl thread 3, where clamp 1 minus 0.5625 or 0.625 leaves a fraction above 0.29
-192 Passes everywhere

Tested

Windows 11 Pro 10.0.26200, MinGW Release build. ctest --test-dir build -R '^agc_driver_image_sample_lod_clamp' -V with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, on main and on this branch:

main NVIDIA main AMD branch NVIDIA branch AMD
Result 0/2 2/2 2/2 2/2
Insert instance layer "VK_LAYER_KHRONOS_validation" 2 2 2 2
was not found but was requested 0 0 0 0
VUID- 0 0 0 0

Negative check: I changed the fixture's expected image_sample_cl level from clamp-then-bias to bias-then-clamp. On AMD, the shader-clamp lane then:

  • fails with -192: image_sample_cl with T# MIN_LOD 256 over BASE_LEVEL 1 ... LOD bias -192: thread 3 component 0 is 1.000000, expected 2;
  • passes with -96.

The image-view lane fails in both cases on its earlier bias-256 case.

The 1D mip blend failure in #23232 (agc_driver_image_plane_address_on_line) is not touched; draft #6221 tracks it. tools/pr_overlap.py: no overlap with open pull requests. Not tested on a PS5.

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 (the two LOD clamp tests of #23232; its 1D mip blend failure remains)
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 610.74, Windows 11 Pro 10.0.26200; AMD Radeon(TM) Graphics (RDNA2 iGPU, gfx1036), driver 32.0.21045.16010, Windows 11 Pro 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5405346900 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23992). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-11-20T00:20:37Z. --- ### What `agc_driver_image_sample_lod_clamp` and `agc_driver_image_sample_lod_clamp_shader_lane` fail on several NVIDIA GPUs with `image_sample_d_cl with T# MIN_LOD 256 over BASE_LEVEL 1 with S# MAX_LOD 4095, mip filter 1 and LOD bias -96: thread 2 component 0 is 2.000000, expected 1`. That covers the RTX 3070 Ti and RTX 4070 SUPER reported in #23232, and my RTX 5080 on driver 610.74. The cause is the host's nearest-mip choice, not the translation: - Lane 2's gradient gives LOD 1.75, and the -96/256 bias brings it to 1.375. - Vulkan's rounding reads level 1 there. NVIDIA switches levels near frac(LOD) ≈ 0.29, so it reads level 2. - That switch point is in the `Mip selection and blending on NVIDIA` debt entry, measured on the same RTX 5080 and driver. This PR changes only that case's bias, from -96 to -192 (-0.75). Every lane's expected LOD then sits a quarter level away from both 0.29 and 0.5, so either rounding gives the same level. The new bias also covers more. In the shader-clamp lane (`APS5_NO_IMAGE_VIEW_MIN_LOD=1 APS5_NO_GPL=1`), this case is the only `RunAndCheck` case with a bias. There, the `image_sample_cl` lanes clamp at 1 and then add the bias: - with -96, clamp-then-bias (0.625) and bias-then-clamp (1.0) both read level 1; - with -192, they read levels 0 and 1, so the order is now checked. Measurement of the switch point: Lyrnc's `--lod-bias-probe` from #23232, changed locally to sweep the S# bias from -40 to -132 in steps of 4 on lane 2 (gradient-only shader, `MIN_LOD` 0, `BASE_LEVEL` 0 and 1, LOD 1.75): | | last bias reading level 2 | first bias reading level 1 | | --- | --- | --- | | AMD Radeon iGPU (gfx1036) | -64 (LOD 1.5) | -68 | | RTX 5080, 610.74 | -116 (LOD 1.297) | -120 (LOD 1.281) | I also ran candidate biases on both GPUs and both lanes: | Bias | Result | | --- | --- | | -128, -64 | Rejected by the fixture's own check: a lane lands on a 0.5 rounding tie | | -144, -160 | AMD passes; NVIDIA fails `image_sample_cl` thread 3, where clamp 1 minus 0.5625 or 0.625 leaves a fraction above 0.29 | | -192 | Passes everywhere | ### Tested Windows 11 Pro 10.0.26200, MinGW Release build. `ctest --test-dir build -R '^agc_driver_image_sample_lod_clamp' -V` with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`, on `main` and on this branch: | | `main` NVIDIA | `main` AMD | branch NVIDIA | branch AMD | | --- | --- | --- | --- | --- | | Result | 0/2 | 2/2 | 2/2 | 2/2 | | `Insert instance layer "VK_LAYER_KHRONOS_validation"` | 2 | 2 | 2 | 2 | | `was not found but was requested` | 0 | 0 | 0 | 0 | | `VUID-` | 0 | 0 | 0 | 0 | **Negative check:** I changed the fixture's expected `image_sample_cl` level from clamp-then-bias to bias-then-clamp. On AMD, the shader-clamp lane then: - fails with -192: `image_sample_cl with T# MIN_LOD 256 over BASE_LEVEL 1 ... LOD bias -192: thread 3 component 0 is 1.000000, expected 2`; - passes with -96. The image-view lane fails in both cases on its earlier bias-256 case. The 1D mip blend failure in #23232 (`agc_driver_image_plane_address_on_line`) is not touched; draft #6221 tracks it. `tools/pr_overlap.py`: no overlap with open pull requests. Not tested on a PS5. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 (the two LOD clamp tests of #23232; its 1D mip blend failure remains) - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 610.74, Windows 11 Pro 10.0.26200; AMD Radeon(TM) Graphics (RDNA2 iGPU, gfx1036), driver 32.0.21045.16010, Windows 11 Pro 10.0.26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-20 06:36:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:36:06Z.

Review: APPROVED


Reviewed — looks good

The reviewed change updates the LOD bias for the reported clamped sampling case; the inspected logic and stated GPU results support merging.

What I ran

Reviewed head 0919e069759a1949941f783e4315d4249ba245aa. I did not run commands or tests; results below are reported by the author.

Results

Check Result Note
NVIDIA and AMD GPU test run not run Author reports both test cases pass on both GPUs after the change.
Negative check not run Author reports the altered expectation fails on AMD with bias -192.
Source review passed Read the changed test and its relevant setup and checking logic.

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author-reported Windows 11, MinGW, Vulkan test runs and GPU measurements were not independently verified. PS5 behavior was not tested. Read description.md, commits.md, manifest.json, diff.patch, and the complete changed file core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cpp; also read the relevant test CMake registration file. files.json was unavailable, so excluded files could not be independently enumerated; the manifest lists one changed file and marks its full text included.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988509820 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23992#pullrequestreview-5988509820). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T06:36:06Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change updates the LOD bias for the reported clamped sampling case; the inspected logic and stated GPU results support merging. ## What I ran Reviewed head `0919e069759a1949941f783e4315d4249ba245aa`. I did not run commands or tests; results below are reported by the author. ## Results | Check | Result | Note | | --- | --- | --- | | NVIDIA and AMD GPU test run | not run | Author reports both test cases pass on both GPUs after the change. | | Negative check | not run | Author reports the altered expectation fails on AMD with bias -192. | | Source review | passed | Read the changed test and its relevant setup and checking logic. | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author-reported Windows 11, MinGW, Vulkan test runs and GPU measurements were not independently verified. PS5 behavior was not tested. Read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, and the complete changed file `core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cpp`; also read the relevant test CMake registration file. `files.json` was unavailable, so excluded files could not be independently enumerated; the manifest lists one changed file and marks its full text included. ## To get this to a good state Nothing is required.
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!23992
No description provided.