fix(test): compare linear-mip 1D samples only against DIM 1D #6221

Closed
mitul72 wants to merge 1 commit from upstream-pr/6221 into main
mitul72 commented 2026-10-15 04:50:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T04:50:46Z.


What

The explicit-LOD test added in #5583 checked the linear-mip cases against an absolute blend of the two mip levels (10 + 40 * LOD). The weight a host GPU applies between levels is a property of its filtering, not of the 2D-through-1D path. On an RTX 4090 (NVIDIA 616.92), as reported in #5583, the 2D-through-1D sample and the reference image_sample_l with DIM 1D return the same bits but blend with weight 0.4375 at LOD 1.25 instead of 0.25, so agc_driver_image_plane_address_on_line fails on main there.

The linear-mip cases keep the bit-for-bit comparison with image_sample_l DIM 1D through the same T#, which is what the feature claims. Point sampling keeps its absolute texel and level checks. Test-only change.

Tested

Linux, RX 9060 XT (RADV GFX12): agc_driver_image_plane_address_on_line passes. Not run on NVIDIA here; the failing case is the one reported in #5583.

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
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9060 XT (RADV GFX12), Linux
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4868370244 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221). Originally posted by [mitul72](https://github.com/mitul72) on 2026-10-15T04:50:46Z. --- ### What The explicit-LOD test added in #5583 checked the linear-mip cases against an absolute blend of the two mip levels (`10 + 40 * LOD`). The weight a host GPU applies between levels is a property of its filtering, not of the 2D-through-1D path. On an RTX 4090 (NVIDIA 616.92), as reported in #5583, the 2D-through-1D sample and the reference `image_sample_l` with DIM 1D return the same bits but blend with weight 0.4375 at LOD 1.25 instead of 0.25, so `agc_driver_image_plane_address_on_line` fails on `main` there. The linear-mip cases keep the bit-for-bit comparison with `image_sample_l` DIM 1D through the same T#, which is what the feature claims. Point sampling keeps its absolute texel and level checks. Test-only change. ### Tested Linux, RX 9060 XT (RADV GFX12): `agc_driver_image_plane_address_on_line` passes. Not run on NVIDIA here; the failing case is the one reported in #5583. ### Checklist - [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] Unblocks: none - [x] GPUs tested: AMD Radeon RX 9060 XT (RADV GFX12), Linux - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mitul72 commented 2026-10-15 04:57:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T04:57:18Z.


Marking this as a draft: the same check passed on an RTX 4090 (same driver) at #5583's pre-merge head a98b06534, so something in the merged combination with #5375/#5456 changed what NVIDIA computes for 1D explicit-LOD samples. I'm comparing the generated SPIR-V and sampler/view state between those heads to find the cause instead of relaxing the test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6184754343 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#issuecomment-6184754343). Originally posted by [mitul72](https://github.com/mitul72) on 2026-10-15T04:57:18Z. --- Marking this as a draft: the same check passed on an RTX 4090 (same driver) at #5583's pre-merge head a98b06534, so something in the merged combination with #5375/#5456 changed what NVIDIA computes for 1D explicit-LOD samples. I'm comparing the generated SPIR-V and sampler/view state between those heads to find the cause instead of relaxing the test.
mitul72 commented 2026-10-15 05:47:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-15T05:47:32Z.


Found the likely cause. Between a98b06534 (passes on the 4090) and e52e140f5 (fails), the SPIR-V, samplers and image views for this case are byte-identical. The only difference is that the sampled VkImage is now created with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, from #4487 (sRGB twin views for FORCE_DEGAMMA samplers), for every format that has an sRGB twin, RGBA8 included. RADV is unaffected. @frankea, could you check whether this case returns 60.00 on the 4090 with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT removed from the imageInfo.flags line in Texture::Texture? If it does, NVIDIA blends mip levels differently for every mutable-format texture, and the fix belongs in setting that flag only where an sRGB view is actually needed, not in relaxing this test. cc @Pipodi

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6185405578 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#issuecomment-6185405578). Originally posted by [mitul72](https://github.com/mitul72) on 2026-10-15T05:47:32Z. --- Found the likely cause. Between a98b06534 (passes on the 4090) and e52e140f5 (fails), the SPIR-V, samplers and image views for this case are byte-identical. The only difference is that the sampled `VkImage` is now created with `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT`, from #4487 (sRGB twin views for FORCE_DEGAMMA samplers), for every format that has an sRGB twin, RGBA8 included. RADV is unaffected. @frankea, could you check whether this case returns 60.00 on the 4090 with `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` removed from the `imageInfo.flags` line in `Texture::Texture`? If it does, NVIDIA blends mip levels differently for every mutable-format texture, and the fix belongs in setting that flag only where an sRGB view is actually needed, not in relaxing this test. cc @Pipodi
frankea commented 2026-10-15 22:11:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-15T22:11:18Z.


@mitul72 Ran it. Removing VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT does not change the 4090's result, and neither does reverting #4487 as a whole, so the flag is not the cause.

Windows 11 (26200), RTX 4090 (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON, agc_driver_image_plane_address_on_line with --repeat until-pass:3:

Tree Result
main 31cbb55d7 fails 3 of 3: thread 12 blends the levels to 67.501945, expected 60.000000
main 31cbb55d7 with the SrgbTwinFormat(...) ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0u term removed from imageInfo.flags in Texture::Texture (Texture.cpp:274; the two other MUTABLE_FORMAT sites untouched) fails 3 of 3, same 67.501945
e52e140f5 (the #5583 merge) with #4487 reverted (git revert -m 1 afc8541d1, clean, 8 files) fails 3 of 3, same 67.501945
main 31cbb55d7 + this PR's head a0142ae0b passes 3 of 3

So on this card the value is stable at 67.501945 whatever the image's create flags, and the only thing that changes the verdict is the check itself. Two more facts that narrow where to look:

  • The PR's test and recompiler change are byte-identical before and after its rebase: a98b06534 (parent d1670009f) and e52e140f5 (parent 4808d9c20) differ only in docs/dev/debt/shader.md (fetched a98b06534's patch from the GitHub API, the object is no longer reachable). So @tibzejoker's pass at a98b06534 and the fail at e52e140f5 bracket 411 first-parent merges of main between d1670009f and 4808d9c20, not a change in #5583 itself.
  • Walking that range with the PR's test and recompiler change applied on top (git apply of the test file plus the two-line flatLineExplicitLod change, identical to the PR's) gives the same 67.501945, 3 of 3 each time, at every point: d1670009f (a98b06534's own parent), 9a22507ef (just before #5375), 31d951ede (#5375 merged), 2077b5383 (#5456 merged), and e52e140f5 itself. So on this 4090 the linear-mip check never passed at any base; nothing in main flipped it. The one 4090 pass on record is @tibzejoker's run of a98b06534 on #5583 (same driver, 616.92, a machine that also has an Intel UHD 770 and picks GPUs with ANYPS5_GPU); I cannot reproduce it here, and I do not know what differs. Everything on this box says the 10 + 40 * LOD weight is AMD's and this driver blends 1D mips at 0.4375 for LOD 1.25, which is what this PR's DIM 1D comparison accepts.

Side finding from the same runs: with the flag removed, agc_driver_image_sample_reduction also failed, but it fails on plain main 31cbb55d7 too (min, 2x anisotropic bilinear, point mip: thread 0 sampled 5.000000, expected 17.000000, 2 of 2), so that is a separate NVIDIA failure from #5821, reported there.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6203332827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#issuecomment-6203332827). Originally posted by [frankea](https://github.com/frankea) on 2026-10-15T22:11:18Z. --- @mitul72 Ran it. Removing `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` does not change the 4090's result, and neither does reverting #4487 as a whole, so the flag is not the cause. Windows 11 (26200), RTX 4090 (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 r7 (UCRT), Release, `BUILD_TESTING=ON`, `agc_driver_image_plane_address_on_line` with `--repeat until-pass:3`: | Tree | Result | |---|---| | `main` 31cbb55d7 | fails 3 of 3: `thread 12 blends the levels to 67.501945, expected 60.000000` | | `main` 31cbb55d7 with the `SrgbTwinFormat(...) ? VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT : 0u` term removed from `imageInfo.flags` in `Texture::Texture` (Texture.cpp:274; the two other `MUTABLE_FORMAT` sites untouched) | fails 3 of 3, same 67.501945 | | e52e140f5 (the #5583 merge) with #4487 reverted (`git revert -m 1 afc8541d1`, clean, 8 files) | fails 3 of 3, same 67.501945 | | `main` 31cbb55d7 + this PR's head a0142ae0b | passes 3 of 3 | So on this card the value is stable at 67.501945 whatever the image's create flags, and the only thing that changes the verdict is the check itself. Two more facts that narrow where to look: - The PR's test and recompiler change are byte-identical before and after its rebase: a98b06534 (parent d1670009f) and e52e140f5 (parent 4808d9c20) differ only in `docs/dev/debt/shader.md` (fetched a98b06534's patch from the GitHub API, the object is no longer reachable). So @tibzejoker's pass at a98b06534 and the fail at e52e140f5 bracket 411 first-parent merges of `main` between d1670009f and 4808d9c20, not a change in #5583 itself. - Walking that range with the PR's test and recompiler change applied on top (`git apply` of the test file plus the two-line `flatLineExplicitLod` change, identical to the PR's) gives the same 67.501945, 3 of 3 each time, at every point: d1670009f (a98b06534's own parent), 9a22507ef (just before #5375), 31d951ede (#5375 merged), 2077b5383 (#5456 merged), and e52e140f5 itself. So on this 4090 the linear-mip check never passed at any base; nothing in `main` flipped it. The one 4090 pass on record is @tibzejoker's run of a98b06534 on #5583 (same driver, 616.92, a machine that also has an Intel UHD 770 and picks GPUs with `ANYPS5_GPU`); I cannot reproduce it here, and I do not know what differs. Everything on this box says the `10 + 40 * LOD` weight is AMD's and this driver blends 1D mips at 0.4375 for LOD 1.25, which is what this PR's DIM 1D comparison accepts. Side finding from the same runs: with the flag removed, `agc_driver_image_sample_reduction` also failed, but it fails on plain `main` 31cbb55d7 too (`min, 2x anisotropic bilinear, point mip: thread 0 sampled 5.000000, expected 17.000000`, 2 of 2), so that is a separate NVIDIA failure from #5821, reported there. AI-assisted: yes (Claude Code).
mitul72 commented 2026-10-20 18:02:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mitul72 on 2026-10-20T18:02:19Z.


Thanks @frankea for running it. So the mutable-format flag isn't the cause; I'll look further. I've been a little busy lately, but I'll get back to this today.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297650429 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#issuecomment-6297650429). Originally posted by [mitul72](https://github.com/mitul72) on 2026-10-20T18:02:19Z. --- Thanks @frankea for running it. So the mutable-format flag isn't the cause; I'll look further. I've been a little busy lately, but I'll get back to this today.
MarcZX10 commented 2026-10-21 23:54:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T23:54:22Z.

Review: APPROVED


Reviewed the complete test change and its surrounding coverage. The exact-bit comparison between the 2D-through-1D explicit-LOD path and the DIM 1D reference remains for every component and sampler case; point-filtered cases also retain independent level and texel assertions. Dropping the absolute linear-mip blend expectation is supported by the reported RTX 4090 result, where both paths agree bit-for-bit but the host blend weight differs from that assertion. The updated PR description accurately scopes the test to the behavior being claimed, and the current eligibility, intake, conventions, and report checks pass. The current overlap scan found no overlapping open PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5607644120 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#pullrequestreview-5607644120). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T23:54:22Z. **Review:** APPROVED --- Reviewed the complete test change and its surrounding coverage. The exact-bit comparison between the 2D-through-1D explicit-LOD path and the DIM 1D reference remains for every component and sampler case; point-filtered cases also retain independent level and texel assertions. Dropping the absolute linear-mip blend expectation is supported by the reported RTX 4090 result, where both paths agree bit-for-bit but the host blend weight differs from that assertion. The updated PR description accurately scopes the test to the behavior being claimed, and the current eligibility, intake, conventions, and report checks pass. The current overlap scan found no overlapping open PR.
ligmaSec commented 2026-12-03 18:14:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T18:14:05Z.

Review: COMMENTED


This patch conflicts with current main in ImagePlaneAddressOnLine.cpp. The current test already keeps the bitwise DIM 1D comparison and skips the absolute blend check when TextureLodFidelity::Find identifies a known explicit-LOD remap. A rebase should preserve that coverage for drivers without the remap. If the reported RTX 4090 is still failing, can the test's remap matcher be corrected for that driver?

Source and merge-tree review at a0142ae0bb. The NVIDIA behavior is unverified locally.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6175750198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6221#pullrequestreview-6175750198). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T18:14:05Z. **Review:** COMMENTED --- This patch conflicts with current `main` in `ImagePlaneAddressOnLine.cpp`. The current test already keeps the bitwise DIM 1D comparison and skips the absolute blend check when `TextureLodFidelity::Find` identifies a known explicit-LOD remap. A rebase should preserve that coverage for drivers without the remap. If the reported RTX 4090 is still failing, can the test's remap matcher be corrected for that driver? Source and merge-tree review at `a0142ae0bb`. The NVIDIA behavior is unverified locally. AI-assisted: yes.

Pull request closed

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!6221
No description provided.