Skip to content

fix(shader): ignore interpolator settings past the programmed count - #23952

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
chitters2004:fix/interpolator-settings-past-count
Nov 29, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
chitters2004:fix/interpolator-settings-past-count

Conversation

@chitters2004

Copy link
Copy Markdown
Contributor

What

ShaderInputInfoBuilder copied all 32 SPI_PS_INPUT_CNTL settings into the pixel input info. An interpolation read of an attribute at or beyond the programmed interpolatorCount then took its default value from a setting the hardware never consults, while the recompile cache key (CacheKey.hpp) hashes only the settings below the count. Two pixel stages that differ only past the count compiled to different SPIR-V under one key, so the shader disk cache could serve either one.

Mesa (radeonsi, RADV), PAL and LLPC program SPI_PS_INPUT_CNTL only below NUM_INTERP, and no source defines a read past it. ShaderInfoCollector already treats such reads as the zero default. The builder now copies only the programmed settings and leaves the rest zero, so every reader agrees with the count-gated key. +4 lines, -3 in ShaderInputInfoBuilder.cpp, plus a test in tests/Graphics.cpp (interpolatorSettingsPastCountTests) that recompiles five count/setting pairs and requires equal cache keys to give equal SPIR-V and the programmed cases to stay distinct.

Tested

Checklist

  • Based on current main (9b11f42); 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: lavapipe (Mesa, fork CI Linux and Windows); no physical GPU run
  • AI-assisted: yes

🤖 Generated with Claude Code

ShaderInputInfoBuilder copied all 32 SPI_PS_INPUT_CNTL settings into the
pixel input info. An interpolation read of an attribute at or beyond the
programmed count then took its default value from a setting the hardware
never consults, while the recompile cache keys hash only the programmed
settings. Two pixel stages that differ only past the count compiled to
different SPIR-V under one key, so the disk cache could serve either.

Mesa (radeonsi, RADV), PAL and LLPC program SPI_PS_INPUT_CNTL only below
NUM_INTERP, and no source defines a read past it. ShaderInfoCollector
already treats such reads as the zero default. The builder now copies
only the programmed settings and leaves the rest zero, so every reader
agrees with the count-gated keys.
@github-actions github-actions Bot added shader core/shader agc libSceAgc* labels Nov 19, 2026
@Doorriiaann

Copy link
Copy Markdown
Contributor

NVIDIA run of the Tested selection plus the interpolation tests: no regression.

Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base 9b11f42, head is 56a33da. ANYPS5_GPU=NVIDIA ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest -R '^(agc_driver_graphics|agc_driver_mesh_provoking_vertex|agc_driver_pixel_barycentric_emulation|agc_driver_provoking_vertex|agc_driver_interpolation.*|agc_shader_disk_cache)$' -V, 3 runs each.

base this PR
agc_driver_graphics, agc_driver_provoking_vertex, agc_driver_mesh_provoking_vertex, agc_driver_pixel_barycentric_emulation, agc_driver_interpolation_modes, agc_driver_interpolation_f16, agc_shader_disk_cache 3/3 pass each 3/3 pass each

Every run selects the RTX 3070; every Vulkan test's log shows the layer inserted, none reports it missing, and no log has a VUID- line.

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 — looks good

Nothing blocks this change; the implementation matches the count-gated cache key and existing zero-default handling.

What I ran

Reviewed head 56a33daf8641fb9cbbb131d1111bd93cfec52900. I inspected the prepared diff and source context using repo_read.py; no tests were run.

Results

Check Result Note
Diff and source review passed Both changed files inspected
Tests not run CI results are author-reported
Negative control not run Author-reported only

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full text of core/libs/prx/libSceAgcDriver/tests/Graphics.cpp was read only around the added test and its invocation, not in full; the modified ShaderInputInfoBuilder.cpp lines and relevant collector, input-info, and SPIR-V caller context were read. Graphics.cpp was excluded from the prepared review folder because it was too large. I did not run tests or independently verify the author-reported CI or negative-control results.

To get this to a good state

Nothing is required.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

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 1395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8246 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9712 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9895 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9897 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9915 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10351 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11551 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 11825 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14032 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14473 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 15570 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17056 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 17611 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 19821 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 20010 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 20111 core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 20153 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 20845 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23252 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 23258 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 23281 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 23553 core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 23818 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 24049 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 24083 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24327 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 24781 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 25010 core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
PR 25534 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 25557 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 26084 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 26197 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 26630 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 26706 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 28142 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@AbuMshMsh24

