Skip to content

fix(shader): keep cube modes for computed texel offsets without maintenance8 - #28780

Open
GiannisG1 wants to merge 3 commits into
boykopovar:mainfrom
GiannisG1:fix/shader-cube-offsets-without-maintenance8
Open

GiannisG1 wants to merge 3 commits into
boykopovar:mainfrom
GiannisG1:fix/shader-cube-offsets-without-maintenance8

Conversation

@GiannisG1

@GiannisG1 GiannisG1 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

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 test agc_driver_image_sample_cube_offset still fails before it runs:

ShaderRecompiler::Recompile: SPIR-V emission failed: hash=… stage=4 opcode=ImageSampleRaw reason=has a texel offset that is not a constant, which image sampling takes only with VK_KHR_maintenance8 and shaderImageGatherExtended

Without native non-constant offsets, ApplyStaticInterface marks an image sampled with a computed offset foldTexelOffsetsOnly, and RuntimeImageModes keeps 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:

  • keeps the cube modes of a foldTexelOffsetsOnly image;
  • marks the image cubeTexelOffsetsOnly when its S# cannot fold offsets (FoldsTexelOffsets, decided in ShaderInfoCollector once 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;
  • lets a normalized S# with folded offsets pass DescriptorBindingBuilder when every image it samples takes a cube mode. Any other normalized S# is refused as before;
  • stores the new flag in the shader cache (format 99).

Nothing changes on a device with VK_KHR_maintenance8, where foldTexelOffsetsOnly is never set. The Linux CI job's llvmpipe has it, so it never took this path. agc_driver_image_sample_cube_offset now also runs with nonConstantImageOffsets forced off, so every device, CI's included, covers it.

Tested

Linux Mint 22.3, kernel 7.0.0, main cde48b5800, SPIRV-Tools on (as the Linux CI job builds).

  • RED with main's recompiler sources and the new tests: agc_driver_image_sample_cube_offset fails on the HD 630 in its native pass and on llvmpipe in the pass without VK_KHR_maintenance8, both with the emission message above. agc_shader_memory fails on the new cube case with normalized guest sampler is used with a texel offset that is not a constant. agc_shader_disk_cache does not compile without the new field.
  • GREEN: 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_shaders and agc_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 is agc_driver_image_plane_offset_on_line on the HD 630, which also fails on main and needs VK_KHR_maintenance8 for 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.
  • Split suite (all tests once, GPU tests on all three GPUs) against our --full run of main cde48b5800: the GTX 1050 Ti fails nothing. On the HD 630, agc_driver_image_sample_cube_offset now passes, and every other failure is one main has on this machine. On llvmpipe, the failures are main's, except agc_driver_msaa_resolve_publication_order, which failed in main's run and passed here.
  • The source-scanning tests (conventions, public_headers, tools_): 162/162. check_conventions.py, check_test_registration.py, check_compile.py (7 translation units), check_main_sync.py and debt_fold.py --check are clean.
  • pr_overlap.py --branch could not compare the 24 pull requests that touch these files and conflict with main. 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 of ProveUnnormalized that 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 the foldOffset condition in SpirvImageEmitter.cpp, which this PR leaves alone, and fix(recompiler): defer the TYPE check of a guarded read-only static V# #6412 changes ApplyStaticInterface's signature, not its offset loop. None of them changes which modes a foldTexelOffsetsOnly image keeps.

An earlier version also marked images that a gather samples with a computed offset. That broke agc_driver_image_gather_one_dimensional and _array on the HD 630, which already handle those offsets, so gathers are left as on main.

Update 2026-12-04 (head 9198e98815): rebased onto main c1601e56d5. #9457 took shader cache format 99 on main for 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 in TryRuntimeImageMode and the ImageResource field count. Both sides of each are kept. On this head (SPIRV-Tools on), the 12 focused tests pass 3/3 on the four devices, except agc_driver_image_plane_offset_on_line on the HD 630 (#28744). A validation-layer run logged nothing, and the checkers and debt_fold.py --check are clean. The split suite fails the same tests as at d8cd56a766: GTX 1050 Ti none, HD 630 and llvmpipe only main's.

