Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
There was a problem hiding this comment.
The normalized-sampler check considers every image paired with the sampler. A sampler can be shared by an offset cube instruction and an ordinary 2D sample. The 2D pair makes cubeOnly() false even though that pair does not need computed-offset support. Can the proof distinguish the uses that actually supply an offset?
On Linux/lavapipe, the cube-offset, scalar-buffer, shader-memory, and disk-cache cases passed on main at 9d362fb088fc and with this head integrated. The Vulkan runs required the device, disabled the shader cache, and loaded Khronos validation 1.4.369 without missing-layer warnings or VUIDs. These fixtures passed without exercising the mixed cube and 2D sampler case above.
AI-assisted: yes.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
A runtime image with cubeTexelOffsetsOnly can still match and accept a non-cube mode, bypassing the intended rejection.
What I ran
Reviewed head 178de5eb1c1585f981fa133abcb9b32f9a14f420 using repo_read.py searches and targeted source reads. I ran no builds or tests.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | failed | One blocking runtime mode check defect |
| Build and tests | not run | No execution checks performed |
Negative Control
Not run; no test was changed or executed as a negative control.
Findings
Blocking
- Non-cube runtime modes bypass the cube-only restriction. In
RuntimeImageModes, when no cube mode exists but an unnormalized mode does, the fallback retains unnormalized modes (core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp:2661).TryRuntimeImageModethen returns as soon as one of those modes matches, before reaching thecubeTexelOffsetsOnlyrejection at line 2733. A computed offset for a sampler that cannot fold offsets can therefore be accepted with a non-cube image, despite the intended refusal. Enforce the cube-only restriction before accepting a matched mode, while preserving valid cube matches.
Sources
Not verified
No build, automated tests, GPU execution, or author-reported test results were independently verified. I read all changed files listed in manifest.json and files.json, including ShaderMemory.cpp through the pinned reader; those lists show no excluded files.
To get this to a good state
Reject non-cube runtime descriptors when cubeTexelOffsetsOnly is set, before a non-cube mode can be accepted. Then rerun the cube-offset shader memory and execution coverage, including a non-cube descriptor case.
|
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.
|
|
Windows at this head ( Setup:
The added test lines are not inside a platform guard. AI-assisted: yes. |
|
@MarcZX10 thanks. d8cd56a makes Before this, the case could not get past recompilation: without a cube mode, the fallback keeps On d8cd56a (Linux Mint 22.3, |
|
@ligmaSec it doesn't distinguish them, on purpose. On |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head d8cd56a76631d4fed275deb121577051cd503255 using repo_read.py to inspect the changed hunks and relevant source context. No tests or builds were run. The test results in the PR description are author-reported and were not reproduced.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | All 10 changed files reviewed; no excluded files |
| Tests and builds | not run | No execution performed |
| Author-reported checks | not run | Not independently verified |
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
- Resource mode preparation and selection
- Sampler-use analysis and mode refresh
- Normalized sampler validation
- Shader cache format and flag encoding and encoding
Not verified
The full contents of large files were not read; review covered all changed hunks and relevant surrounding code. No hardware behavior, CI results, or author-reported test results were independently verified.
To get this to a good state
Nothing is required.
ligmaSec
left a comment
There was a problem hiding this comment.
The new 1D sample-plus-gather refusal covers a useful boundary. The earlier mixed-resource case is still worth checking in its own fixture. A computed-offset cube sample and an ordinary 2D sample can share the same S#. Their combination tests the sampler proof separately from the new rejection of invalid descriptor modes.
Source review at d8cd56a766. The head trial-merges onto 700fae9438 and its paired checks are queued.
AI-assisted: yes.
|
@ligmaSec agreed that it's worth a fixture of its own, but I'd put it in the follow-up that relaxes the check. In this PR the mixed case keeps |
d8cd56a to
9198e98
Compare
|
Rebased onto |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The changed code and all listed changed files were inspected, and no blocking defect was verified; runtime checks were not run independently.
What I ran
Reviewed head 9198e98815b857a89eb27f3602f90eb1489895a using the prepared diff, included head files, and the reader output for the added ShaderMemory.cpp lines. No tests or build commands were run.
No tests or build commands run.
Results
| Check | Result | Note |
|---|---|---|
| Changed-file review | passed | All 10 listed files inspected |
| Runtime and test checks | not run | Description reports author-run results |
| Reader context lookup | not run | Reader output was blocked after the requested lines by its read-only log write |
Negative control
Could not run a negative control; no test was run independently.
Findings
Blocking
None verified.
Non-blocking
None.
Sources
The main behavior claims are supported by the changed code at the pinned head: ResourceMaterializer.cpp, ShaderInfoCollector.cpp, and DescriptorBindingBuilder.cpp.
Not verified
No tests, builds, or device behavior were independently verified. The author-reported test and checker results in the PR description were not rerun. Read all files listed under reviewed in files.json: ShaderDiskCache.cpp, ShaderMemory.cpp, ImageSampleCubeOffset.cpp, Resources.hpp, DescriptorBindingBuilder.cpp, ResourceMaterializer.cpp, ShaderInfoCollector.cpp, ShaderDiskCache.cpp, ShaderDiskCache.hpp, and fix-shader-cube-offsets-without-maintenance8.md. ShaderMemory.cpp was read through repo_read.py; the other changed files were read from the prepared folder. files.json lists no excluded changed files. Additional callers and surrounding source context were not verified because the reader could not complete its logging step in the read-only workspace.
To get this to a good state
Nothing is required.
|
Heads-up for merging (updated 2026-12-05): this PR now changes the shader cache |
|
Test report, NVIDIA on Windows, head
Image sampling and shader cache tests, GPU tests,
Every test has the same result on both sides. AI-assisted (Claude Code). |
|
Tested
GPU (software Vulkan): 5 GPU tests (AGC, shader recompiler) passed twice on Mesa lavapipe (Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2)) on a GitHub-hosted Ubuntu 24.04 runner, with the Khronos validation layer on and the shader cache off, alongside main Not covered: GPU hardware. lavapipe runs Vulkan on the CPU, so this says nothing about how real GPU drivers handle the changed paths. AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
Plyxen
left a comment
There was a problem hiding this comment.
Verified on Windows 11 (GCC 15.2, Release) on main 484b036, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and the Khronos validation layer 1.4.363. Every run log shows the loader inserting the layer and none shows "was not found". It ran on an RTX 5080 (621.24) and an AMD Radeon iGPU (26.11.2), together with #28820, #28802, #28646 and #28670.
agc_driver_image_sample_cube_offset*,agc_shader_memory*andagc_shader_disk_cache*passed on main and with this change on both GPUs, with noVUID-messages.- With the recompiler sources reverted to main and the new tests kept,
agc_driver_image_sample_cube_offsetfails on both GPUs in its pass withoutVK_KHR_maintenance8, with "SPIR-V emission failed … opcode=ImageSampleRaw reason=has a texel offset that is not a constant". The tests therefore cover the fix.
Not run: Linux.
AI-assisted: yes (Claude Code)
…enance8 RDNA2 ignores the texel offset of a sample or gather through a cube T# (boykopovar#23498), so the cube modes of an image need no offset support. Without VK_KHR_maintenance8 the runtime modes of an image sampled with a computed offset were cut to those an unnormalized S# can sample, which dropped the cube modes, and an offset the S# cannot fold (its S# also serves a gather) failed emission, so agc_driver_image_sample_cube_offset failed to recompile on such a device. The cube modes are now kept. When the S# cannot fold offsets into the coordinates (known once the sampler uses are collected), only the cube modes are kept and any other T# is refused when its mode is selected; an image without a cube mode keeps the modes it had. A normalized S# passes descriptor binding when every image it samples takes a cube mode. Shader cache format 99 stores the new image flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TryRuntimeImageMode returned the first mode that matched the descriptor, including a non-cube or constant-swizzle mode, before it reached the cubeTexelOffsetsOnly refusal. Such an image keeps only cube modes when it has any, and without one its computed offset already fails emission, so no non-cube mode could be returned in practice. The selection now skips non-cube modes for such an image, so the refusal holds by itself. A 1D T# sampled with a computed offset through an S# that also serves a gather is checked to be refused with a normalized and an unnormalized S#. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boykopovar#23243 took format 100 on main for its window-select form, so the cube-mode image flag this branch stores needs the next number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9198e98 to
e18e0b3
Compare
|
Rebased onto |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change adds cube image handling for computed texel offsets without maintenance8, and I found no blocking defect in the reviewed changes.
What I ran
Reviewed head e18e0b354bf99c5f0e6fdf40e362d57c3db59eac. I read the prepared description, commits, diff, manifest, and file list, then used repo_read.py to inspect targeted source context. I ran no tests or builds.
The author reports focused tests and checkers passing on four devices, with the noted existing HD 630 failure. These were not runs I performed.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | Changed behavior and relevant callers inspected |
| Tests and checkers | not run | Results supplied by the author |
| Negative control | not run | No test modification was made |
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
I did not run the reported GPU tests, validation layer, source scanners, or other checkers. I read the prepared diff and targeted head context for all ten changed files listed under reviewed in files.json, including ShaderMemory.cpp through repo_read.py; files.json lists no excluded files. Physical console behavior was not verified.
To get this to a good state
Nothing is required.
What
#23498 drops the texel offset of a sample or gather through a cube T#, as RDNA2 does. On a device without
VK_KHR_maintenance8(for example Mesa 25.2.8's ANV on an Intel HD Graphics 630), its testagc_driver_image_sample_cube_offsetstill fails before it runs:Without native non-constant offsets,
ApplyStaticInterfacemarks an image sampled with a computed offsetfoldTexelOffsetsOnly, andRuntimeImageModeskeeps only the modes an unnormalized S# can sample. That removes the cube modes, the only modes where the offset is dropped. The 2D modes left over cannot take the offset either when the S# cannot fold it into the coordinates (here the same S# serves a gather), so emission fails, although the T# is a cube and the offset would be ignored.This PR:
foldTexelOffsetsOnlyimage;cubeTexelOffsetsOnlywhen its S# cannot fold offsets (FoldsTexelOffsets, decided inShaderInfoCollectoronce the sampler uses are collected), and then keeps only the cube modes. Any other T# is refused when its mode is selected (… takes only cube images, whose texel offsets RDNA2 ignores, without VK_KHR_maintenance8 and shaderImageGatherExtended), instead of the whole shader failing to recompile. An image without a cube mode keeps the modes it had;DescriptorBindingBuilderwhen every image it samples takes a cube mode. Any other normalized S# is refused as before;Nothing changes on a device with
VK_KHR_maintenance8, wherefoldTexelOffsetsOnlyis never set. The Linux CI job's llvmpipe has it, so it never took this path.agc_driver_image_sample_cube_offsetnow also runs withnonConstantImageOffsetsforced off, so every device, CI's included, covers it.Tested
Linux Mint 22.3, kernel 7.0.0,
maincde48b5800, SPIRV-Tools on (as the Linux CI job builds).main's recompiler sources and the new tests:agc_driver_image_sample_cube_offsetfails on the HD 630 in its native pass and on llvmpipe in the pass withoutVK_KHR_maintenance8, both with the emission message above.agc_shader_memoryfails on the new cube case withnormalized guest sampler is used with a texel offset that is not a constant.agc_shader_disk_cachedoes not compile without the new field.agc_shader_memory,agc_shader_disk_cache,agc_driver_image_sample_cube_offset,agc_driver_image_sample_derivatives,agc_driver_image_gather*,agc_driver_emulated_color_compare,agc_driver_prepared_shadersandagc_driver_image_plane_offset_on_line, 3/3 on the GTX 1050 Ti, the HD 630, llvmpipe (Mesa 25.2.8) and lavapipe 26.0.8. The only failure isagc_driver_image_plane_offset_on_lineon the HD 630, which also fails onmainand needsVK_KHR_maintenance8for a normalized S# (test(agc): skip the plane offset on line test without VK_KHR_maintenance8 #28744 skips it there). With the validation layer from Vulkan SDK 1.4.363.1, one more run on each device logged nothing.--fullrun ofmaincde48b5800: the GTX 1050 Ti fails nothing. On the HD 630,agc_driver_image_sample_cube_offsetnow passes, and every other failure is onemainhas on this machine. On llvmpipe, the failures aremain's, exceptagc_driver_msaa_resolve_publication_order, which failed inmain's run and passed here.conventions,public_headers,tools_): 162/162.check_conventions.py,check_test_registration.py,check_compile.py(7 translation units),check_main_sync.pyanddebt_fold.py --checkare clean.pr_overlap.py --branchcould not compare the 24 pull requests that touch these files and conflict withmain. I read the relevant ones by hand. feat(agc): sample unnormalized anisotropic samplers through scaled coordinates #27670 adds its scaled-sampler proof right after the normalized-S# branch ofProveUnnormalizedthat this PR changes. It and feat(agc): opt-in bindless image heap for sampled image tables #20519 also raise the cache format from 98 to 99, as this PR does, so whichever lands second takes the next number. fix(shader): preserve compute implicit LOD and quad inputs #10867 changes thefoldOffsetcondition inSpirvImageEmitter.cpp, which this PR leaves alone, and fix(recompiler): defer the TYPE check of a guarded read-only static V# #6412 changesApplyStaticInterface's signature, not its offset loop. None of them changes which modes afoldTexelOffsetsOnlyimage keeps.An earlier version also marked images that a gather samples with a computed offset. That broke
agc_driver_image_gather_one_dimensionaland_arrayon the HD 630, which already handle those offsets, so gathers are left as onmain.Update 2026-12-04 (head
9198e98815): rebased ontomainc1601e56d5. #9457 took shader cache format 99 onmainfor its own layout change, so this PR's bump to 99 had become a no-op; it now raises the format to 100. #21776, #14871, #27670 and #20519 also bump it, so whichever lands later takes the next number. #14871 also touches two of this PR's lines: the constant-swizzle condition inTryRuntimeImageModeand theImageResourcefield count. Both sides of each are kept. On this head (SPIRV-Tools on), the 12 focused tests pass 3/3 on the four devices, exceptagc_driver_image_plane_offset_on_lineon the HD 630 (#28744). A validation-layer run logged nothing, and the checkers anddebt_fold.py --checkare clean. The split suite fails the same tests as atd8cd56a766: GTX 1050 Ti none, HD 630 and llvmpipe onlymain's.Update 2026-12-05 (head
e18e0b354b): rebased ontomain6918c4a642. #23243 took shader cache format 100 onmainwith the same 99→100 edit, so GitHub showed no conflict; this PR now raises the format to 101. The rebase was clean, and the diff againstmainis unchanged apart from that number (10 files). On this head, the 12 focused tests pass 3/3 on the four devices, exceptagc_driver_image_plane_offset_on_lineon the HD 630 (#28744). A validation-layer run logged nothing. The checkers,debt_fold.py --checkand the 162 source-scanning tests are clean. The split suite againstcde48b5800's--fullrun has no new failure, andagc_driver_image_sample_cube_offsetpasses on the HD 630.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