fix(agc): read uncompressed FMASK images from guest memory #6674
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6674"
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 veosett on 2026-10-16T03:52:40Z.
What
A direct FMASK load returns
0x76543210even when the stored mapping is zero,0x11111111or0x11111100(#3219). Remove the synthetic FMASK runtime mode and bind supported FMASK reads as ordinary integer sampled images. The existing texture upload, synchronization, cache and channel mapping then supply the stored value.This supports uncompressed
Fmask32_S8_F8, one mip, 2D/2D-arrayZ_64KB_Xsurfaces and X/zero/one destination selectors. PAL's FMASK surface conversion uses the format's bit depth with one sample/fragment and an ordinary 2D surface; its 32-bit view selectors select X and zero. Other FMASK formats, CMASK compression, packed accesses and unsupported layouts/selectors throw. These limits and the absence of native RDNA/PS5 measurements are recorded in shader technical debt.Addresses #3219's fixed-result bug and missing refusal for unsupported compression. Compressed FMASK/color sampling remains unimplemented, so this does not claim to resolve the issue in full or advance PPSA99902 startup. The regression follows Amoenus' public reproducer, with additional nonuniform pixels, array views and cache checks; no unpublished implementation was used.
IsFmaskTextureFormatis a pure classification of its argument in the already-hashed recompiler sources. Its new graphics-side call is listed in the shader-cache dependency review; it introduces no additional cache-key input. The existing source hash invalidates compiled artifacts from the removed runtime mode.Tested
Base
main9caecfd2d; tested head9b42649a9, merging main into the existing PR branch without rewriting its original commits. Release, bundled dependencies, SPIRV-Tools enabled.libsand all selected test targets build; 9/9 focused CTests pass in 21.34 s, plusshader_cache_native_paths1/1 in 1.22 s. No skips./dev/udmabufis unavailable; the existing copy path is used.agc_driver_image_repacked_float, which exercises main's float path.main5d9dcc42d: the new FMASK execution test fails on both hosts withFMASK load did not read its mapping: round 0, lane 0, component 0(0.85 s Windows / 0.66 s Linux). The public probe also reproduces the incorrect raw and CMASK results on both hosts. These are the pre-refresh controls, not a new run on the refreshed base.Not run: titles, graphics-stage FMASK execution, the full CTest suite, native RDNA/PS5 instruction measurements. No game-unblock or performance claim.
Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T04:34:55Z.
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.
main)core/shader/recompiler/Optimization/src/ResourceMaterializer.cppL255core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL7033docs/dev/debt/shader.mdL38Some 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.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/CMakeLists.txtdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvDescriptors.cppcore/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppdocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mdcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cppcore/libs/prx/libSceAgcDriver/tests/GuestTextureResource.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppdocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvDescriptors.cppcore/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T15:30:10Z.
Review: COMMENTED
NVIDIA run, since the PR was tested on AMD and lavapipe.
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. Headd2e09ede6merged ontomain0615cd2b8, clean merge (maindid not build at the time, #6784).GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
RTX 3070:
main's sources):agc_driver_fmask_image_reads,agc_shader_memoryandagc_driver_graphicsall fail. The execution test stops withFMASK load did not read its mapping: round 0, lane 0, component 0, the same message as on your hosts; the other two withFMASK did not select a bound integer image modeanduncompressed 32-bit FMASK did not use an integer Z surface.agc_driver_fmask_image_reads0.31-0.38 s).ctest -R "^agc|shader|recompiler" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64|display|flip" -j1 --timeout 60: 614 tests, onlyagc_driver_store_over_untrackedfails, which also fails on unchangedmainhere (#6347).agc_driver_stencil_ref_exportskips (noVK_EXT_shader_stencil_exporton this GPU).lavapipe (
VK_DRIVER_FILES=.../lvp_icd.json ANYPS5_GPU=llvmpipe):agc_driver_fmask_image_readspasses 3/3, newer Mesa than the 25.2.8 in the description.Not checked: the other five tests in your focused set by name (they are inside the suite above on the 3070, not run on lavapipe), Windows, titles.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-17T11:30:39Z.
Windows data point: head
d2e09ede6as-is, Release, Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7.agc_driver_fmask_image_readspasses on both devices of this host, chosen withANYPS5_GPU:1002:164e, AMD Windows driver): 3 of 3.Not checked: other tests, titles.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T09:06:43Z.
Checked the diff against the description: the synthetic FMASK mode is removed, uncompressed
Fmask32_S8_F8reads go through the normal integer image path, and every other format, CMASK compression, packed access and layout/selector throws. The new driver-side call is inshaderCacheReviewedNamesand the limits are indocs/dev/debt/shader.md.The only conflict with
mainwas theshaderCacheReviewedNameslist (next to the newPipelineSpecialization::*entries); I mergedmaininto the branch and kept both. The merge queue's full Build runs on the result. The NVIDIA/Windows runs in the thread also passagc_driver_fmask_image_reads.Not verified here: native RDNA/PS5 results of FMASK loads, and titles.