Skip to content

fix(agc): class an image table entry by the format of the view it samples - #28451

Open
Remi-Bon wants to merge 1 commit into
boykopovar:mainfrom
Remi-Bon:fix/table-border-view-class
Open

Remi-Bon wants to merge 1 commit into
boykopovar:mainfrom
Remi-Bon:fix/table-border-view-class

Conversation

@Remi-Bon

@Remi-Bon Remi-Bon commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Chef · project thread

What

An image table entry paired with a clamp-to-border sampler is refused when the sampler's border colour numeric class disagrees with the image class. That class came from SampledTextureNumericClass of the guest format. This function classes Format11_11_10Float and Format10_11_11Float as Uint, because the shader conversion path reads them as raw words. A sampled table entry of these formats, however, gets a native VK_FORMAT_B10G11R11_UFLOAT_PACK32 view and is sampled as float through the float-border sampler. Every such entry was therefore refused, and it read zeros.

The class now comes from the format of the view the entry is sampled through (IntegerFormat(texture->ViewFormat())). A depth/stencil view keeps the guest class, because its view format does not say whether the stencil plane (guest 8UInt) or the depth plane is sampled. IntegerFormat (Texture.cpp) is declared in Texture.hpp for this use.

Formats with a conversion view are unchanged: 6E4Float and the 11_11_10, 10_11_11 and 2_10_10_10 UNorm and UInt formats still get an R32_UINT view, so they stay integer. Depth-bits entries still get an R32_SFLOAT or R16_UNORM view, so they stay float.

A real integer image with a float-border sampler is still refused. Pairing that case is the subject of #28321, which touches the same check.

Tested

  • Windows 11, AMD Radeon RX 9070: ctest -R ^agc_driver_image_table (31 tests) on main and on this branch, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer. Result: 31/31 on both. Both logs show the loader inserting the layer, and there are 0 VUID- in each.
  • New case in agc_driver_image_table (border numeric class loop): a Format11_11_10Float table T# behind a float-border direct S#. It must not fault and must match a direct-T# control. It fails on main with the refusal and passes here.
  • Linux, Docker (Ubuntu 24.04, Mesa lavapipe): agc_driver_image_table passes. agc_driver_image_table_variants fails there on main too ("a table whose borrowing entry shares a cached representative was resolved again"), without userfaultfd. This is unrelated to this change.
  • Gran Turismo 7 (PPSA01317), Gran Turismo Café, runs of about 6 minutes with the same settings, before and after:

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: AMD Radeon RX 9070, AMD driver 2.0.416 (Vulkan 1.4.359), Windows 11; Mesa lavapipe (Ubuntu 24.04, Docker)
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • Improved image-table sampler validation for integer and stencil formats.
    • Ensured packed 11-11-10 floating-point images produce matching results when sampled directly or through an image table, without triggering a table fault.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Image-table format classification

Layer / File(s) Summary
Format validation and sampling test
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp, core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
The public API declares IntegerFormat(VkFormat). Image-table validation uses the shader numeric class for stencil formats and the view format’s integer classification otherwise. The test compares direct sampling and table sampling for 11_11_10 float images.

Possibly related issues

Possibly related PRs

Suggested reviewers: marczx10, eaglebearerys, pipodi

Change: Bug fix

Merge Risk: Minimal · up to 95581

This change lets table entries for 11_11_10 float images be sampled instead of refused and read as zeros. The remaining case, a real integer image paired with a float-border sampler, is deliberately left to a follow-up. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 95581

The change fixes valid packed-float image and sampler pairings without removing the check that rejects incompatible pairings. The reviewed change does not establish a material increase in security or operational risk.

Security review details

Security Blast Radius

  • inferred — The inspected change affects whether an existing sampled image-table entry is bound or refused for a clamp-to-border pairing. It does not change which guest address is decoded or how a texture is selected.

Trust Boundaries and Controls

  • observed — The resolver still rejects a clamp-to-border sampler whose numeric class disagrees with the selected image class. It records the refusal before descriptor placement and leaves the neighboring sampler checks unchanged.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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: a9042566-2a2f-4347-b2aa-b7ab0f321fb6
Commits

Reviewing files that changed from the base of the PR and between 76d0a4a and 955816d.

Files selected for processing: 3

  • core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
  • core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
  • core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp

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

@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 changed image table check uses the sampled view format for color images and retains the guest numeric class for stencil views; I found no blocking defect.

What I ran

Reviewed head 955816d1b26c0aacbde78fa3b1e6d3b634c97eeb using repo_read.py to inspect the diff and relevant source ranges. I ran no tests or build commands. The Windows and Linux test results in the PR description are author-reported, not independently verified.

Results

Check Result Note
Changed code review passed All three changed files inspected
Tests not run No tests run during this review

Negative control

Not run; no tests were run during this review.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

