fix(shader): store through a cube face for 32_SINT, 16_16_FLOAT and 16_16_16_16_FLOAT images #20982
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20982"
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 brumskysb on 2026-11-15T18:57:36Z.
What
A DIM 2D
image_storethrough a cube T# is refused for images whose format is written through a conversion:32_SINT(21),16_16_FLOAT(29) and16_16_16_16_FLOAT(71).ResourceMaterializer::RuntimeImageModesoffers the cube face mode only whenconversion == IrBufferFormat::Invalid, and the decode setsconversionFormatfor those three storage formats, so the store aborts withimage descriptor is incompatible with the static runtime image interface.The measured rule (RDNA2 gfx1036, driver 31.0.22044.1, #16491, merged as
dbf9b788c9; evidence https://gist.github.com/brumskysb/0f2d44c209a50bfbfd23f2a1ac451e86):image_store v4, v[5:6], s[8:15] dmask:0x1 dim:SQ_RSRC_IMG_2Dthrough a cube T# (type 11, DEPTH 11, BASE_ARRAY 0 and 6) writes the 64 texels of the 8x8 face selected byBASE_ARRAYand no other byte of the 64 KiB backing, for 8_8_8_8_UNORM, 8_8_8_8_SNORM, 32_SINT, 16_16_FLOAT, 16_16_16_16_FLOAT and 32_FLOAT. I recounted the dumps twice: with the script that generated the test's tables, and with a second script that parses the literal tables back out of the test source and compares them with the raw 16,384-dword backing (10 format x BASE_ARRAY combinations: 64 dwords moved, 128 for the 8-byte format, 0 outside the face, 0 face dwords untouched, 0 word mismatches; its controls fire). The per-texel words follow the rules the test pins: components outsidedmask:0x1are written as zero, and the 32_SINT store writes the register dword unconverted. The store words the test dispatches (0xf0200108 0x0001141e) disassemble to the measured instruction.The change is one predicate: the cube face mode is also offered when
conversionisFormat32SInt,Format16_16FloatorFormat16_16_16_16Float. The written-not-read, no-atomic, no-dynamic-mips condition (cubeFaceStorage) is unchanged, and the emitter needs no change. Every other conversion format (8_8_8_8_SINT, 16_16_SINT, 16_16_16_16_SINT, 16_FLOAT, the 10_11_11 and 11_11_10 families, 5_6_5 and the other packed formats), atomics, images the program also reads, and mip stores stay refused: they are not measured. The sample decision of the entry does not apply (this is a store).Tests:
ImageStoreFaceOnCube.cpp(existing ctestagc_driver_image_store_face_on_cube) keeps its 32_UINT and 32_FLOAT rows and adds 8_8_8_8_UNORM, 8_8_8_8_SNORM, 32_SINT, 16_16_FLOAT and 16_16_16_16_FLOAT at BASE_ARRAY 0 and 6 with the measured words, the face-landing and nothing-else-changed check, an identical store through a plain 2D T# for each new format, and refusal rows for 8_8_8_8_SINT and 16_FLOAT through a cube T#.ShaderMemory.cppgetsverifyCubeFaceConversionStoreMode(mode selection for the three formats,modes.size() < ImageTableAbi::MaxModes, refusal of three other conversion formats and of an atomic 32_SINT).Debt: the fragment
docs/dev/debt/changes/fix-shader-cube-face-conversion-store.mdreplaces only the itemformats written through a conversion such as 32_SINTin the final sentence of the entry [2D accesses through a cube T#]. The entry was already over the 1,000-character guideline (3,274 characters, 3,384 after);tools/check_conventions.pyreports that onedebt-lengthwarning and no errors. No measured condition was trimmed.CHANGE SUMMARY (the only span that differs between the entry on main and the fragment, computed from both texts):
formats written through a conversion such as 32_SINTa format written through a conversion other than the 32_SINT, 16_16_FLOAT and 16_16_16_16_FLOATdmask:0x1stores above (every other such format is not measured)Tested
Linux 7.0.0-43-generic (Ubuntu 26.04.1), lavapipe (
llvmpipe (LLVM 21.1.8, 256 bits), Mesa 26.0.8), Khronos validation layer inserted by the loader in every Vulkan run, nowas not found but was requested. The rule itself was not run on hardware here. Every log, the scripts and the recount: https://gist.github.com/brumskysb/4a58f73a74293731846c9e7e4111c6bf8d61bef655rebased on7085a08145:agc_driver_image_store_face_on_cube(21 rows),agc_driver_image_store_volume_through_array,agc_driver_image_store_array_through_volume,agc_driver_image_store_line_through_plane,agc_driver_image_store_line_through_plane_arrayandagc_shader_memoryall pass, 0VUID-lines in every log. Main before the change (545e7b64a1): the same tests pass, 0VUID-.ResourceMaterializer.cppset back to main:agc_driver_image_store_face_on_cubefails on exactly the six cube rows for 32_SINT, 16_16_FLOAT and 16_16_16_16_FLOAT (BASE_ARRAY 0 and 6) withimage descriptor is incompatible with the static runtime image interface: descriptor format 21 decodes to {class 2, dim 5, conversion 21, packed 0, cube 1, ...}(29 and 71 likewise); the 32_UINT, 32_FLOAT, 8_8_8_8_UNORM and 8_8_8_8_SNORM cube rows, all five plane control rows and both refusal rows pass.agc_shader_memoryfails with the same message. After restoring the source both pass.545e7b64a1; the rebase changed none of these lines; each restored and proven identical withgit diff+cmp): dropping Format32SInt fails only the two 32_SINT rows; dropping Format16_16Float only the two 16_16_FLOAT rows; dropping Format16_16_16_16Float only the two 16_16_16_16_FLOAT rows; removing the conversion condition fails both refusal rows; adding Format16Float fails only the 16_FLOAT refusal row; adding Format8_8_8_8SInt fails only the 8_8_8_8_SINT refusal row. Each of the six also failsagc_shader_memory.tools/debt_fold.py --checkexit 0;tools/check_conventions.py --base origin/main: 1 finding (debt-length), 0 errors.tools/pr_overlap.py --branchon the commit before the rebase probed 1,593 open PRs, 85 share files with the branch, no line conflict and no same-export row; it exits 2 because 29 old PRs conflict with main itself and their shared files could not be compared. A first run had shown line conflicts with #16260 and #20792 inShaderMemory.cpp; moving the new test function resolved them. By hand, on a fresh scan with positive and negative controls (in the gist), 48 open PRs touchResourceMaterializer.cpporImageStoreFaceOnCube.cppand none changes the cube-face predicate; five touch the test file (#7642, #9508, #10193, #13928, #13929: large image-table and descriptor-heap PRs that conflict with main). #19096 (store DST_SEL channel selection) touches the store emitter, not these files; the rows here use the identity DST_SEL withdmask:0x1.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)llvmpipe (LLVM 21.1.8, 256 bits), Mesa 26.0.8), Linux 7.0.0-43-generic, Ubuntu 26.04.1; the rule itself was measured on gfx1036 (driver 31.0.22044.1) in #16491 and these tests were not run on that hardwareImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T12:58:29Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and included test coverage support the measured cube-face store cases.
What I ran
Reviewed head
8d61bef655fd6a55c8cb312be1eac6b71a667a11. Read the prepared description, commit summary, manifest, diff, and changed source context throughrepo_read.py. I ran no commands or tests.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the test suite or independently verify the hardware measurements and author-reported test results. The changed files read were
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp,core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp,core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp, anddocs/dev/debt/changes/fix-shader-cube-face-conversion-store.md. All files listed as reviewed infiles.jsonwere read; none was excluded by rule.To get this to a good state
Nothing is required.
Pull request closed