Copy link
Copy Markdown
Contributor

First AMD hardware run for this, on the Tested selection plus the other interpolation tests. No regression, and the mesh case that fork CI skips runs here.

Setup: Windows 10 22H2, AMD Radeon RX 9070 XT (RDNA4, 0x1002:0x7550), AMD Software 26.11.2 (32.0.32029.2010), WinLibs GCC 15.2.0 r7, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, Khronos validation layer 1.4.363.1 (VK_LOADER_DEBUG=layer shows it inserted). Head 56a33daf86 merged onto main 42f6354612 with --no-ff (clean).

Tests main this PR
agc_driver_graphics, agc_driver_provoking_vertex, agc_driver_mesh_provoking_vertex, agc_driver_pixel_barycentric_emulation, agc_shader_disk_cache, agc_driver_interpolation_modes, agc_driver_interpolation_f16, agc_driver_pixel_exec_interpolation, agc_interpolant_mapping, agc_vop3_interp_decode all pass all pass
  • agc_driver_mesh_provoking_vertex runs on this device (mesh shaders are available on RDNA4 with this driver) and passes in both arms.
  • 0 VUID- lines in either log.
  • Negative control: this PR's tree with only ShaderInputInfoBuilder.cpp taken from main fails agc_driver_graphics 3 of 3 runs with interpolator count 1 with setting 768 past the count compiled differently under an equal cache key, so the new case catches the old behaviour here too.

AI-assisted: yes (Claude Code)

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 56a33daf86, applied with git apply on main fd4aeed483 together with the other 26 PRs of one batch (#16367, #16415, #22363, #23103, #23366, #24064, #21547, #21742, #22774, #22852, #23420, #24346, #16945, #21718, #21780, #21912, #21931, #22061, #22425, #22619, #22657, #18765, #19662, #19767, #20899, #21571). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
agc_driver_graphics, agc_driver_graphics_dump_graphics, agc_driver_prepared_graphics and 3 more (6 tests, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6523 tests) on the RTX 3080 has 4 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. The 2126 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@Jirka135

Copy link
Copy Markdown
Contributor

Windows run on RTX 50 and an RDNA2 iGPU, with a red check. Head 56a33daf86 merged onto main 35e39b5c5b with git merge --no-ff --no-commit (clean).

Setup: Windows 11 Enterprise 10.0.26300, Ryzen 7 9800X3D, WinLibs GCC 15.2.0, Release. NVIDIA GeForce RTX 5090 (10de:2b85), driver 617.42, and the AMD Radeon(TM) Graphics iGPU (1002:13c0), selected with ANYPS5_GPU. Khronos validation layer 1.4.369. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R '^(agc_driver_graphics|agc_driver_provoking_vertex|agc_driver_pixel_barycentric_emulation|agc_driver_mesh_provoking_vertex|agc_shader_disk_cache)$' -V, 3 runs with the layer and 3 without per arm and GPU.

RTX 5090 AMD iGPU
main 5/5 (6/6 runs) 5/5 (6/6)
main code + this PR's tests/Graphics.cpp hunk agc_driver_graphics fails 6/6: interpolator count 1 with setting 768 past the count compiled differently under an equal cache key same, 6/6
this PR 5/5 (6/6 runs) 5/5 (6/6)

Every layer log of a test that opens a Vulkan instance shows Insert instance layer "VK_LAYER_KHRONOS_validation", none shows was not found but was requested by env var VK_INSTANCE_LAYERS, and no log has a VUID- line.

GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11; AMD Radeon(TM) Graphics (Ryzen 7 9800X3D iGPU), driver 32.0.21045.29003, Windows 11

AI-assisted: yes

@Script-hpp

Copy link
Copy Markdown
Contributor

Tested on Intel Arc B390 (Mesa 26.2.7 ANV, Linux 7.2.10), PR head 56a33daf86 merged into main 8c254da48b, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer:

  • ctest -R '^agc_driver_graphics$' -V: pass. This test does not open a Vulkan device (the loader log has no layer insertion), so it checks the preparation path only, not ANV itself.
  • Control: the changed Graphics.cpp alone on main fails with expected graphics rejection: invalid prepared fragment export packing, so the test catches the bug here too.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit fc9bc1e into boykopovar:main Nov 29, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants