Shaders: a packed word written to all four channels is stored as an integer #4003
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4003"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by Saul5662 on 2026-11-30T14:15:31Z.
What it changes
The TAA resolves (
TAA_Utilities:CS_SceneColorTemporalResolve*, e.g.b2b1ea29bc3987db, the dual-output DOF-aware one) pack R9G9B9E5 into an R32_UINT texture with integer ops (v_or3_b32,v_lshl_or_b32) and write the word to all four channels of animage_store. The lowering always emittedbitcast i32 -> floatplustextureStore.f32through a 4xF32 handle (propsfixed at0x409), so the word travelled as a float. On NVIDIA, words whose bits read as a NaN do not arrive intact:0x7F800001came back as0x7FC00001, and in the game's buffer they ended up 0.DepthOfField:CS_MainBlurand the tile composite (PS_CompositeIndirectDrawBlend) read that packed copy through the R9G9B9E5 view, so the opening cutscene showed black splotches on Lucia's hoodie wherever the colour's shared exponent and blue mantissa made a NaN bit pattern. Raw capture (VICTORY_DUMP_RAW): of 225,818 non-zero words in the packed texture, none had a NaN pattern; the 4,582 zero texels were exactly the splotches, and a neighbour estimate puts the NaN pattern 40x more often at the holes than elsewhere.This change: a store whose four channels are the same value assembled from bit fields (
v_or_b32,v_or3_b32,v_lshl_or_b32,v_and_or_b32,v_bfi_b32,v_perm_b32,v_alignbit_b32, followed throughv_mov_b32copies) is lowered astextureStore.i32through a 4xU32 handle (0x405), as the counter store already is. Other stores keep the float path. 144 of 25,693 programs translate differently: the TAA resolves, the screen-probe temporal resolves, water (transmission volumetrics, underwater mask, tessellation), voxelization and the terrain indirection remap.How it was tested
emit::size_tests::a_packed_word_is_stored_bit_for_bit: stores0x7F800001built withv_or_b32to all four channels of a uint texture and reads it back. Passes on the RTX 3060; with the change disabled it fails (0x7FC00001). The WARP run is skipped here (no SM 6.6 WARP device under Wine).cargo testpassed for the crates it touches:victory-shader --libunder Wine on the RTX 3060: 458 passed, 5 failed, 9 ignored. The 5 failures do not involve image stores and so cannot reach this change (filter3d_tests::by_hand_and_by_the_card_agree,opt::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity,intersect_tests::flat_global_stores_and_atomics_fence_uavs_at_group_barriers_across_waves,tests::stub_pipeline_is_created(vkd3d accepts the altered digest),valu_tests::whole_wave_sections_keep_rounding_mode_changes); they look specific to Wine/vkd3d on this card.cargo clippy -p victory-shaderreports four errors that are already onmain(lower/analysis.rs,lower.rsunused import,native.rsargument count), none in this change.Checked for overlap
AI use: Claude Code (Claude Opus 5.5) found the cause, wrote the change and the test, ran the checks and wrote this text. Label: [pr-fix].
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-30T14:53:37Z.
Merged for testing into our integration branch dyshay/VIctory-NVIDIA
janus-prs. Builds and the targeted CPU tests pass; a run on an RTX 4090 (Series S, hardware RT) is queued and I'll post the result here.