Repository navigation
fix(shader): answer image_get_resinfo past the last mip level as RDNA2 does - #22724
oneandonlydean merged 3 commits into
Conversation
…2 does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The past-last-mip guard wraps each size component in an OpSelect, so QueryReportsDepth now follows the select's in-range operand back to the size query.
|
@MichonGoddijn231849 Windows failed |
|
Thanks for catching that and for the fix. I only ran the execution tests that call image_get_resinfo, not |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The inspected shader change guards out of range mip queries and the included tests cover representative 2D and array cases; the full review remains incomplete because one changed file was only read around its modified code.
What I ran
Reviewed head 84562572a5f6dbb3fd6f52d43342caa089353250 using the prepared review bundle and pinned-head reader. No tests or build commands were run in this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff and targeted code review | passed | Three changed files read in full; one changed file read around its edits |
| Tests | not run | Author-reported GPU runs were not independently run |
Negative control
Not run; no test environment was available in this review.
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
The remainder of core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was not read; only the modified SPIR-V parsing and query-checking area was inspected. The reported Windows GPU test runs and hardware-oracle measurements were not independently verified. The other changed files read in full were core/libs/prx/libSceAgcDriver/tests/execution/ImageResinfoDimension.cpp, core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp (changed function), and docs/dev/debt/changes/fix-resinfo-mip-past-last-level.md. The description, commits, manifest, and diff were also read. No files were excluded from the prepared review bundle beyond the noted oversized ShaderMemory.cpp.
To get this to a good state
Nothing is required. Optional: run the reported execution tests on the target GPUs and inspect the remaining ShaderMemory.cpp context before treating this review as complete.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Ran the changed test on NVIDIA's proprietary Linux driver with the Khronos validation layer, since the description's NVIDIA run is on Windows, where the test passes without the fix. Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
The main column runs main's own version of Unlike the RTX 5080 on Windows, NVIDIA's Linux driver does not return zeros for the undefined query. With No new AI-assisted: yes (Claude Code) |
|
The agreed order remains #22724 first, #7085 afterward, with #6280 also required. Refreshed consumer #7085 f20354c93ad3 preserves your The new maintainer rebase request identifies ImageResinfoDimension.cpp. Our pinned downstream test file retains the earlier main 72 inclusive-lastLevel adaptation, its MSAA cases and the extra guest-level checks; it may help with that conflict. This is an adapted consumer, not qualification of your unchanged head against today's main. 26 November consumer evidence: full native libraries/relinker build, 34 physical-GPU processes + one Graphics host suite pass across RTX 5080/AMD 1002:13c0. The dimension test passes on both physical GPUs. The only new production correction is ordinary partial-clear forwarding; 53 serializer fields/minimum 211 bytes/format108 and all unsupported shader modes remain unchanged. No fresh local shader-memory/cache executable result or title/FPS claim. The independent Linux report keeps its original source composition. AI-assisted: yes (Codex). |
|
@Amoenus no concern from my side: #22724 landing first and #7085 following with the extra-level representation works for me. You're right about the convention: the helper keeps the true arm for the in-range case ( |
Preserve boykopovar#22724 and its maintainer-authored query-depth helper. Keep guest/physical mip counts separate and use its in-range select convention when resolving QueryDimensions.
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
|
This passed review on 8456257, but it now conflicts with main in ImageResinfoDimension.cpp. Please merge main into the branch and push; it goes back to the merge queue on the new head. |
|
@MichonGoddijn231849 @oneandonlydean — the requested main refresh is prepared and tested: Amoenus/AnyPS5 It merges main We have pull-only access to the source fork, so only its owner or an upstream maintainer with source-branch edit permission can update the original PR head. This branch can be adopted by fast-forward, without a force push: git fetch https://github.com/Amoenus/AnyPS5.git codex/refresh-22724-main-20261126
git switch fix-resinfo-mip-past-last-level
git merge --ff-only FETCH_HEAD
git push origin HEADNo duplicate upstream PR was opened. Source-only review of the inherited ShaderMemory adjustment is retained; no quarantined shader-memory/cache executable was rebuilt/run. AI-assisted: yes (Codex; original authorship retained). |
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the implementation and the changed test cases support merging.
What I ran
Reviewed head e5eac4e26f6fce16bc1a50c2d150515164f73f93 using the prepared diff and repo_read.py source reads. No commands or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | Core logic and test additions reviewed |
| Runtime tests | not run | Results in the description are author-reported |
Findings
Blocking
None.
Non-blocking
None.
Not verified
ShaderMemory.cpp was excluded from the review bundle because it was too large; its changed lines were not read. No tests were run independently. Runtime behavior and the GPU results described in the PR were not independently verified.
To get this to a good state
Nothing is required.
What
image_get_resinfopassed the guest mip straight toOpImageQuerySizeLod. Vulkan leaves that undefined for a lod at or past the view's level count. AMD's driver then returned the halved size of the last level, e.g. 1×1 for mip 4 of an 8×8 T# with 4 levels, and 32×16 for mip 1 of a single-level 64×32 one. RDNA2 hardware returns 0 for width, height and depth or layers there, and the level count as usual.SpirvImageEmitter.cpp(QueryDimensions): the level count is read first, the size is queried at the guest mip when it is below the level count and at level 0 otherwise, and the three size components are zero past the last level. The fourth component is the level count as before. Multisampled queries are unchanged.test:
ImageResinfoDimension.cppgainsCheckMips, which queries mips 0 to 5, 15 and 0xffffffff of:The expected values are the hardware's (below). The query program takes its mip from a literal (
MipCode), andDescriptortakes an optional level count; the existing cube/3D/2D-array checks keep their single-level descriptors.debt: a new
shader.mdentry (fragmentdocs/dev/debt/changes/fix-resinfo-mip-past-last-level.md).Source of the semantics:
tools/hw-oracleon gfx1036 (AMD Windows driver 32.0.21045.16010). The test's three T#s on hardware:A wider differential sweep against
agc_oracle_runnercovered 1D, 2D, 3D, 2D-array and 1D-array T#s of 1×1 to 100×1×12 with up to 7 levels, base levels 0 to 2 and array bases 0 and 2. It gave the same rule everywhere: before this change AMD returned a computed size for every mip at or past the level count. NVIDIA's driver already returned zeros there.Tested
Windows 11 Pro 10.0.26200,
ctest --test-dir build -R agc_driver_image_resinfo_dimension -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer, validation layer 1.4.363, once per GPU:VUID-image_get_resinfo: mip 4 of a 2D T# with 4 levels returned 1x1x0 levels 4, RDNA 2 returns 0x0x0 levels 4VUID-Each log shows
Insert instance layer "VK_LAYER_KHRONOS_validation"and none showswas not found but was requested. The other execution tests that query dimensions also pass on both GPUs:image_cache_bits,image_texel_status,image_volume_address_planar_texture,ds_swizzleandimage_address_dimension, 6/6 with the resinfo test.pr_overlap.py --branchfailed closed on 14 open PRs that conflict withmain; I compared their diffs by hand:QueryDimensions, for guest levels the host view lacks, so they and this PR need a textual merge. They report size 1 for those levels and do not zero a mip past the T#'s last level, which is what this PR fixes.OpImageQueryLevelselsewhere.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Summary by CodeRabbit