fix(shader): keep the half bits of a 16-bit float image store's D16 data #12191
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12191"
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-28T02:50:56Z.
What
#8998 stores write-only
16_FLOAT,16_16_FLOATand16_16_16_16_FLOATstorage images through a UINT view: the materializer gives the image the Uint numeric class, andStoreTexelconverts each component withEmitFormatStoreComponent, which reads its input as f32 bits. Because the image is now Uint,StoreTexelis called withinteger = true, so for animage_storewith D16 data the value it converts is the raw half (for example0x3c00for 1.0). Read as f32 bits that is a denormal, and the store writes 0.This skips the f32-to-half conversion when the store's data is 16-bit (
mem.dataBits == 16): the half bits are stored as they are. 32-bit data keeps #8998's round-toward-zero conversion.ImageStoreFloatRoundinggains the same cases with D16 set on both stores (full anddmask 0x5writes, for the three formats), with packed halves as input.Why
Echoes of the End (PPSA25636) presents pure black frames once it leaves its in-world loading screen, while it still records a full scene each frame. A bisect over the first-parent merges of
main(each point with the same title prerequisites, save, scripted input and seeded caches; one 1700 s run each, screenshots at 1440-1695 s) ends at #8998:b241428c634(#10984, the merge before #8998): the in-play scene renders at 1560, 1640 and 1695 s (largest luma 254)76dec1794ba(#8998): every screenshot from 1560 s on is black (largest luma 0)801d5b9bc11that was black from 1440 s renders the in-play scene at 1300-1695 s with this change cherry-pickedI did not identify the individual Echoes shader; a D16 store into one of these formats writing 0 matches a frame that is drawn but presents black, and the change restores it.
Tested
ctest -V -j1 -R '^agc_driver_image_store_float_rounding$'withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer inserted in each arm, no "was not found" line):maincccdaa2734a: passedmainwith only the new D16 cases: failed, "D16 image_store of 16_FLOAT: texel (1, 0) component 0 is 0, expected 15360"c3c947e9c1e: passedIndependent Windows/NVIDIA validation
maskym reports this exact head
c3c947e9c1merged onto main16e1b95117on Windows11 26300, i7-12700K, RTX2070SUPER/NVIDIA621.01, WinLibs GCC15.2.0. The focusedagc_driver_image_store_float_roundingtest passed. The broader AGC/VideoOut selection reported main1150/1151 and candidate1151/1152: both had the same mesh-barycentric test failure and the same pre-existing blend-state VUID (18 occurrences), with1012 actual KHR layer insertions in each log and no missing layer. This was a joint tree also carrying #12322, #12318, #12306, #12302 and #12200; it is third-party evidence, not an isolated run performed by this author or an all-green suite claim. No PS5 run or performance gain is claimed.Checklist
main; no other open PR implements the same functions. #11580 also editsSpirvImageEmitter.cpp(D16 for converted packed images, a different path); it merges with this branch without conflict.NotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T03:12:27Z.
Review: APPROVED
I reviewed the exact head
c3c947e9c1e721fb0b58b1905b961cfea7621dc7and inspected the three attached focused-test logs. On the same RX 6650 XT/RADV setup, main passes, the test-only arm fails specifically with D1616_FLOATstoring 0 instead of 15360, and this change passes; all three report zero VUIDs, and the validation-layer-missing diagnostic is absent. This directly exercises the regression and fix. The one-line emitter change preserves raw 16-bit values for D16 while retaining the existing conversion for wider data; the expanded cases cover full and sparse component masks across the three 16-bit float storage formats. I also verified a clean merge preview with currentmain, passing conventions, and cleangit diff --check. Hosted policy checks and Windows build pass; Linux full build is skipped by the workflow path filter. I found no blocking issue in this revision.