fix(agc): apply a T# MIN_LOD in the shader where the image view clamp mishandles image_sample_d_cl #16953

Open
sherySJ wants to merge 12 commits from upstream-pr/16953 into main
sherySJ commented 2026-11-08 01:11:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sherySJ on 2026-11-08T01:11:01Z.


Cause: with a Mesa ANV view clamp, plain Grad, explicit Lod, any S# bias or sampler minLod sample correctly (0 wrong in a standalone probe on the HD 520); Grad plus a MinLod operand, which is image_sample_d_cl, returns max(operand, view clamp) and drops the gradient LOD (292 of 1800 sampled levels wrong on the HD 520, all of them Grad plus MinLod; llvmpipe 0 of 1800). @Lucke0051 found the mechanism on a UHD 630 (Mesa 26.2.6, comment): Intel's compiler lowers Grad plus MinLod to an explicit-LOD sample whose LOD is max(log2(|gradient| * textureSize(0)), MinLod), and on a view with minLod of 1 or more ANV returns 0 from OpImageQuerySizeLod and OpImageQueryLevels, so the gradient term is log2(0) and only the clamps remain. The same zero size reaches QueryDimensions on the image view lane; the shader lane leaves the view unclamped, so the probe's switch avoids that too.
The test's expectation and our use of the extension are right: Vulkan's level selection is d' = max(level_base + clamp(λ, 0, q), minLod_imageView) with λ raised to max(sampler.minLod, MinLod operand), so this is an ANV deviation, not a wrong expectation.
Design: a startup probe, like the float-controls probes, runs image_sample_d_cl through the recompiler and takes the existing shader lane (T# clamp folded into the MinLod operand, view left unclamped) only when its clamp-free control matches and a clamped run differs; a driver-ID gate would stay on after Mesa fixes it and would miss other Intel parts and Windows drivers.
The shader lane was off with graphics pipeline libraries because fragment registration modules have no specialization constants for the per-image clamp; they now read it from the T# words already in their runtime image metadata and the per-draw plan still validates it, so pipeline libraries stay on.
Not fixed: ANV adds an S# bias after a gradient sample's clamp operand (both lanes, recorded in docs/dev/debt/shader.md), and an image table entry with a clamp is refused on a device without VK_EXT_image_view_min_lod.

What

VulkanDevice.cpp:1931 enabled the view clamp whenever the device advertised it, with no behavioural probe, and VulkanDevice.cpp:2157 kept the shader lane out of every pipeline-library device. On the HD 520 agc_driver_image_sample_lod_clamp failed with image_sample_d_cl with T# MIN_LOD 512 over BASE_LEVEL 0 ... thread 3 component 0 is 2.000000, expected 3, the line Arrow Lake reports in #15817.

  • Execution/src/ImageViewMinLodProbe.cpp (new) samples a mipmapped 2D texture with image_sample_d_cl in 32 lanes, once without a clamp (control) and over BASE_LEVEL 0 and 1 with MIN_LOD 512, and compares each lane with the Vulkan level.
  • VulkanDevice.cpp:2735 (branch) runs it after the float probes; when the control matches and a clamped run differs it sets imageViewMinLod false and shaderImageMinLod true, refreshes the cached graphics context, and VulkanDevice::Target (:4599) now carries the flag. The probe clears the cached textures it made. APS5_NO_IMAGE_VIEW_MIN_LOD_PROBE skips it.
  • shaderImageMinLod no longer requires pipeline libraries off (VulkanDevice.cpp:2158).
  • SpirvImageEmitter.cpp:51 (RuntimeMinLodClamp) computes the relative clamp from T# words 1, 3 and 5 in the runtime image metadata for registration modules; the Fail that rejected them is gone. DescriptorBindingBuilder.cpp:463 runs RequireShaderMinLod for registration modules too and pushes the MinLodBase specialization constant only for the others, so a registered fragment artifact is reused across different MIN_LOD values.
  • Tests: new agc_driver_image_sample_lod_clamp_pixel draws image_sample_d_cl through a pixel shader for nine T# MIN_LOD, base level, gradient and clamp combinations and checks the registered fragment artifact is reused; agc_driver_image_sample_lod_clamp_pixel_shader_lane and agc_driver_image_sample_lod_clamp_shader_lane_pipeline_library force the shader lane with pipeline libraries on. The dead "graphics pipeline libraries keep minimum LODs out of the shader" skip and its test accessor are removed.
  • Docs: ARCHITECTURE.md (T# minimum LOD), ENVIRONMENT.md (the new variable, and the APS5_NO_IMAGE_VIEW_MIN_LOD row no longer says pipeline libraries must be off), debt/shader.md (new entry for the two gaps above).

No cache key or serializer format changed (shaderImageMinLod is already in the request key and serialized request).

Refs: #15817 (it lists four failures; this changes only the T# MIN_LOD one: the f32 denormal flush, f64 frexp and mesh v_interp_mov failures are untouched)

Tested

Linux 7.2.8 (Omarchy, Arch), GCC 16.2.1, Release, -j2, one machine, base 210676ad86; the numbers below ran on 0f147e329f, 22 commits earlier, which touch none of the files this changes (git merge-tree is clean), and the rebased branch was rebuilt and re-ran the lod clamp tests, agc_driver_storage_cache_budget and agc_driver_prepared_graphics on both GPUs. Windows not tested.

Negative control, ANYPS5_GPU=<gpu> ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -V -R agc_driver_image_sample_lod_clamp:

main this change
HD 520 agc_driver_image_sample_lod_clamp fails, ... thread 3 component 0 is 2.000000, expected 3 passes (probe: 19 of 64 differ, shader lane)
HD 520 agc_driver_image_sample_lod_clamp_pixel fails, ... gradient LOD of 2.75 and a clamp of 1.0 from T# MIN_LOD 512 over BASE_LEVEL 0: pixel 0,0 samples level 2, expected 3 passes
HD 520 ..._shader_lane (non-pipeline-library lane, already on main) passes passes
llvmpipe, all of them pass pass (probe: 0 of 64 differ, image view lane kept)

Validation layer (Khronos 1.4.363.0 from the extra package, loaded without root, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation) on the same focused set, 24 tests on main (with this change's new pixel test source added so it could run there) and 26 with this change (two more shader-lane variants, ..._shader_lane_pipeline_library and ..._pixel_shader_lane): agc_driver_image_sample_*, agc_driver_graphics, agc_driver_graphics_maps_fallback, agc_driver_prepared_graphics*, agc_shader_disk_cache*. Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and both contain 0 VUID- lines on both devices.

focused set, layer on main this change
HD 520 22 of 24 pass (lod_clamp, lod_clamp_pixel fail) 26 of 26 pass
llvmpipe 24 of 24 pass 26 of 26 pass

Whole ctest -R '^agc_driver_' --timeout 90 sweep on the HD 520 with this change (1029 tests, 485 s, 33 skipped): 9 fail, all known Intel or build artefacts: agc_driver_f32_denormal_flush, agc_driver_f64_rounding_denormal_modes, agc_driver_packed_float_blend, agc_driver_sample_multisample_target, the four agc_driver_native_color_initial_nonuniform* (capability gaps on Gen9, not touched here) and agc_driver_guest_memory_lifetime_converted (its libGuestMemoryFixture.prx target is not built). agc_driver_image_sample_lod_clamp no longer fails. An earlier build of this change failed agc_driver_storage_cache_budget because the probe left its sampled textures in the cache; clearing them after the probe fixed that, and the final sweep passes it.

Probe cost: 16 to 28 ms at device creation on both GPUs. A standalone Vulkan program (R32F texture whose texel is its mip level, nearest mips, 90 combinations of view minLod, bias, sampler minLod and sample form, 20 lanes each) reproduces the ANV behaviour outside AnyPS5: 292 of 1800 sampled levels are wrong on the HD 520, all of them Grad plus MinLod; 0 on llvmpipe.

Overlap

Base 210676ad86. No open PR implements this change. python3 -I claims.py check-branch HEAD lists textual neighbours; git merge-tree of this head with each:

  • #10867 (fix(shader): preserve compute implicit LOD and quad inputs): conflicts in tests/execution/ImageSampleLodClamp.cpp (both edit main's lane arguments and skip messages); whichever lands second rebases that test.
  • #15719 and #9508: conflict in VulkanDevice.cpp (a probe or feature added at the same place in the constructor, and ARCHITECTURE.md at its end for #15719); mechanical.
  • #16935: conflict on the adjacent line of docs/dev/debt/shader.md.
  • #12790, #14964: merge cleanly. With both merged, #12790's agc_driver_image_gather_lod passes on a UHD 630, but its T# MIN_LOD cases skip saying the device has no VK_EXT_image_view_min_lod when this probe has turned imageViewMinLod off; if #12790 lands first, this branch rewords that skip when it merges main.

Review round (adriadam10 and oneandonlydean on f03972b197): merged main 27b8778d4f into the branch (plain merge, two "both sides add" conflicts), then three commits. A sampled image table entry with a MIN_LOD keeps the image view clamp on a device the probe switched (it gets its own cached view, and is refused only without VK_EXT_image_view_min_lod); a direct derivative sample gets the MinLod operand only for a non-zero clamp, so an unclamped image_sample_d is sample_d again on the HD 520 (INTEL_DEBUG=cs: 8 sample_d where it was 4 sample_l plus 4 resinfo); and the Texture.cpp message no longer mentions graphics pipeline libraries. New tests: agc_driver_image_table_min_lod, and a SPIR-V lane check in agc_driver_image_sample_lod_clamp, each failing with its fix reverted. Rerun on the Intel HD Graphics 520 (switched) and llvmpipe with the validation layer 1.4.363, ctest -R 'image_sample_lod_clamp|image_table_min_lod' -V 3 times each: 6 of 6 passed every run, 0 VUID- and 0 SYNC-HAZARD; public_headers and the conventions check pass.

Review follow-up: APS5_NO_IMAGE_VIEW_MIN_LOD no longer takes the extension capability away. VulkanDevice.cpp kept imageViewMinLodExtension equal to the environment-filtered imageViewMinLod, so forcing the shader lane left VK_EXT_image_view_min_lod disabled at device creation and a sampled image table entry with a clamp was refused (ShaderResources.cpp, cachedTableTexture). The extension is now enabled whenever the device supports it and the variable (like the probe) only turns the view lane off, so a table entry keeps its view clamp in a cached view of its own on the shader lane. A device without the extension still refuses a clamped table entry. New agc_driver_image_table_min_lod_shader_lane fails with the fix reverted and passes on the HD 520 and llvmpipe, with the validation layer on and 0 VUID-; the lod clamp and table min LOD tests pass with and without the variable.

Sparse levels on a switched device: @Script-hpp asked on an Intel Arc B390 (Xe3) whether the sparse path should also accept the shader lane (https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7085230943). It stays on the image view lane: the shader lane clamps only the sample instructions that get the MinLod operand, while guest image fetches (OpImageFetch with an explicit mip) and ordinary gathers have none, so they could read a level the sparse path leaves unmapped. A device the probe switches therefore commits every mip of a T# MIN_LOD texture, as main already does on a device without VK_EXT_image_view_min_lod; dac2bcc778 records this in the debt entry and makes agc_driver_texture_sparse_levels skip with sparse level residency requires the image-view MinLod lane; the shader MinLod lane keeps every level committed. Rerun with the validation layer 1.4.363: the HD 520 (switched, and with the shader lane forced) skips with the new message; llvmpipe skips with the shader lane forced and keeps on the view lane a memory assertion failure that is the same at f97c5ec5d0 before this commit (sparse and fully mapped both 2,796,160 bytes); 0 VUID-.

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 (Refs: #15817)
  • Unblocks: none
  • GPUs tested: Intel HD Graphics 520 (Skylake GT2), Mesa 26.2.5 ANV, Vulkan 1.4.354, Linux; llvmpipe (LLVM 23.1.3, 256 bits), Mesa 26.2.5, Linux. Windows not tested. Reported by others in the thread: Intel UHD Graphics 630 (CML GT2), Mesa 26.2.6 ANV, Linux (probe takes the shader lane, agc_driver_image_sample_lod_clamp now passes); NVIDIA RTX 3070 and RTX 3070 Ti, Linux (probe keeps the image view lane, all five lod clamp tests pass; Doorriiaann reran the RTX 3070 at f97c5ec5d0 with the new edge cases, 3 of 3, https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7080050864); Intel Arc B390 (Xe3), Mesa 26.2.7 ANV, Linux (probe takes the shader lane, the 8 LOD tests pass 3 of 3, Script-hpp, https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7085230943).
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5207478529 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953). Originally posted by [sherySJ](https://github.com/sherySJ) on 2026-11-08T01:11:01Z. --- Cause: with a Mesa ANV view clamp, plain `Grad`, explicit `Lod`, any S# bias or sampler minLod sample correctly (0 wrong in a standalone probe on the HD 520); `Grad` plus a `MinLod` operand, which is `image_sample_d_cl`, returns max(operand, view clamp) and drops the gradient LOD (292 of 1800 sampled levels wrong on the HD 520, all of them `Grad` plus `MinLod`; llvmpipe 0 of 1800). @Lucke0051 found the mechanism on a UHD 630 (Mesa 26.2.6, [comment](https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-6763645827)): Intel's compiler lowers `Grad` plus `MinLod` to an explicit-LOD sample whose LOD is `max(log2(|gradient| * textureSize(0)), MinLod)`, and on a view with `minLod` of 1 or more ANV returns 0 from `OpImageQuerySizeLod` and `OpImageQueryLevels`, so the gradient term is `log2(0)` and only the clamps remain. The same zero size reaches `QueryDimensions` on the image view lane; the shader lane leaves the view unclamped, so the probe's switch avoids that too. The test's expectation and our use of the extension are right: Vulkan's level selection is `d' = max(level_base + clamp(λ, 0, q), minLod_imageView)` with λ raised to max(`sampler.minLod`, `MinLod` operand), so this is an ANV deviation, not a wrong expectation. Design: a startup probe, like the float-controls probes, runs `image_sample_d_cl` through the recompiler and takes the existing shader lane (T# clamp folded into the `MinLod` operand, view left unclamped) only when its clamp-free control matches and a clamped run differs; a driver-ID gate would stay on after Mesa fixes it and would miss other Intel parts and Windows drivers. The shader lane was off with graphics pipeline libraries because fragment registration modules have no specialization constants for the per-image clamp; they now read it from the T# words already in their runtime image metadata and the per-draw plan still validates it, so pipeline libraries stay on. Not fixed: ANV adds an S# bias after a gradient sample's clamp operand (both lanes, recorded in `docs/dev/debt/shader.md`), and an image table entry with a clamp is refused on a device without `VK_EXT_image_view_min_lod`. ### What `VulkanDevice.cpp:1931` enabled the view clamp whenever the device advertised it, with no behavioural probe, and `VulkanDevice.cpp:2157` kept the shader lane out of every pipeline-library device. On the HD 520 `agc_driver_image_sample_lod_clamp` failed with `image_sample_d_cl with T# MIN_LOD 512 over BASE_LEVEL 0 ... thread 3 component 0 is 2.000000, expected 3`, the line Arrow Lake reports in #15817. - `Execution/src/ImageViewMinLodProbe.cpp` (new) samples a mipmapped 2D texture with `image_sample_d_cl` in 32 lanes, once without a clamp (control) and over BASE_LEVEL 0 and 1 with MIN_LOD 512, and compares each lane with the Vulkan level. - `VulkanDevice.cpp:2735` (branch) runs it after the float probes; when the control matches and a clamped run differs it sets `imageViewMinLod` false and `shaderImageMinLod` true, refreshes the cached graphics context, and `VulkanDevice::Target` (`:4599`) now carries the flag. The probe clears the cached textures it made. `APS5_NO_IMAGE_VIEW_MIN_LOD_PROBE` skips it. - `shaderImageMinLod` no longer requires pipeline libraries off (`VulkanDevice.cpp:2158`). - `SpirvImageEmitter.cpp:51` (`RuntimeMinLodClamp`) computes the relative clamp from T# words 1, 3 and 5 in the runtime image metadata for registration modules; the `Fail` that rejected them is gone. `DescriptorBindingBuilder.cpp:463` runs `RequireShaderMinLod` for registration modules too and pushes the `MinLodBase` specialization constant only for the others, so a registered fragment artifact is reused across different MIN_LOD values. - Tests: new `agc_driver_image_sample_lod_clamp_pixel` draws `image_sample_d_cl` through a pixel shader for nine T# MIN_LOD, base level, gradient and clamp combinations and checks the registered fragment artifact is reused; `agc_driver_image_sample_lod_clamp_pixel_shader_lane` and `agc_driver_image_sample_lod_clamp_shader_lane_pipeline_library` force the shader lane with pipeline libraries on. The dead "graphics pipeline libraries keep minimum LODs out of the shader" skip and its test accessor are removed. - Docs: `ARCHITECTURE.md` (T# minimum LOD), `ENVIRONMENT.md` (the new variable, and the `APS5_NO_IMAGE_VIEW_MIN_LOD` row no longer says pipeline libraries must be off), `debt/shader.md` (new entry for the two gaps above). No cache key or serializer format changed (`shaderImageMinLod` is already in the request key and serialized request). Refs: #15817 (it lists four failures; this changes only the T# MIN_LOD one: the f32 denormal flush, f64 frexp and mesh `v_interp_mov` failures are untouched) ### Tested Linux 7.2.8 (Omarchy, Arch), GCC 16.2.1, Release, `-j2`, one machine, base `210676ad86`; the numbers below ran on `0f147e329f`, 22 commits earlier, which touch none of the files this changes (`git merge-tree` is clean), and the rebased branch was rebuilt and re-ran the lod clamp tests, `agc_driver_storage_cache_budget` and `agc_driver_prepared_graphics` on both GPUs. Windows not tested. Negative control, `ANYPS5_GPU=<gpu> ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -V -R agc_driver_image_sample_lod_clamp`: | | main | this change | |---|---|---| | HD 520 `agc_driver_image_sample_lod_clamp` | fails, `... thread 3 component 0 is 2.000000, expected 3` | passes (probe: 19 of 64 differ, shader lane) | | HD 520 `agc_driver_image_sample_lod_clamp_pixel` | fails, `... gradient LOD of 2.75 and a clamp of 1.0 from T# MIN_LOD 512 over BASE_LEVEL 0: pixel 0,0 samples level 2, expected 3` | passes | | HD 520 `..._shader_lane` (non-pipeline-library lane, already on main) | passes | passes | | llvmpipe, all of them | pass | pass (probe: 0 of 64 differ, image view lane kept) | Validation layer (Khronos 1.4.363.0 from the extra package, loaded without root, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`) on the same focused set, 24 tests on main (with this change's new pixel test source added so it could run there) and 26 with this change (two more shader-lane variants, `..._shader_lane_pipeline_library` and `..._pixel_shader_lane`): `agc_driver_image_sample_*`, `agc_driver_graphics`, `agc_driver_graphics_maps_fallback`, `agc_driver_prepared_graphics*`, `agc_shader_disk_cache*`. Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and both contain 0 `VUID-` lines on both devices. | focused set, layer on | main | this change | |---|---|---| | HD 520 | 22 of 24 pass (`lod_clamp`, `lod_clamp_pixel` fail) | 26 of 26 pass | | llvmpipe | 24 of 24 pass | 26 of 26 pass | Whole `ctest -R '^agc_driver_' --timeout 90` sweep on the HD 520 with this change (1029 tests, 485 s, 33 skipped): 9 fail, all known Intel or build artefacts: `agc_driver_f32_denormal_flush`, `agc_driver_f64_rounding_denormal_modes`, `agc_driver_packed_float_blend`, `agc_driver_sample_multisample_target`, the four `agc_driver_native_color_initial_nonuniform*` (capability gaps on Gen9, not touched here) and `agc_driver_guest_memory_lifetime_converted` (its `libGuestMemoryFixture.prx` target is not built). `agc_driver_image_sample_lod_clamp` no longer fails. An earlier build of this change failed `agc_driver_storage_cache_budget` because the probe left its sampled textures in the cache; clearing them after the probe fixed that, and the final sweep passes it. Probe cost: 16 to 28 ms at device creation on both GPUs. A standalone Vulkan program (R32F texture whose texel is its mip level, nearest mips, 90 combinations of view minLod, bias, sampler minLod and sample form, 20 lanes each) reproduces the ANV behaviour outside AnyPS5: 292 of 1800 sampled levels are wrong on the HD 520, all of them `Grad` plus `MinLod`; 0 on llvmpipe. ### Overlap Base `210676ad86`. No open PR implements this change. `python3 -I claims.py check-branch HEAD` lists textual neighbours; `git merge-tree` of this head with each: - #10867 (`fix(shader): preserve compute implicit LOD and quad inputs`): conflicts in `tests/execution/ImageSampleLodClamp.cpp` (both edit `main`'s lane arguments and skip messages); whichever lands second rebases that test. - #15719 and #9508: conflict in `VulkanDevice.cpp` (a probe or feature added at the same place in the constructor, and `ARCHITECTURE.md` at its end for #15719); mechanical. - #16935: conflict on the adjacent line of `docs/dev/debt/shader.md`. - #12790, #14964: merge cleanly. With both merged, #12790's `agc_driver_image_gather_lod` passes on a UHD 630, but its T# `MIN_LOD` cases skip saying the device has no `VK_EXT_image_view_min_lod` when this probe has turned `imageViewMinLod` off; if #12790 lands first, this branch rewords that skip when it merges `main`. Review round (adriadam10 and oneandonlydean on f03972b197): merged `main` 27b8778d4f into the branch (plain merge, two "both sides add" conflicts), then three commits. A sampled image table entry with a MIN_LOD keeps the image view clamp on a device the probe switched (it gets its own cached view, and is refused only without VK_EXT_image_view_min_lod); a direct derivative sample gets the `MinLod` operand only for a non-zero clamp, so an unclamped `image_sample_d` is `sample_d` again on the HD 520 (`INTEL_DEBUG=cs`: 8 `sample_d` where it was 4 `sample_l` plus 4 `resinfo`); and the `Texture.cpp` message no longer mentions graphics pipeline libraries. New tests: `agc_driver_image_table_min_lod`, and a SPIR-V lane check in `agc_driver_image_sample_lod_clamp`, each failing with its fix reverted. Rerun on the Intel HD Graphics 520 (switched) and llvmpipe with the validation layer 1.4.363, `ctest -R 'image_sample_lod_clamp|image_table_min_lod' -V` 3 times each: 6 of 6 passed every run, 0 `VUID-` and 0 `SYNC-HAZARD`; `public_headers` and the conventions check pass. Review follow-up: `APS5_NO_IMAGE_VIEW_MIN_LOD` no longer takes the extension capability away. `VulkanDevice.cpp` kept `imageViewMinLodExtension` equal to the environment-filtered `imageViewMinLod`, so forcing the shader lane left `VK_EXT_image_view_min_lod` disabled at device creation and a sampled image table entry with a clamp was refused (`ShaderResources.cpp`, `cachedTableTexture`). The extension is now enabled whenever the device supports it and the variable (like the probe) only turns the view lane off, so a table entry keeps its view clamp in a cached view of its own on the shader lane. A device without the extension still refuses a clamped table entry. New `agc_driver_image_table_min_lod_shader_lane` fails with the fix reverted and passes on the HD 520 and llvmpipe, with the validation layer on and 0 `VUID-`; the lod clamp and table min LOD tests pass with and without the variable. Sparse levels on a switched device: @Script-hpp asked on an Intel Arc B390 (Xe3) whether the sparse path should also accept the shader lane (https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7085230943). It stays on the image view lane: the shader lane clamps only the sample instructions that get the `MinLod` operand, while guest image fetches (`OpImageFetch` with an explicit mip) and ordinary gathers have none, so they could read a level the sparse path leaves unmapped. A device the probe switches therefore commits every mip of a T# MIN_LOD texture, as `main` already does on a device without `VK_EXT_image_view_min_lod`; dac2bcc778 records this in the debt entry and makes `agc_driver_texture_sparse_levels` skip with `sparse level residency requires the image-view MinLod lane; the shader MinLod lane keeps every level committed`. Rerun with the validation layer 1.4.363: the HD 520 (switched, and with the shader lane forced) skips with the new message; llvmpipe skips with the shader lane forced and keeps on the view lane a memory assertion failure that is the same at f97c5ec5d0 before this commit (sparse and fully mapped both 2,796,160 bytes); 0 `VUID-`. ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none (Refs: #15817) - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> Intel HD Graphics 520 (Skylake GT2), Mesa 26.2.5 ANV, Vulkan 1.4.354, Linux; llvmpipe (LLVM 23.1.3, 256 bits), Mesa 26.2.5, Linux. Windows not tested. Reported by others in the thread: Intel UHD Graphics 630 (CML GT2), Mesa 26.2.6 ANV, Linux (probe takes the shader lane, `agc_driver_image_sample_lod_clamp` now passes); NVIDIA RTX 3070 and RTX 3070 Ti, Linux (probe keeps the image view lane, all five lod clamp tests pass; Doorriiaann reran the RTX 3070 at `f97c5ec5d0` with the new edge cases, 3 of 3, https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7080050864); Intel Arc B390 (Xe3), Mesa 26.2.7 ANV, Linux (probe takes the shader lane, the 8 LOD tests pass 3 of 3, Script-hpp, https://github.com/boykopovar/AnyPS5/pull/16953#issuecomment-7085230943). - [x] AI-assisted: <!-- yes / no --> yes
adriadam10 commented 2026-11-12 00:40:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-12T00:40:53Z.

Review: CHANGES_REQUESTED


The probe approach holds up: a clamp-free control, point filters, the view lane kept when inconclusive, and the measurements on the HD 520 and UHD 630 back the diagnosis. Two regressions on the devices it switches are still open (both raised by @oneandonlydean on f03972b197, no reply or push since), plus one small leftover:

  • Graphics/src/ShaderResources.cpp:6269: a sampled image table entry with a MIN_LOD is now refused once imageViewMinLod is turned off, where on main it sampled through the clamped view. Bindless titles on Intel would start faulting on those entries. The extension is still enabled after the switch, so table entries can keep the view clamp and only direct images take the shader lane.
  • SpirvImageEmitter.cpp (the Grad|MinLod emission, :1882/:1887): the shader lane adds a MinLod operand to every direct derivative sample, even with a clamp of 0. @Lucke0051 compiled it on the UHD 630 (INTEL_DEBUG=cs): Grad|MinLod with MinLod 0 (constant, spec constant or buffer value) becomes resinfo + sample_l, plain Grad stays sample_d. So image_sample_d on unclamped textures loses anisotropic filtering there. Emit MinLod only when the clamp is non-zero (a branch on the specialization constant; registration modules read it at run time, so the branch stays in the shader).
  • Graphics/src/Texture.cpp:331: the message still says "without graphics pipeline libraries".

Please also add a test pinning the first two (a table entry with a MIN_LOD on the switched device, and the clamp-0 sample using the plain gradient path where that can be observed).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5867276945 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-5867276945). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-12T00:40:53Z. **Review:** CHANGES_REQUESTED --- The probe approach holds up: a clamp-free control, point filters, the view lane kept when inconclusive, and the measurements on the HD 520 and UHD 630 back the diagnosis. Two regressions on the devices it switches are still open (both raised by @oneandonlydean on f03972b197, no reply or push since), plus one small leftover: - `Graphics/src/ShaderResources.cpp:6269`: a sampled image table entry with a MIN_LOD is now refused once `imageViewMinLod` is turned off, where on `main` it sampled through the clamped view. Bindless titles on Intel would start faulting on those entries. The extension is still enabled after the switch, so table entries can keep the view clamp and only direct images take the shader lane. - `SpirvImageEmitter.cpp` (the `Grad|MinLod` emission, `:1882`/`:1887`): the shader lane adds a `MinLod` operand to every direct derivative sample, even with a clamp of 0. @Lucke0051 compiled it on the UHD 630 (`INTEL_DEBUG=cs`): `Grad|MinLod` with `MinLod` 0 (constant, spec constant or buffer value) becomes `resinfo` + `sample_l`, plain `Grad` stays `sample_d`. So `image_sample_d` on unclamped textures loses anisotropic filtering there. Emit `MinLod` only when the clamp is non-zero (a branch on the specialization constant; registration modules read it at run time, so the branch stays in the shader). - `Graphics/src/Texture.cpp:331`: the message still says "without graphics pipeline libraries". Please also add a test pinning the first two (a table entry with a MIN_LOD on the switched device, and the clamp-0 sample using the plain gradient path where that can be observed).
kurexw commented 2026-11-17 01:37:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-17T01:37:48Z.

Review: COMMENTED


Tested on an Apple M4 alongside #20030, in four variants with the same tests and environment.

Setup: Apple M4, macOS 27.2, MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1, x86-64 build under Rosetta 2. This device reports samplerMipLodBias = false (portability subset).

Base and variants:

Tests: the 29 GPU tests that fail on main on this Mac, via ctest --test-dir build -R '<those 29>' -V, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer. Three runs per variant. Each run logged Insert instance layer "VK_LAYER_KHRONOS_validation" 32 times (layer 1.4.363) and never the missing-layer message.

base #20030 #16953 both
agc_driver_image_sample_lod_bias_sum Failed Passed Failed Passed
agc_driver_image_sample_lod_clamp Failed Passed Failed Passed
agc_driver_image_sample_lod_clamp_shader_lane Failed Passed Failed Passed
VUID-VkSamplerCreateInfo-samplerMipLodBias-04467 per run 6 0 6 0
VUID-VkDeviceCreateInfo-sType-unique per run (Recorder test device, fixed separately in #21965) 4 4 4 4
other 25 tests fail same same same

One of the 25 is timing-dependent here. agc_driver_label_after_import_copy fails as "round N: a CPU read after the label that followed the copy found 64 of 262144 destination bytes not yet copied" on every variant, including the base:

base #20030 #16953 both
failed / runs (all runs I made) 5/23 5/13 14/19 3/3

It is not a test either PR targets, and it fails on the base too. I'm listing it because #16953 fails it noticeably more often on this machine. I can't tell from these counts whether that comes from the change or from timing.

Not tested: Linux, Windows or another GPU.

Result for this PR: on its own, it changes none of the three LOD tests on this device. They still fail with the same wrong levels, and the six samplerMipLodBias-04467 errors remain. With #20030 added, the three tests pass, the same as #20030 alone. So I can't see a MoltenVK case in this set that needs this PR's MIN_LOD path; the device where image_sample_d_cl mishandles the view clamp may simply not be this one. This PR merges cleanly onto current main (939d3630ed); I tested it at its own merge-base.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5931203191 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-5931203191). Originally posted by [kurexw](https://github.com/kurexw) on 2026-11-17T01:37:48Z. **Review:** COMMENTED --- Tested on an Apple M4 alongside #20030, in four variants with the same tests and environment. **Setup:** Apple M4, macOS 27.2, MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1, x86-64 build under Rosetta 2. This device reports `samplerMipLodBias = false` (portability subset). **Base and variants:** - #20030 conflicts with `main` at 939d3630ed, in `RequestSerializer.cpp`, `RequestSerializerTests.cpp` and `ShaderMemory.cpp`. - #16953's commits don't cherry-pick onto #20030's merge-base (0f4538fa02), but both PRs merge cleanly onto #16953's merge-base, 27b8778d4f (2026-11-16). - So every variant is built on 27b8778d4f, with no conflict resolved by hand: - **base**: 27b8778d4f - **#20030**: 27b8778d4f merged with the #20030 head (412ade6415) - **#16953**: the #16953 head (edac4156bd) - **both**: the #16953 head merged with #20030 - None of this was run on current `main`. **Tests:** the 29 GPU tests that fail on `main` on this Mac, via `ctest --test-dir build -R '<those 29>' -V`, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `VK_LOADER_DEBUG=layer`. Three runs per variant. Each run logged `Insert instance layer "VK_LAYER_KHRONOS_validation"` 32 times (layer 1.4.363) and never the missing-layer message. | | base | #20030 | #16953 | both | | --- | --- | --- | --- | --- | | `agc_driver_image_sample_lod_bias_sum` | Failed | **Passed** | Failed | **Passed** | | `agc_driver_image_sample_lod_clamp` | Failed | **Passed** | Failed | **Passed** | | `agc_driver_image_sample_lod_clamp_shader_lane` | Failed | **Passed** | Failed | **Passed** | | `VUID-VkSamplerCreateInfo-samplerMipLodBias-04467` per run | 6 | **0** | 6 | **0** | | `VUID-VkDeviceCreateInfo-sType-unique` per run (Recorder test device, fixed separately in #21965) | 4 | 4 | 4 | 4 | | other 25 tests | fail | same | same | same | One of the 25 is timing-dependent here. `agc_driver_label_after_import_copy` fails as "round N: a CPU read after the label that followed the copy found 64 of 262144 destination bytes not yet copied" on every variant, including the base: | | base | #20030 | #16953 | both | | --- | --- | --- | --- | --- | | failed / runs (all runs I made) | 5/23 | 5/13 | 14/19 | 3/3 | It is not a test either PR targets, and it fails on the base too. I'm listing it because #16953 fails it noticeably more often on this machine. I can't tell from these counts whether that comes from the change or from timing. Not tested: Linux, Windows or another GPU. **Result for this PR:** on its own, it changes none of the three LOD tests on this device. They still fail with the same wrong levels, and the six `samplerMipLodBias-04467` errors remain. With #20030 added, the three tests pass, the same as #20030 alone. So I can't see a MoltenVK case in this set that needs this PR's `MIN_LOD` path; the device where `image_sample_d_cl` mishandles the view clamp may simply not be this one. This PR merges cleanly onto current `main` (939d3630ed); I tested it at its own merge-base.
MarcZX10 commented 2026-11-19 04:58:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T04:58:41Z.

Review: COMMENTED


Reviewed — comments

Changes are ready for review, but the changed device setup leaves the image view minimum LOD extension disabled when APS5_NO_IMAGE_VIEW_MIN_LOD forces the shader lane, so image table entries with a clamp cannot be handled as described.

What I ran

Inspected the prepared diff at head edac4156bd24cd79a862dd2b85ee35f7dff9d386 and read the relevant device initialization, table texture lookup, shader emission, and binding validation code through repo_read.py. I did not run tests or build commands. Test results in the PR description are author-reported.

Results

Check Result Note
Source review passed Main changed paths inspected
Build and tests not run Author reports focused and sweep results
Windows behavior not run Description says Windows was not tested

Findings

Blocking

None verified.

Non-blocking

  • VulkanDevice.cpp:1980 sets imageViewMinLodExtension from imageViewMinLod, which is already false when APS5_NO_IMAGE_VIEW_MIN_LOD is set. The shader-lane table path calls cachedTableTexture, which requires imageViewMinLodExtension for a clamped table entry (ShaderResources.cpp:1725). As a result, on a device supporting the extension, forcing the shader lane also makes a clamped image table entry fail, despite the environment variable documentation saying it only disables the view lane. Preserve the extension capability separately from the environment-filtered enable flag.

Not verified

  • VulkanDevice.cpp, ShaderResources.cpp, and Texture.cpp full texts were excluded from files/ due to size; relevant ranges were read through repo_read.py.
  • files.json was unavailable through the reader, so the exclusion list is based on manifest.json.
  • No build, tests, validation-layer run, Windows run, or physical-console behavior was verified by this review.
  • Other files marked included in manifest.json were not fully read; the review focused on hunks and their directly touched paths.

To get this to a good state

Nothing is required. Optional: track extension support independently of whether the image view lane is selected, so a forced shader lane can still retain the extension for clamped image table entries.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5969549963 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-5969549963). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T04:58:41Z. **Review:** COMMENTED --- # Reviewed — comments Changes are ready for review, but the changed device setup leaves the image view minimum LOD extension disabled when `APS5_NO_IMAGE_VIEW_MIN_LOD` forces the shader lane, so image table entries with a clamp cannot be handled as described. ## What I ran Inspected the prepared diff at head `edac4156bd24cd79a862dd2b85ee35f7dff9d386` and read the relevant device initialization, table texture lookup, shader emission, and binding validation code through `repo_read.py`. I did not run tests or build commands. Test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Main changed paths inspected | | Build and tests | not run | Author reports focused and sweep results | | Windows behavior | not run | Description says Windows was not tested | ## Findings ### Blocking None verified. ### Non-blocking - `VulkanDevice.cpp:1980` sets `imageViewMinLodExtension` from `imageViewMinLod`, which is already false when `APS5_NO_IMAGE_VIEW_MIN_LOD` is set. The shader-lane table path calls `cachedTableTexture`, which requires `imageViewMinLodExtension` for a clamped table entry (`ShaderResources.cpp:1725`). As a result, on a device supporting the extension, forcing the shader lane also makes a clamped image table entry fail, despite the environment variable documentation saying it only disables the view lane. Preserve the extension capability separately from the environment-filtered enable flag. ## Not verified - `VulkanDevice.cpp`, `ShaderResources.cpp`, and `Texture.cpp` full texts were excluded from `files/` due to size; relevant ranges were read through `repo_read.py`. - `files.json` was unavailable through the reader, so the exclusion list is based on `manifest.json`. - No build, tests, validation-layer run, Windows run, or physical-console behavior was verified by this review. - Other files marked included in `manifest.json` were not fully read; the review focused on hunks and their directly touched paths. ## To get this to a good state Nothing is required. Optional: track extension support independently of whether the image view lane is selected, so a forced shader lane can still retain the extension for clamped image table entries.
MarcZX10 commented 2026-11-19 07:18:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T07:18:16Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 2e6d79773abdb6373a6a11df8c58bceb1a5faefc using the prepared diff and repo_read.py. No commands or tests were run in this review; test results in the description are author-reported.

Results

Check Result Note
Diff and changed code passed Targeted review completed
Tests in this review not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No changed-file paths were excluded by files.json (that file was unavailable through the reader); the manifest marks VulkanDevice.cpp, ShaderResources.cpp, and Texture.cpp as too large for the review folder, and I read targeted ranges from them through the pinned reader. I did not read every full changed file or run tests, so the review is incomplete for an approval decision. The description's reported test runs and platform behavior were not independently verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5970843969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-5970843969). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T07:18:16Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `2e6d79773abdb6373a6a11df8c58bceb1a5faefc` using the prepared diff and `repo_read.py`. No commands or tests were run in this review; test results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code | passed | Targeted review completed | | Tests in this review | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No changed-file paths were excluded by `files.json` (that file was unavailable through the reader); the manifest marks `VulkanDevice.cpp`, `ShaderResources.cpp`, and `Texture.cpp` as too large for the review folder, and I read targeted ranges from them through the pinned reader. I did not read every full changed file or run tests, so the review is incomplete for an approval decision. The description's reported test runs and platform behavior were not independently verified. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-19 11:57:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T11:57:42Z.

Review: COMMENTED


Reviewed — no blocking findings

The reviewed portions of head 491a15b8e474f7d939d5eba58239a784582d91cc show no verified blocking defect, but the review is incomplete because several changed files were not read in full.

What I ran

Read the prepared review bundle and targeted source ranges through repo_read.py. No build or test command was run.

Results

Check Result Note
Source review not run Partial review only
Build and tests not run No commands run
Negative control not run Not independently reproduced

Findings

Blocking

None verified in the portions reviewed.

Non-blocking

None.

Not verified

Read the description, commits, manifest, diff, and targeted ranges from VulkanDevice.cpp, Texture.cpp, ShaderResources.cpp, DescriptorBindingBuilder.cpp, and SpirvImageEmitter.cpp. The diff also exposed the new probe and tests, but I did not read all their full head files. Other changed files listed in the manifest were not read. VulkanDevice.cpp, ShaderResources.cpp, and Texture.cpp were excluded from the prepared full-text bundle as too large; I used targeted reader ranges for portions of them. I did not run tests or independently verify the author-reported results.

To get this to a good state

Nothing is required. Optional: complete review of the unread changed files and run the focused LOD clamp tests on the new head before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5974546385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-5974546385). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T11:57:42Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The reviewed portions of head `491a15b8e474f7d939d5eba58239a784582d91cc` show no verified blocking defect, but the review is incomplete because several changed files were not read in full. ## What I ran Read the prepared review bundle and targeted source ranges through `repo_read.py`. No build or test command was run. ## Results | Check | Result | Note | |---|---|---| | Source review | not run | Partial review only | | Build and tests | not run | No commands run | | Negative control | not run | Not independently reproduced | ## Findings ### Blocking None verified in the portions reviewed. ### Non-blocking None. ## Not verified Read the description, commits, manifest, diff, and targeted ranges from `VulkanDevice.cpp`, `Texture.cpp`, `ShaderResources.cpp`, `DescriptorBindingBuilder.cpp`, and `SpirvImageEmitter.cpp`. The diff also exposed the new probe and tests, but I did not read all their full head files. Other changed files listed in the manifest were not read. `VulkanDevice.cpp`, `ShaderResources.cpp`, and `Texture.cpp` were excluded from the prepared full-text bundle as too large; I used targeted reader ranges for portions of them. I did not run tests or independently verify the author-reported results. ## To get this to a good state Nothing is required. Optional: complete review of the unread changed files and run the focused LOD clamp tests on the new head before making a formal approval decision.
MarcZX10 commented 2026-11-22 06:20:23 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed — comments

Changes are required before merge: resolve the noted runtime metadata clamp concern.

What I ran

Reviewed head 43abeb36b8e375911e5e12eaf33b2a0be6ba5e6c using the prepared diff and repo_read.py for targeted source ranges. No commands or tests were run.

Results

Check Result Note
Source review passed Probe and shader-lane paths inspected
Tests not run Only author-reported results were available

Findings

Blocking

None verified.

Non-blocking

  • RuntimeMinLodClamp derives the relative clamp from runtime descriptor words, including MAX_MIP bounds (core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp:60). Please add a focused test for a descriptor where MAX_MIP < BASE_LEVEL and for a clamp above the descriptor’s last level. The current submitted pixel cases exercise ordinary clamp/base combinations but do not establish this metadata edge behavior.

Not verified

The changed full-text files read through files/ were Execution/src/ImageViewMinLodProbe.cpp, Execution/include/ImageViewMinLodProbe.hpp, Graphics/include/Context.hpp, Graphics/include/ShaderResources.hpp, tests/cmake/agc_driver_image_sample_lod_clamp_tests.cmake, tests/execution/ImageSampleLodClamp.cpp, tests/execution/ImageSampleLodClampPixel.cpp, tests/execution/ImageTableMinLod.cpp, Optimization/src/DescriptorBindingBuilder.cpp, SpirvBackend/src/SpirvImageEmitter.cpp, docs/dev/ARCHITECTURE.md, docs/dev/ENVIRONMENT.md, and docs/dev/debt/changes/agent-anyps5-lodclamp-anv.md. Targeted ranges were read from the changed but excluded Execution/src/VulkanDevice.cpp, Graphics/src/ShaderResources.cpp, and Graphics/src/Texture.cpp through repo_read.py.

The full changed files Execution/src/VulkanDevice.cpp, Graphics/src/ShaderResources.cpp, and Graphics/src/Texture.cpp were excluded by the review bundle size rule and not read in full; other portions of those files were not verified. No independent test run, Windows run, or console hardware validation was performed. Test results in the PR description are author-reported.

To get this to a good state

Nothing is required. The test suggestion above is optional.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6010734479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-6010734479). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T06:20:23Z. **Review:** COMMENTED --- # Reviewed — comments Changes are required before merge: resolve the noted runtime metadata clamp concern. ## What I ran Reviewed head `43abeb36b8e375911e5e12eaf33b2a0be6ba5e6c` using the prepared diff and `repo_read.py` for targeted source ranges. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Probe and shader-lane paths inspected | | Tests | not run | Only author-reported results were available | ## Findings ### Blocking None verified. ### Non-blocking - `RuntimeMinLodClamp` derives the relative clamp from runtime descriptor words, including `MAX_MIP` bounds (`core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp:60`). Please add a focused test for a descriptor where `MAX_MIP < BASE_LEVEL` and for a clamp above the descriptor’s last level. The current submitted pixel cases exercise ordinary clamp/base combinations but do not establish this metadata edge behavior. ## Not verified The changed full-text files read through `files/` were `Execution/src/ImageViewMinLodProbe.cpp`, `Execution/include/ImageViewMinLodProbe.hpp`, `Graphics/include/Context.hpp`, `Graphics/include/ShaderResources.hpp`, `tests/cmake/agc_driver_image_sample_lod_clamp_tests.cmake`, `tests/execution/ImageSampleLodClamp.cpp`, `tests/execution/ImageSampleLodClampPixel.cpp`, `tests/execution/ImageTableMinLod.cpp`, `Optimization/src/DescriptorBindingBuilder.cpp`, `SpirvBackend/src/SpirvImageEmitter.cpp`, `docs/dev/ARCHITECTURE.md`, `docs/dev/ENVIRONMENT.md`, and `docs/dev/debt/changes/agent-anyps5-lodclamp-anv.md`. Targeted ranges were read from the changed but excluded `Execution/src/VulkanDevice.cpp`, `Graphics/src/ShaderResources.cpp`, and `Graphics/src/Texture.cpp` through `repo_read.py`. The full changed files `Execution/src/VulkanDevice.cpp`, `Graphics/src/ShaderResources.cpp`, and `Graphics/src/Texture.cpp` were excluded by the review bundle size rule and not read in full; other portions of those files were not verified. No independent test run, Windows run, or console hardware validation was performed. Test results in the PR description are author-reported. ## To get this to a good state Nothing is required. The test suggestion above is optional.
MarcZX10 commented 2026-11-22 06:58:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T06:58:44Z.

Review: COMMENTED


Reviewed — comments

The reviewed diff is consistent with the stated T# MIN_LOD lane split, but this review is incomplete because three changed implementation files were excluded from full-text review and no checks were run here.

What I ran

Reviewed head f97c5ec5d00599e202f4db7c6dbb30b65f763929 using the prepared diff and targeted reads through repo_read.py. No commands or tests were run.

Results

Check Result Note
Diff and targeted code review passed Probe, device selection, shader emitter, and table routing inspected
Build and tests not run Author-reported results were not independently verified

Findings

Blocking

None verified in the code read.

Non-blocking

  • No code issue confirmed. The review remains incomplete because VulkanDevice.cpp, ShaderResources.cpp, and Texture.cpp were excluded from the prepared full-text files. Their relevant hunks were inspected in the diff, and targeted head ranges were read for the device and table-cache paths.

Not verified

  • Build, test suite, GPU behavior, and validation-layer results were not run here; the test results in the PR description are author-reported.
  • Full changed-file text was read for the other 15 changed files. The three excluded changed files were core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, and core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp.
  • Files read: review/description.md, review/commits.md, review/manifest.json, review/diff.patch; full changed-file text for core/libs/prx/libSceAgcDriver/CMakeLists.txt, core/libs/prx/libSceAgcDriver/Execution/include/ImageViewMinLodProbe.hpp, core/libs/prx/libSceAgcDriver/Execution/src/ImageViewMinLodProbe.cpp, core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp, core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp, core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_sample_lod_clamp_tests.cmake, core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cpp, core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClampPixel.cpp, core/libs/prx/libSceAgcDriver/tests/execution/ImageTableMinLod.cpp, core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp, core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp, docs/dev/ARCHITECTURE.md, docs/dev/ENVIRONMENT.md, and docs/dev/debt/changes/agent-anyps5-lodclamp-anv.md. Targeted ranges were also read from the three excluded files.

To get this to a good state

Nothing is required. Optional: complete a full review of the three excluded changed files and run the relevant build and tests on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6010915435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-6010915435). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T06:58:44Z. **Review:** COMMENTED --- # Reviewed — comments The reviewed diff is consistent with the stated T# MIN_LOD lane split, but this review is incomplete because three changed implementation files were excluded from full-text review and no checks were run here. ## What I ran Reviewed head `f97c5ec5d00599e202f4db7c6dbb30b65f763929` using the prepared diff and targeted reads through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted code review | passed | Probe, device selection, shader emitter, and table routing inspected | | Build and tests | not run | Author-reported results were not independently verified | ## Findings ### Blocking None verified in the code read. ### Non-blocking - No code issue confirmed. The review remains incomplete because `VulkanDevice.cpp`, `ShaderResources.cpp`, and `Texture.cpp` were excluded from the prepared full-text files. Their relevant hunks were inspected in the diff, and targeted head ranges were read for the device and table-cache paths. ## Not verified - Build, test suite, GPU behavior, and validation-layer results were not run here; the test results in the PR description are author-reported. - Full changed-file text was read for the other 15 changed files. The three excluded changed files were `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`, `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`, and `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`. - Files read: `review/description.md`, `review/commits.md`, `review/manifest.json`, `review/diff.patch`; full changed-file text for `core/libs/prx/libSceAgcDriver/CMakeLists.txt`, `core/libs/prx/libSceAgcDriver/Execution/include/ImageViewMinLodProbe.hpp`, `core/libs/prx/libSceAgcDriver/Execution/src/ImageViewMinLodProbe.cpp`, `core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`, `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`, `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_image_sample_lod_clamp_tests.cmake`, `core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClamp.cpp`, `core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleLodClampPixel.cpp`, `core/libs/prx/libSceAgcDriver/tests/execution/ImageTableMinLod.cpp`, `core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp`, `core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp`, `docs/dev/ARCHITECTURE.md`, `docs/dev/ENVIRONMENT.md`, and `docs/dev/debt/changes/agent-anyps5-lodclamp-anv.md`. Targeted ranges were also read from the three excluded files. ## To get this to a good state Nothing is required. Optional: complete a full review of the three excluded changed files and run the relevant build and tests on this head.
MarcZX10 commented 2026-11-23 05:15:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T05:15:51Z.