Update 2026-12-05 (head e18e0b354b): rebased onto main 6918c4a642. #23243 took shader cache format 100 on main with 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 against main is unchanged apart from that number (10 files). On this head, the 12 focused tests pass 3/3 on the four devices, except agc_driver_image_plane_offset_on_line on the HD 630 (#28744). A validation-layer run logged nothing. The checkers, debt_fold.py --check and the 162 source-scanning tests are clean. The split suite against cde48b5800's --full run has no new failure, and agc_driver_image_sample_cube_offset passes on the HD 630.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce GTX 1050 Ti (580.178.04), Intel HD Graphics 630 (Mesa 25.2.8 ANV), llvmpipe (Mesa 25.2.8, LLVM 20.1.2), lavapipe 26.0.8; Linux Mint 22.3
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of non-constant texel offsets in cube texture sampling on devices without required graphics features. Unsupported offsets are omitted for cube samples, while incompatible non-cube cases continue to report an error. Normalized samplers are accepted for this handling only when their sampled images use cube modes.
  • Tests
    • Added coverage for cube, 1D, and 2D-array sampling with texel offsets, including runs with native offset support enabled and disabled.
  • Documentation
    • Documented shader behavior on devices with limited graphics feature support.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Cube texel-offset handling

Layer / File(s) Summary
Track cube-only image metadata
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp, core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp, core/shader/recompiler/ShaderDiskCache.*, core/shader/recompiler/ShaderDiskCache.hpp, core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
ImageResource gains cubeTexelOffsetsOnly. The collector sets it for eligible images. The shader cache encodes and decodes the field and advances its format version. The cache test sample sets the field to true.
Select and validate image modes
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp, core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp, docs/dev/debt/changes/fix-shader-cube-offsets-without-maintenance8.md
Runtime mode selection includes cube modes for offset handling. Normalized sampler validation checks that paired images use non-table cube modes. The documentation describes the related mode restrictions and offset handling.
Test offset handling
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp, core/libs/prx/libSceAgcDriver/tests/execution/ImageSampleCubeOffset.cpp
Shader-memory tests check offset operands for cube samples and failures for 2D-array and 1D sample-plus-gather cases. The execution test runs with native offsets enabled and disabled, refilling input for each run.

Possibly related PRs

  • boykopovar/AnyPS5#22583: Both PRs change the shader disk-cache format version and must use compatible version assignments for their respective layouts.

Suggested reviewers: marczx10, ligmasec, celegans12, michongoddijn231849

Change: Bug fix

Merge Risk: Minimal · up to e18e0

This change keeps cube image sampling working with computed texel offsets on devices without VK_KHR_maintenance8. No actionable merge-blocking risk was found, and tests cover both the supported and refused cases.

Security architecture risk: Minimal · up to e18e0

The shader recompiler now accepts eligible cube sampling on Vulkan targets without native support for computed texel offsets. DescriptorBindingBuilder still rejects incompatible bindings, and ShaderDiskCache rejects incompatible entries and rebuilds them as needed. No operator migration is required.

Security review details

Security Blast Radius

  • inferred — The changed reachability is within shader execution: guest shader instructions and descriptor snapshots can now select an eligible cube sampling path that the base rejected. The inspected gate changes image and sampler eligibility, not the caller's identity or authority.

Trust Boundaries and Controls

  • observed — Before descriptor population, DescriptorBindingBuilder checks the actual descriptor snapshot. A normalized sampler marked as requiring offset folding passes the exception only when all its sampled pairs refer to directly bound images whose selected modes are cube modes. For non-null descriptors subject to the cube-only restriction, ResourceMaterializer excludes non-cube matches and disables the constant-swizzle shortcut.

Dependencies

  • observed — ShaderInfoCollector uses the shared FoldsTexelOffsets predicate, which requires a directly bound sampler, a supported set of uses, and no depth comparison. The recompiler enables native computed sample offsets only when both the target offset setting and ImageGatherExtended capability are present.

Resilience and Maintainability Implications

  • observed — The fallback lets a valid cube variant compile without making unsupported non-cube sampling valid. For cube-only resources, an incompatible non-null descriptor is refused at mode selection; where no cube mode exists, the existing SPIR-V rejection can still occur. This is not a general software emulation path for computed offsets.
  • observed — The new field uses the existing cache publication path. Writers call the atomic write helper; readers check version, size, key, and payload hash before accepting an entry. Missing or rejected compiled entries are rebuilt rather than treated as authoritative state.

Rollout and rollback

  • observed — ShaderDiskCache checks format and source version on read before decoding the payload. A binary using format 100 cannot consume format-101 entries, and the reverse is also true. On a compiled-variant cache miss the recompiler compiles and can repopulate the cache. Operators need not clear or migrate the cache on upgrade or rollback; prebuilt artifacts need regeneration only if their cache hits are required.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)

Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.

core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp

Cppcheck interrupted; analysis of this file is incomplete

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8a60ed13-1db3-4cb6-8917-82a4d3678236
Commits

Reviewing files that changed from the base of the PR and between 9198e98 and e18e0b3.

Files selected for processing: 5

  • core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
  • core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
  • core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
  • core/shader/recompiler/ShaderDiskCache.cpp
  • core/shader/recompiler/ShaderDiskCache.hpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@ligmaSec ligmaSec left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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). TryRuntimeImageMode then returns as soon as one of those modes matches, before reaching the cubeTexelOffsetsOnly rejection 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.

@github-actions github-actions Bot added shader core/shader docs agc libSceAgc* labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 14871 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L2710, L2720-2721
core/shader/recompiler/ShaderDiskCache.cpp L149
PR 19852 core/shader/recompiler/ShaderDiskCache.cpp L148-149
PR 20130 core/shader/recompiler/ShaderDiskCache.hpp L20
PR 20248 core/shader/recompiler/ShaderDiskCache.cpp L148-149
PR 20519 core/shader/recompiler/ShaderDiskCache.cpp L149-150
PR 22690 core/shader/recompiler/ShaderDiskCache.hpp L20
PR 22692 core/shader/recompiler/ShaderDiskCache.hpp L20
PR 22703 core/shader/recompiler/ShaderDiskCache.hpp L20
PR 27670 core/shader/recompiler/ShaderDiskCache.hpp L20
PR 28077 core/shader/recompiler/ShaderDiskCache.cpp L148-149
PR 29008 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L2657-2658
PR 29042 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29066 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29067 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29076 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29084 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29087 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29095 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20
PR 29101 core/shader/recompiler/ShaderDiskCache.cpp L149-150
PR 29103 core/shader/recompiler/ShaderDiskCache.cpp L149-150
PR 29104 core/shader/recompiler/ShaderDiskCache.cpp L149-150
PR 29105 core/shader/recompiler/ShaderDiskCache.cpp L149-150
PR 29118 core/shader/recompiler/ShaderDiskCache.cpp L149-150
core/shader/recompiler/ShaderDiskCache.hpp L20

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.

Pull request Shared files not compared
PR 5609 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6924 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7085 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7689 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9633 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9790 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9852 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 9897 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 9969 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 10359 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 10867 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 11483 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 11551 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 12324 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 12828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 12944 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 14032 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 14853 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 15343 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 15548 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 15555 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 16391 core/shader/recompiler/ShaderDiskCache.cpp
PR 16935 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 16953 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 17056 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 17611 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 18082 core/shader/recompiler/ShaderDiskCache.cpp
PR 18106 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 18107 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 20030 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
PR 20111 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 20153 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 20518 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 21199 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 21240 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 21745 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 21763 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 21970 core/shader/recompiler/ShaderDiskCache.hpp
PR 21971 core/shader/recompiler/ShaderDiskCache.hpp
PR 22071 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 22251 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 22328 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 22424 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 22439 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
PR 22628 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 22647 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 22675 core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 23242 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 23553 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 23811 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 24704 core/shader/recompiler/ShaderDiskCache.hpp
PR 24781 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 25010 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 25489 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 26012 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 26766 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 27847 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 28142 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28176 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28228 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28372 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28376 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 28384 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28387 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 28400 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 28469 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 28470 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28487 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28488 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28586 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
PR 28668 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
PR 28673 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 28808 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 29037 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 29089 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 29106 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 29107 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 29121 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 29123 core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hpp
core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp

@JJenkx

JJenkx commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Windows at this head (178de5eb1c15): agc_driver_image_sample_cube_offset, agc_shader_disk_cache, agc_shader_disk_cache_pack_ownership, agc_shader_disk_cache_large_file, agc_shader_disk_cache_long_paths, agc_shader_disk_cache_host_stderr, agc_shader_bindless, agc_shader_table_binding_growth, agc_shader_table_resolution_growth, agc_shader_empty_table_resolution, agc_shader_shared_table_resolution, agc_shader_selected_records_image_limit, agc_shader_selected_records_pair_limit, agc_shader_selected_records_direct_image_limit, agc_shader_selected_records_direct_pair_limit, agc_shader_sampler_limits, agc_shader_image_limits_table, agc_shader_image_limits_mixed, agc_shader_image_limits_refusals, agc_shader_srt_read_patching, agc_shader_descriptor_phis, agc_shader_registered_view_churn, agc_shader_nested_snapshot_retry, agc_shader_nested_sampler_snapshot_retry, agc_shader_nested_parent_scan_budget, agc_shader_table_keep, agc_shader_table_snapshot_reuse, agc_shader_region_merge, agc_shader_table_snapshot_reuse_unmasked, agc_shader_type_zero_image_materialization, agc_shader_frontend_pair, agc_shader_quad_mask_no_demote, agc_shader_spanned_shuffle_memory, agc_shader_frontend_pair_off, agc_shader_result_memo_budget, agc_shader_result_memo_budget_threads, agc_shader_result_memo_budget_masked, agc_shader_result_memo_ways, agc_shader_result_memo_ways_masked, agc_shader_layout_pair, agc_shader_layout_pair_off, agc_shader_entry_lane_proof_budget, agc_shader_memory, agc_shader_memory_coherent_atomic_loads, agc_shader_specialized_bda_abi_none, agc_shader_layer_specialization_release, agc_shader_layer_specialization_kept, agc_shader_specialized_module_release, agc_shader_specialized_module_kept pass, 3/3 runs. These are the CTests built from the changed ShaderDiskCache.cpp, ShaderMemory.cpp, ImageSampleCubeOffset.cpp.

Setup:

  • Windows 11 22621, Ryzen 9 5950X, MinGW-w64 GCC 15.2 UCRT r7, Release.
  • The exact PR head was built (not merged into main).
  • 3 runs through the shared FIFO.

The added test lines are not inside a platform guard.

AI-assisted: yes.

@GiannisG1

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks. d8cd56a makes TryRuntimeImageMode skip every non-cube mode, the constant-swizzle ones included, for a cubeTexelOffsetsOnly image. A descriptor that matches only such a mode now reaches the takes only cube images refusal. Cube matches are unchanged.

Before this, the case could not get past recompilation: without a cube mode, the fallback keeps main's modes, and the computed offset fails SPIR-V emission there (has a texel offset that is not a constant…), as on main, because the S# cannot fold it. A new case in verifyUnnormalizedSamplers checks that: a 1D T# sampled by image_sample_lz_o with a computed offset, through an S# that also serves image_gather4_lz_o, is refused with a normalized and with an unnormalized S#. It is refused at emission with and without the selection change, so the change only makes the selection enforce the rule by itself.

On d8cd56a (Linux Mint 22.3, main cde48b5800): the 12 focused tests pass 3/3 on the GTX 1050 Ti, llvmpipe (Mesa 25.2.8) and lavapipe 26.0.8, and on the HD 630 except agc_driver_image_plane_offset_on_line (#28744). A validation-layer run on each device logged nothing, and the checkers and debt_fold.py --check are clean. The split suite matches the previous head's: the HD 630 and llvmpipe fail only what main fails there. On the GTX, guest_pthread_mutex_contention (libc, which this PR does not touch) timed out at 60 s once; it passes in our main run.

@GiannisG1

Copy link
Copy Markdown
Contributor Author

@ligmaSec it doesn't distinguish them, on purpose. On main, a normalized S# marked foldTexelOffsetsOnly is refused whatever images it samples. This PR only lets it through when every image it samples takes a cube mode, which is the case the cube test needs. Accepting a normalized S# that also samples a 2D image without computed offsets would be safe for that pair, because nothing is folded there. It is a further relaxation of main's check, though, so I'd rather keep it for a follow-up with its own test than widen this PR.

@GiannisG1
GiannisG1 requested a review from MarcZX10 December 3, 2026 19:45

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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 ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@GiannisG1

Copy link
Copy Markdown
Contributor Author

@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 main's behaviour: a normalized S# with folded offsets is refused at binding, as it is on main today. A fixture here would only pin that unchanged refusal. Once the proof distinguishes the pairs that actually take a computed offset, the cube+2D-on-one-S# program becomes that change's main test, accepted there. Since MarcZX10 approved this head, I'd rather not change it for a test of existing behaviour.

@GiannisG1
GiannisG1 force-pushed the fix/shader-cube-offsets-without-maintenance8 branch from d8cd56a to 9198e98 Compare December 4, 2026 01:40
@GiannisG1

Copy link
Copy Markdown
Contributor Author

Rebased onto main c1601e56d5 and raised the shader cache format to 100 (9198e98). #9457 had already taken 99 on main, so this PR's 98→99 had become a no-op. No other change. The same tests pass on the rebased head; the description has the details. @MarcZX10, the rebase made your approval stale, so I've asked for your review again.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@GiannisG1

GiannisG1 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Heads-up for merging (updated 2026-12-05): this PR now changes the shader cache FormatVersion from 100 to 101, and so do #28077, #29095 and #29118. Identical edits merge without a conflict, so a second one to land would silently share format 101 with the first while storing a different layout. If this one lands second, I'll move it to the next number. (The earlier 99→100 overlap with #21776 and #14871 ended when #23243 took 100.)

@hamdanpor-ctrl

Copy link
Copy Markdown
Contributor

Test report, NVIDIA on Windows, head 9198e98815: no regressions. The description's runs are on Linux, so this adds Ampere on Windows.

  • GPU: NVIDIA GeForce RTX 3050 Laptop GPU, driver 617.42, Windows 11 Pro (10.0.26300)
  • Build: WinLibs GCC 15.2.0 r7 UCRT, Release, all AGC execution tests built
  • Compared: main at 700fae9, and the same tree with this PR's own diff applied (git diff c1601e56d5 9198e98815, 10 files, applied cleanly)
  • Environment: ANYPS5_GPU=NVIDIA, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0)

Image sampling and shader cache tests, ctest --test-dir build -R "cube_offset|image_sample|shader_disk_cache|shader_memory" -V, 3 runs of the change: 26/26 each time, including agc_driver_image_sample_cube_offset (image sample cube offset tests passed, so its pass with nonConstantImageOffsets forced off works here too), agc_driver_image_sample_cube_derivatives, _cube_face_range, _short_cube, agc_shader_memory and agc_shader_disk_cache. 0 VUID- lines.

GPU tests, ctest --test-dir build -V --parallel 4 --timeout 120 -R "^agc_|^request_serializer|shader|^windows_write_watch":

main main + this PR
Passed 2421 2421
Failed 0 0
Skipped 27 27
VUID- lines 0 0
Validation messages 115 115, same IDs
Layer inserted 2198 times, never missing 2198 times, never missing

Every test has the same result on both sides.

AI-assisted (Claude Code).

@ycbuzi

ycbuzi commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Tested 9198e98815 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 2 tests failed out of 7583; 99% tests passed, 5 tests failed out of 7583. 2 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 7583; 100% tests passed, 0 tests failed out of 7583. run

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 fc5e1cfdfe: no Vulkan validation message appears that main does not also produce. run

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 Plyxen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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* and agc_shader_disk_cache* passed on main and with this change on both GPUs, with no VUID- messages.
  • With the recompiler sources reverted to main and the new tests kept, agc_driver_image_sample_cube_offset fails on both GPUs in its pass without VK_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)

GiannisG1 and others added 3 commits December 5, 2026 02:56
…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>
@GiannisG1
GiannisG1 force-pushed the fix/shader-cube-offsets-without-maintenance8 branch from 9198e98 to e18e0b3 Compare December 5, 2026 03:55
@GiannisG1

Copy link
Copy Markdown
Contributor Author

Rebased onto main 6918c4a642 and moved the shader cache format to 101 (e18e0b3). #23243 merged with the same 99→100 edit this PR had, so as the heads-up above said, this one takes the next number. Nothing else changed; the same tests pass on the new head, and the description has the details. @MarcZX10 @Plyxen, only the format number changed since your reviews.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants