fix(shader): read 2D textures through MSAA image loads #6815
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6815"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-16T13:05:48Z.
What
Cocoon (PPSA08766, #6651) reaches a fragment program with DIM 2D_MSAA
image_loads bound to an ordinary 2D T#. Main refuses it withimage descriptor is incompatible with the static runtime image interface: the descriptor is 2D, while all compiled modes are multisampled.For a mip-less 32-bit image load, add the ordinary 2D runtime mode. The existing emitter then reads x/y at the viewed base level and ignores the sample operand, as the measured hardware does. The genuine MSAA mode remains available. This does not change stores, atomics, A16 or mip-bearing addresses, packed accesses, converted formats, depth-bit views, array-MSAA addresses or image-table handling.
Only five production lines change. No new metadata fields, request version or runtime ABI is introduced; the existing shader-source version invalidates old artifacts.
Hardware evidence
Measured directly with
tools/hw-oracleon RX 6650 XT, gfx1032: wave32 and wave64, R32_UINT / R32_FLOAT / RGBA8_UNORM / RGBA8_SRGB, sample indices 0, 1, 2, 7, 31 and 0xffffffff, and in-range plus out-of-range x/y. Every one of 768 rows matches the same ordinary DIM 2D load on the same 4x4 linear 2D T#. Integer/float markers separate the addressed texels; out-of-range coordinates return zero.All FP controls were explicit: IEEE 0, DX10 clamp 1, denorm32 0, denorm16 3, round32/16 0, FP16 overflow 0. This is gfx1032 evidence, not a console/gfx1013 measurement. The scope and remaining refusals are recorded in shader debt.
Tested
Standalone head
d513fb987f731207cbd5503ec3ceccceb7bbc9f0: two linear commits on main82ddae75b676, no dependencies. Arch Linux 7.2.9-arch1-1, GCC 16.2.1, Ryzen 9 7950X.libsand all four selected test executables build.agc_driver_image_msaa_address_on_plane,agc_shader_memory,agc_driver_image_volume_address_on_plane,agc_driver_sample_multisample_target.ResourceMaterializer.cppwith main's version, retaining the final test; it fails at the original static-runtime-image-interface refusal. Restore the fix and rebuild: the selected tests pass.Related #6635 adds genuine multisampled-array image views; it does not implement ordinary 2D T# loads and is not a dependency.
Independent NVIDIA validation
jotitadev tested this head merged onto main
bc400bedeon an RTX 3070, NVIDIA 595.99.02 / Vulkan 1.4.329, Ubuntu 26.04 (kernel 7.0.0-38), GCC 15.2. The four selected checks passed in three runs on NVIDIA and three runs on lavapipe Mesa 26.0.3 / LLVM 21.1.8. The new check exercised all four formats on NVIDIA. With the test retained and main'sResourceMaterializer.cpp, the new check failed on both devices; the other three passed.Their broader NVIDIA run covered 616 tests.
agc_driver_store_over_untrackedfailed on both this change and unchanged main (#6347);agc_driver_stencil_ref_exportskipped. They did not test Windows, titles, or additional hardware-oracle rows. These are the reviewer's results, separate from the local Radeon measurements above.Native bring-up
The Cocoon diagnostic stack carries #6639/#6801, #6653 and #6743. They are not code dependencies of this PR. Baseline
c283a7718396refuses the descriptor at 4.03 seconds. Integrationb83e429e7613, which adds only this change and its regression, builds full runtime libraries and passes 7/7 focused checks. The title passes that image refusal and aborts at 6.03 seconds on a separate missingPA_SU_POINT_SIZEcontext register. Both runs exit 134 and restore temporary settings. No matching game window or visible gameplay is confirmed.Hardware rows, reproduction script, exact sources and sanitized validation. A separate private capture of the failing fragment request contains 136 code words and two DIM 2D_MSAA loads; no guest bytes, memory capture or full title logs are published.
No FPS, load-time gain, newly playable title, Windows or console result is claimed. Full hosted CI remains for collaborator dispatch.
A separate isolated Override 2 (PPSA01907 v01.007.000) check restacks these two unchanged topic commits onto main
66e290f1cas66a91f2c2. Fulllibsbuilds; the new GPU test passes 1/1 on RADV and 1/1 on lavapipe, zero skips. Both native runs exit 0 and restore temporary settings. The cold-cache run only supplies startup captures; the warm follow-up reaches the menu but its 85 s capture still has very dark 3D output. This change does not resolve that observation, and no Override compatibility or performance gain is claimed. The 19 locally captured compute requests replay successfully; they do not cover the active graphics requests. Sanitized report and screenshot:image-msaa-main66-validation-public.json,image-msaa-main66-menu.png.Current-main refresh (2026-10-19 UTC)
Rebased the two topic commits onto main
659230f7b676e8c848d70640f823342be6704526, head72959f7c0055c20871ed207868746f928e9cc26f, without merge commits. The sole conflict was additive shader debt; both the upstream VCC-sampler entry and this MSAA-load entry are retained. The five production lines and regression semantics are unchanged.Full runtime
libsand all four selected test executables build. With required Vulkan andVK_LAYER_KHRONOS_validation, the same four checks pass without skips on RX 6650 XT / RADV Mesa 26.2.4-arch1.1 (3.36 s total) and lavapipe Mesa 26.2.4-arch1.1 / LLVM 23.1.1 (3.79 s total), Arch Linux. Conventions and whitespace checks pass. Earlier hardware measurements, negative controls and collaborator runs above are historical evidence, not rerun measurements on this head. No additional title or performance result is claimed.Contributor-reported Windows/NVIDIA validation by klosixgaming-arch: head
72959f7c0, two commits, cleanly merged onto mainad502d717; Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce RTX 5090 driver 617.42, Ryzen 9 9950X3D.agc_driver_image_msaa_address_on_planepasses with the fix and fails with only the test on main at the descriptor-format-20 incompatibility named above. The contributor also reviewed the five-line production restriction. They did not test Cocoon or rerun the author’s gfx1032 hardware oracle. These are independently reported results, not local Windows runs; their review was AI-assisted and human-reviewed.Reviewer-reported Apple compatibility (2026-10-19)
jotitadev tested head
72959f7c0on Apple M2 Max under Rosetta with MoltenVK 1.4.2 and MoltenVK main plus SPIRV-Cross #2704. The MSAA-address-on-plane, shader-memory and volume-address checks pass three times on both drivers; the multisample-target check skips because storage image multisampling is unavailable. Reverting the production change fails the new test on both drivers. Their old absolute-oracle comparison also fails for four sRGB texels, while the current encoded-byte comparison passes.This is reviewer-provided evidence from main
a373e85e5plus the macOS series, build prerequisites, several other PRs and a test-loader patch, as listed in that review; it is not a plain-main macOS build, our local execution, or a title/performance claim. No source change is requested by this report.Independent Windows main/change title result: parl0v tested Cocoon PPSA08766 01.004.000 on Windows 10 (19045), NVIDIA RTX 3060 12 GB driver 617.42, main
64e2a810aand main plus this PR72959f7c0. Main aborts on the static runtime image-interface mismatch; with this PR that refusal is gone and the run reaches the geometry-output refusal covered by #6801. Contributor report. Contributor-reported evidence, not independently reproduced on Windows; no gameplay claim.Checklist
main; no duplicate ordinary-2D load implementation foundImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T13:37:15Z.
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.
core/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T15:30:18Z.
Review: COMMENTED
NVIDIA run, since the description lists NVIDIA as not run.
Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04 (kernel 7.0.0-38), i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Headd513fb987merged ontomainbc400bede, clean merge.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
Set:
agc_driver_image_msaa_address_on_plane,agc_shader_memory,agc_driver_image_volume_address_on_plane,agc_driver_sample_multisample_target,-j1 --timeout 60.ResourceMaterializer.cppfrommain):agc_driver_image_msaa_address_on_planefails on both devices withimage descriptor is incompatible with the static runtime image interface: descriptor format 20 .... The other three pass.ctest -R "^agc|shader|recompiler" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64|display|flip" -j1 --timeout 60: 616 tests. Onlyagc_driver_store_over_untrackedfails, and it fails on unchangedmainbc400bedehere too (#6347).agc_driver_stencil_ref_exportskips.Not checked: Windows, titles, any hardware oracle rows beyond what the test pins.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T21:31:31Z.
A data point from PPSA01317 on current main (Windows 11, RTX 5090 Laptop): this PR fixes one of its aborts. After about 50 s of boot, a shader does multisample image loads on a plain 1x1 2D R8 texture, and main refuses that. With this PR's two commits cherry-picked, the title gets past it, to about 900 to 1,100 frames.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T22:50:48Z.
RTX 4090 data point on PPSA01317, on top of today's runs on D4697 (same box, same stack): with this PR the
image descriptor is incompatible with the static runtime image interfacerefusal onshader 0x1258db5000is gone, 3 of 3 runs, and the title's next stop is the DIM 1D size query of a cube T# that #7550 describes.Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release
libstarget only (no tests built).app.exeis the relink frommain31cbb55d7(--windows --registry --module-dir .); onlylibs/is swapped between runs. Tree:main48d61f53b(2026-10-18; it already carries #7137, #7207, #7175, #7238, #7240, #7271 and #7626) + #7256 (which brings #7254) + #7243 + #5958 + this PR's head d513fb987, every merge clean (the #5958 and #6815ResourceMaterializer.cpphunks do not touch), f9aef6b11. Three local environment-gated lines on top, none of which changes a result: a bypass that makessceHmd2Initializeanswer0x81110016again (currentmainaborts 5 to 12 s in onsceHmd2ReprojectionQueryBufferSizeAlign not implemented, the #7323 regression), a print ofsceSslConnect's return, and a display-buffer print for #6350 that was off here. No controller, no input, one-shot interactive task per run, 300 s cap, box otherwise idle.Result. The control (same tree without this PR, four runs earlier today) aborts 36 to 37 s after launch, every time, on
(a 2D 8-bit T#, TYPE 9, read by a pixel shader whose only compiled modes are 2D MSAA). With this PR that shader compiles and runs in all three runs; no refusal of that wording anywhere. The runs then diverge in time, not in outcome:
shader 0x1258db5000 stage 5: image descriptor is incompatible with the static runtime image interfaceshader 0x126f962f00 stage 5: image address has too few coordinate componentsRuns 2 and 3 both end on
ResourceMaterializer.cpp's 1D refusal. #7550 (gjonn) names this title and this situation: a pixel shader runsimage_get_resinfowith DIM 1D on a 64x64 cube T#, and the tracker's 1D image has no mode for a cube descriptor. So on this box the open-PR chain for the title now reads #7243 -> #7254 / #7256 -> #5958 -> this PR -> #7550.Two observations on the way there, neither caused by this PR as far as I can tell: the screen stays black after the "Sony Interactive Entertainment presents" splash in all runs (title-bar counter 59.94 FPS at 476 frames at +15 s, 12 FPS at about 1,320 frames by +35 s), and the frame counter stops advancing for long stretches (run 1: 860 frames from +50 s to the 300 s kill; run 2: 1,327 frames from +50 s to at least +180 s, then the abort at 247 s) while the guest keeps streaming textures. Run 1 was the cold run, so it may be the same cold-cache stall I saw on #7238; run 2 was warm, so it is not only that. Run 3 reached the same shader in 43 s without the pause.
sceSslConnect(nowmain's #7626) returnsSSL_ERROR_WANT_POLLINtwo to four times and thenSSL_ERROR_UNKNOWN_CAon each of the title's seven connections in all three runs; the title goes on.stderr of run 3 (warm, box idle) from the save-data mount to the abort, the per-shader
ShaderRegistrylines, thesceKernelOpenmisses and the cache and texture bookkeeping removed, the[shadow]lines collapsedAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-19T00:57:19Z.
Review: APPROVED
Tested on Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce RTX 5090 (driver 617.42), Ryzen 9 9950X3D. Head
72959f7c0(two commits) merged onto currentmain(ad502d717); clean merge. I first tested the earlier headd513fb987with the same result and re-ran after the force-push.agc_driver_image_msaa_address_on_planepasses with the change.mainwith only this PR's test file it fails withimage descriptor is incompatible with the static runtime image interface: descriptor format 20 decodes to {class 2, dim 3, ...}, the refusal quoted in the description, so the new test fails without the fix and passes with it.ResourceMaterializer::RuntimeImageModes): it adds the ordinary 2D mode only for a 2D_MSAA image that is mip-less 32-bit and is not a table, storage, depth, converted or packed access, so everything else keeps its previous refusal. The hardware-oracle table in the description is the author's measurement on gfx1032; I did not rerun it.Not tested: Cocoon (PPSA08766); I have no dump, so the title claim is the author's.
AI-assisted: yes. Written with AI assistance and reviewed by me.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T04:28:27Z.
Review: COMMENTED
Apple GPU / MoltenVK run of the new head.
agc_driver_image_msaa_address_on_planepasses on Metal with all four formats. Apple is a third driver whose sRGB decode differs from the Radeon oracle, so the switch to comparing encoded texels in72959f7c0is needed here too.Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head
72959f7c0, PR diff applied cleanly. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704.Tested: the tree is
maina373e85e5+ mugurc's macOS series (ci/macos-series-2) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plainmain(it doesn't build on macOS yet). Also in the same build: #7725, #7729, #7717, #7694, #7682, #7731 and #6815 (they applied cleanly together), plus a test-only patch that lets nine AGC fixtures load the Vulkan loader on macOS (branchjotitadev:fix/agc-tests-vulkan-loader-macos). Base on that tree: 40^agcfailures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704.agc_driver_image_msaa_address_on_plane,agc_shader_memoryandagc_driver_image_volume_address_on_planepass 3 of 3 on both drivers.agc_driver_sample_multisample_targetskips here (storage image multisampling unavailableon MoltenVK).With
ResourceMaterializer.cppback to the base, the new test fails on both drivers withimage descriptor is incompatible with the static runtime image interface.With the test as it was at d513fb987 (absolute tolerance 0.0001 against the oracle), it fails on both drivers with
MSAA-address normalized load differs from the Radeon oracle. Only format 130 (sRGB) differs, on 4 of the 9 texels:Apple stays within about 1e-4 of the exact decode, and the oracle's values are quantized (
0x3f090000). The encoded 8-bit texel matches in every case, so the current check passes.Full
^agcsuite with the stack: the base failures on each driver, plusagc_driver_pooled_buffer_rangeandagc_performance_overlay, which only run because of the loader patch. Nothing from this PR.GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704)
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-19T10:02:10Z.
Tested on Windows 10 (19045), RTX 3060 12 GB (NVIDIA 617.42), Cocoon PPSA08766 01.004.000,
main64e2a810awith this PR (72959f7c0) merged locally:mainalone aborts at 77 s withimage descriptor is incompatible with the static runtime image interface(shader 0x21e20e500 stage 5, descriptor dim 2D, every compiled mode 2D MSAA).VGT_GS_OUT_PRIM_TYPE other than a triangle strip, or a line strip from a geometry program, is unsupported(VGT_SHADER_STAGES_EN=0x2030), which #6801 covers.Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T10:21:42Z.
Thanks for the Windows main/change comparison. I have added your machine, revisions, and observed result to the description, explicitly attributed to your report. It confirms this PR clears the descriptor/interface refusal; #6801 addresses the next geometry-output refusal. Your follow-up on #6801 reaches the separate point-context-defaults path covered by #6821. No gameplay or fully working Windows title claim is made.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T19:07:31Z.
Checked the diff: the new runtime mode is limited to mip-less 32-bit non-storage, non-depth, non-packed, non-converted, non-table
image_loads, everything else keeps the old refusal. The regression covers wave32/wave64 and four formats, compares against the ordinary 2D load bit for bit, and fails without the change (also confirmed by the NVIDIA, Windows and Apple runs in the thread). The measured gfx1032 behaviour (sample index ignored, out-of-range reads zero) is recorded in shader debt. Merged.