Review: COMMENTED


Reviewed — no blocking findings

The changed code and test additions were inspected at head dac2bcc7787405644d18b13367085781c0f38f5b; no concrete defect was verified, but tests were not run in this review.

What I ran

No commands or tests were run. I inspected the prepared description, commit list, manifest and diff, then used the reader to inspect changed source and test hunks plus relevant callers. The review folder listed 18 changed files; the diff and targeted source ranges for these changes were read. Files excluded by rule: none were listed.

Results

Check Result Note
Diff and targeted source review passed No concrete defect verified
Automated tests not run Only author-reported test results were available

Findings

Blocking

None.

Non-blocking

None.

Sources

Prepared review bundle: description.md, commits.md, manifest.json and diff.patch; source read through repo_read.py at the pinned head.

Not verified

Tests were not run. Full file contents were not read for every changed file; the review focused on changed hunks and relevant code ranges. The description reports Linux results on an Intel HD Graphics 520 and llvmpipe, and Windows was not tested by the author.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6016864640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-6016864640). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T05:15:51Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The changed code and test additions were inspected at head `dac2bcc7787405644d18b13367085781c0f38f5b`; no concrete defect was verified, but tests were not run in this review. ## What I ran No commands or tests were run. I inspected the prepared description, commit list, manifest and diff, then used the reader to inspect changed source and test hunks plus relevant callers. The review folder listed 18 changed files; the diff and targeted source ranges for these changes were read. Files excluded by rule: none were listed. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | No concrete defect verified | | Automated tests | not run | Only author-reported test results were available | ## Findings ### Blocking None. ### Non-blocking None. ## Sources Prepared review bundle: `description.md`, `commits.md`, `manifest.json` and `diff.patch`; source read through `repo_read.py` at the pinned head. ## Not verified Tests were not run. Full file contents were not read for every changed file; the review focused on changed hunks and relevant code ranges. The description reports Linux results on an Intel HD Graphics 520 and llvmpipe, and Windows was not tested by the author. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-23 06:05:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:05:48Z.

Review: APPROVED


Reviewed — looks good

The reviewed changes are internally consistent with the reported fix; the author’s hardware results are reported evidence, not tests I ran.

What I ran

Inspected the prepared diff at head bf12269bb8084dcb0c6f80a41036273cea9eeca0 and read the changed lines of every file listed as reviewed in the manifest. Used targeted reads for the three changed files excluded from the review folder. No tests or builds were run.

Results

Check Result Note
Diff and changed lines passed All 16 reviewed files inspected
Targeted source context passed Device, texture cache, and view creation paths
Build and tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build, automated tests, validation-layer run, or physical GPU behavior was verified in this review. The author reports Linux results on an Intel HD Graphics 520 and llvmpipe; Windows was not tested. The review-folder list records 16 changed files as reviewed and excludes none. Targeted reads from the pinned head covered VulkanDevice.cpp, ShaderResources.cpp, and Texture.cpp.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017206697 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-6017206697). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T06:05:48Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed changes are internally consistent with the reported fix; the author’s hardware results are reported evidence, not tests I ran. ## What I ran Inspected the prepared diff at head `bf12269bb8084dcb0c6f80a41036273cea9eeca0` and read the changed lines of every file listed as reviewed in the manifest. Used targeted reads for the three changed files excluded from the review folder. No tests or builds were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed lines | passed | All 16 reviewed files inspected | | Targeted source context | passed | Device, texture cache, and view creation paths | | Build and tests | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No build, automated tests, validation-layer run, or physical GPU behavior was verified in this review. The author reports Linux results on an Intel HD Graphics 520 and llvmpipe; Windows was not tested. The review-folder list records 16 changed files as reviewed and excludes none. Targeted reads from the pinned head covered `VulkanDevice.cpp`, `ShaderResources.cpp`, and `Texture.cpp`. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 22:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:37:16Z.

