Shaders: preserve the unwritten high half of packed D16 buffer loads #1441
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1441
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1441"
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?
@EatCodeSleep2 on GitHub · 2026-11-24 18:01 UTC · original
EatCodeSleep2:fix/preserve-d16-buffer-high-half-1242→main· +50 −4 · 2 files · 1 commits · openAddresses the destination register preservation part of VIC-BT-015 in #1242. For buffer_load_format_d16_x/xyz, merge the last channel into the low half of the final VGPR. A full pair still replaces the whole VGPR. Integer format interpretation is separate.
The synthetic typed-buffer regression covers x, xy and xyz. The one-channel case on main read back 0x00003c00 instead of 0x5a5a3c00. The native D16 buffer probe also checks that the x form preserves the original high half. This PR shares the small test builder extension from #1437 and can land independently.
120 shader tests and strict shader Clippy passed on Windows. The shader suite excluded the existing v_med3_f32 host NaN failure.
AI use: Codex wrote and tested the change.
@marquezinii on GitHub · 2026-11-24 18:33 UTC · original
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
60bf416.cargo test -p victory-shader --lib -- --test-threads=1 --nocapturegives 121 passed, 0 failed, 1 ignored.packed_buffer_load_keeps_unwritten_high_halfpasses on the hardware adapter and WARP, and nothing on the hardware adapter was skipped. The only skips are the fourdiff_teststhat need the console compiler.I also merged this with #1437 locally:
build_with_handle_countcomes out once and both merge cleanly in either order, so they really can land independently.@AnoHunted on GitHub · 2026-11-24 18:38 UTC · original
Independent NVIDIA run. No game files were used.
Machine: Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1, DXC
dxil.dll1.9.2609 (SDK 10.0.26100) validating.cargo test -p victory-shader --features host -- --test-threads=1with this PR:packed_buffer_load_keeps_unwritten_high_half.Not tested: the in-game effect; AMD. (Sibling #1437, the image version, reported separately.)
@sinan-cmyk on GitHub · 2026-11-24 20:43 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
60bf416ontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@upipibi on GitHub · 2026-11-25 00:30 UTC · original · edited 2026-11-25 01:06 UTC
A related measured rule for the same function (
d16_channels), in case it's worth folding in here or in a follow-up. Not run here; it comes from reading plus two hardware measurements.min(x, 0xffff)and SINT toclamp(x, -32768, 32767). For example, a 32_UINT 70000 (0x11170) loads as0xffff, where& 0xFFFFgives0x1170. This was measured forbuffer_load_format_d16_*on gfx1031 (cited in xcl-dev/xcl#1488 item XCL-BT-020, which xcl-dev/xcl#1977 now implements). It was also measured for D16 image reads on gfx1036 in boykopovar/AnyPS5#22750. 8- and 16-bit formats never leave that range, so they're unaffected. (Now #1927, which merges cleanly with this PR.)32-bit float texels round toward zero …Correction: on D3D12 the legacy f32→f16 conversion already rounds toward zero. I measured it in XCL's equivalent path on an RTX 3070 (616.56) and on WARP:legacyF32ToF16rounds to nearest.1 + 3·2⁻¹¹→0x3c01, 70000 →0x7bff. That matches RDNA2, so only the integer saturation above applies here. AnyPS5's float case came from Vulkan'spackHalf2x16.#1437 has the image-side counterpart, if the image D16 path packs the same way.
AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 03:27 UTC · original · edited 2026-11-25 16:05 UTC
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.