fix(shader): read an image the same shader stores to through its storage binding #26593
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26593"
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 Jazeupoi on 2026-11-24T08:37:07Z.
What
An
image_loadof a T# that the same shader alsoimage_stores to reads a separate sampled binding (the debt recorded in #22719), so a load after a store of the same texel returns the value from before the dispatch. RDNA2 hardware returns the stored value.When the load and the store use the same descriptor, the load now reads the storage binding with
OpImageRead. A per-image specialization constant chooses it at pipeline creation, so the SPIR-V has the redirected read and the original fetch side by side.VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BITper guest format throughVK_KHR_format_feature_flags2; the mask goes intoSpirvTargetand the cache key.R32_UINTview, and the shader's existing unpack applies.New test
agc_driver_image_load_after_store: one dispatch stores to a texel and loads it back, for 32_UINT, 32_32_32_32_UINT, 8_8_8_8_SINT, 16_16_16_16_SINT, 16_16_16_16_FLOAT and 2_10_10_10_UINT, and checks that the other texels keep their pre-fill.No known game or homebrew is affected: 22 homebrew titles never hit the case. PS5SX2's ROV mode would (
tfx.glslloads and stores the same color and depth images), but its PS2 side stops on Windows at anSA_SIGINFOhandler (libkernel debt) before it draws, so it could not be used.Tested
Windows 11 Pro (build 26300), NVIDIA GeForce RTX 2060.
VUID-/SYNC-). It runs a case only when the device can read that format through a storage image without a format (StorageImageReadWithoutFormatand the format'sVK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT), the same condition as the redirected read, and is skipped when no case can run.mainagc_driver_image_memorywith theAPS5_IMAGE_SLABS=1that CTest sets for it).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T19:14:13Z.
Review: CHANGES_REQUESTED
Requesting changes only for the new execution test's portability; the production storage-read selection correctly stays off on this device.
I reproduced the test on the physical Intel adapter in this Windows notebook at head
5bed290d2388b984805f48679991a5d23fe78d52. Before rebuilding, I applied every AGC/shader source delta through currentmain271179178780e9fcb5cd0754a1cf5186c6e491efto both comparison arms (the remaining newer main deltas are tools-only), and verified that both used byte-identicalImageLoadAfterStore.cppfixtures.Device capability is the relevant difference:
8086:a78b), driver 101.6127, Vulkan 1.3.295shaderStorageImageExtendedFormats = trueshaderStorageImageReadWithoutFormat = falseshaderStorageImageWriteWithoutFormat = trueVK_KHR_format_feature_flags2presentI explicitly configured and built the real target with
-DANYPS5_AGC_EXECUTION_TESTS=ImageLoadAfterStore; this was not theExecutionTestNotBuilt.cppplaceholder. With the Intel ICD pinned,ANYPS5_REQUIRE_VULKAN=1, shader cache and pipeline journal disabled, and Khronos validation 1.4.369 with synchronization validation enabled:AGC graphics: 32_UINT: thread 0 channel 0 loaded 0xabababab after storing 0x5a000003VUID-/SYNC-messagesThat A/B says this is not a production regression introduced by the PR: the new behavior is unavailable by design on this valid Vulkan device, but the fixture unconditionally expects it. The implementation first requires the global read-without-format feature and then the per-format
VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT; the fixture should skip or constrain its cases using that same effective capability contract while retaining coverage on capable GPUs.The green hosted Windows job does not cover this case: it configured only
F16ToF32Unpack;F64FmaSubnormals;RegistrationPrepareShutdown, builtagc_driver_image_load_after_store_testsfromExecutionTestNotBuilt.cpp, and reportedagc_driver_image_load_after_storeas skipped.Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T19:39:53Z.
Review: APPROVED
The new head resolves my fixture-portability change request. I verified the exact new fixture blob at head
81862ab3e668b0e671c8253e3fa085af2c9ec258with all relevant AGC/shader source deltas through currentmain5f04682cef1e1c7f46162773b6a92a6fa49dd59a.I rebuilt the real
agc_driver_image_load_after_store_teststarget with-DANYPS5_AGC_EXECUTION_TESTS=ImageLoadAfterStoreand ran separate processes on both physical notebook adapters:Skipped. Every run printed the six unsupported-format skip lines and no success line.The runs used Khronos validation 1.4.369 with synchronization validation and produced 0 VUID/SYNC diagnostics. This preserves the positive assertions on a capable device while making the valid unsupported Intel device a real test skip, matching the implementation contract.
Approved. AI-assisted: yes (Codex assisted with review and testing).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T07:40:36Z.
Review: COMMENTED
Reviewed — no blocking findings
This review covers head
81862ab3e668b0e671c8253e3fa085af2c9ec258; no verified blocking defect was found in the code read. The new test was not run during this review.What I ran
repo_read.py's pinned-head reader.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
VulkanDevice.cppandTexture.cppwas excluded by the review folder size limit; only relevant ranges were read. Other changed-file full texts marked included in the manifest were not all read, so this is not a complete file-by-file verification.files.jsonwas not available through the reader; the manifest identifies the two excluded files noted above.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T19:20:47Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected shader redirection and descriptor gating appear consistent with the stated constraints; the review is incomplete because several changed files and the full test/build evidence were not inspected.
What I ran
65bb7731f9c9eeb52212852a2ea31d45892c71ff.repo_read.pyto search and read targeted code ranges. No tests or builds were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
Read:
VulkanDevice.cpp(targeted range),Texture.cpp(targeted range),ResourceMaterializer.cpp(targeted range),DescriptorBindingBuilder.cpp(targeted range), andSpirvImageEmitter.cpp(targeted range). Also read the description, commits, manifest, and diff.The remaining changed files were not read:
Texture.hpp,ImageLoadAfterStore.cpp,CacheKey.hpp,DescriptorBindingBuilder.hpp,ResourceMaterializer.hpp,PipelineSpecialization.hpp,Recompiler.cpp,Recompiler.hpp, anddocs/dev/debt/changes/docs-image-load-after-store-same-shader.md. The full contents outside the targeted ranges of the five code files above were not reviewed. Tests, build results, hardware behavior, and CI were not verified; the description reports those results.To get this to a good state
Nothing is required. Optional: complete inspection of the unread changed files and run the relevant checks before making a formal approval decision.