Review: COMMENTED


The trial merge onto c1601e56d5 conflicts in ShaderResources.cpp and DescriptorBindingBuilder.cpp. Preserve the two separate cache identities where the shader lane uses an unclamped direct image but the image table still needs a clamped view. The direct zero-clamp derivative control should also stay, since an unnecessary MinLod operand changes the ANV lowering. The Intel observations are from the author’s hardware results. I have no ANV execution result.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179838087 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16953#pullrequestreview-6179838087). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:37:16Z. **Review:** COMMENTED --- The trial merge onto `c1601e56d5` conflicts in `ShaderResources.cpp` and `DescriptorBindingBuilder.cpp`. Preserve the two separate cache identities where the shader lane uses an unclamped direct image but the image table still needs a clamped view. The direct zero-clamp derivative control should also stay, since an unnecessary `MinLod` operand changes the ANV lowering. The Intel observations are from the author’s hardware results. I have no ANV execution result. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/16953:upstream-pr/16953'
git switch 'upstream-pr/16953'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/16953'
git switch 'upstream-pr/16953'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/16953'
git switch 'upstream-pr/16953'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/16953'
git switch 'main'
git merge --squash 'upstream-pr/16953'
git switch 'main'
git merge --ff-only 'upstream-pr/16953'
git switch 'main'
git merge 'upstream-pr/16953'
git push origin 'main'
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!16953
No description provided.