Read the changed declaration in Texture.hpp, the changed sampler check in ShaderResources.cpp, and the added test case in ImageTable.cpp, plus relevant format and view helpers. files.json lists all three changed files as reviewed and no files excluded by rule; the full ShaderResources.cpp text was not included, and only the relevant source range was read. Runtime behavior, test results, and console behavior were not independently verified.

To get this to a good state

Nothing is required.

@github-actions github-actions Bot added the agc libSceAgc* label Nov 30, 2026
@JJenkx

JJenkx commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Windows at this head (955816d1b26c): agc_driver_image_table, agc_driver_nested_image_table, agc_driver_nested_image_table_large, agc_driver_nested_image_table_budget, agc_driver_nested_sampler_table, agc_driver_pointer_phi_sampler_table, agc_driver_pointer_phi_ballot_table, agc_driver_pointer_phi_copies_table, agc_driver_pointer_phi_lane_and_table, agc_driver_pointer_phi_high_table, agc_driver_pointer_phi_high_second_lane_table, agc_driver_pointer_phi_lane_not_table, agc_driver_pointer_vsharp_select_table, agc_driver_nested_image_table_shared_scan pass, 3/3 runs. These are the CTests built from the changed ImageTable.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.

@github-actions

github-actions Bot commented Nov 30, 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 24523 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp L61
PR 28090 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp L922
PR 28321 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp L922
PR 29095 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp L922

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/Graphics/include/Texture.hpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6340 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 9318 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9633 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9790 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9969 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10492 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10743 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 12575 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 12746 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 12944 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 13251 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 13809 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 14853 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 15136 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 15548 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 15555 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 16879 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 16935 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 16953 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 18106 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 18107 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 20041 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 20063 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 20728 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 21199 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 22424 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 22439 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 22531 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 22647 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 23242 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 23674 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 24661 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 24735 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 27171 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28119 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 28176 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28469 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 28470 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 28487 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 28488 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28586 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28659 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28668 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28673 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 28786 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28787 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 28970 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29085 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 29089 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 29098 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29106 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 29107 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 29110 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29113 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29115 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29116 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29117 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29119 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29120 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 29121 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
PR 29123 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp

@ycbuzi

ycbuzi commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Tested 955816d1b2 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, 4 tests failed out of 7492; 99% tests passed, 2 tests failed out of 7492. 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 7492; 100% tests passed, 0 tests failed out of 7492. run

GPU: 4 GPU tests (AGC) passed twice on a GTX 1650 SUPER (Windows 11, Vulkan required, validation layer on, shader cache off), with this pull request merged into main c776c9ec94. No Vulkan validation message appears that main does not also produce on the same GPU.

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@videogamer10293

Copy link
Copy Markdown
Contributor

NVIDIA results for this head (955816d1b2), since the description's GPU run is on AMD.

Machine: Windows 10 (10.0.19045), RTX 5070 Ti, NVIDIA 621.24, WinLibs GCC 15.2.0. This PR was merged locally with --no-ff onto main 75b480e9c7 (7abc250ab3), against that main.

ctest -R ^agc_driver_image_table -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (nightly layer build 13e1d19f), VK_LOADER_DEBUG=layer and implicit layers disabled:

  • main and this PR: 31 of 31 passed on each.
  • This PR with the fix reverted (ShaderResources.cpp and Texture.hpp from main, the test kept): 30 of 31. agc_driver_image_table fails with AGC graphics: image table border numeric class 0: an 11_11_10 float table T#, sampled through a float view, was classed as an integer image:.
  • This PR restored and rebuilt: 31 of 31 again.

Each of the four logs shows the layer inserted 32 times, no was not found but was requested line and no VUID-.

PPSA38500 (01.002.001) never logs this PR's refusal (an image table entry's sampler border color numeric class disagrees) in three runs per side, with and without it. Its border refusals are the sampler-table ones (#28090, #27648). Those title runs were on main + #27590 43bedd0782, which the title needs to boot.

Not covered: a title run that hits this refusal; other GPUs and Linux.

AI-assisted: yes.

@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.

I read the diff at 955816d1b2. Windows 11, GCC 15.2, merged into main at b97867d3ce6 together with other open PRs (so not an isolated build), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_LAYER_KHRONOS_validation on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).

  • the 14 tests of agc_driver_image_table_tests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a VUID- or SYNC-HAZARD line.
  • Control (same tree and tests, the changed files of those PRs put back to main's): agc_driver_image_table fails on both GPUs: "an 11_11_10 float table T#, sampled through a float view, was classed as an integer image". The other 13 pass.

Not checked: a title.

AI-assisted: yes (Claude Code)

@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.

Ran the same agc_driver_image_table and agc_driver_gcn_scalar_buffer_base CTests on main and this head integrated using Mesa lavapipe. Both scalar controls passed. The changed image-table run reached the later depth-storage cases, so the new packed-float assertions completed. The image-table suite exceeded its 30-second CTest timeout on both runs. Both logs show Khronos validation 1.4.369 being inserted, with no missing-layer diagnostic or VUID- messages before the timeout.

AI-assisted: yes.

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*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants