Shaders, GPU: 16-bit buffer accesses through a table's views keep their bits (port of fxceless/victory-fork#927, which makes faces animate there) #578
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!578
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-578"
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?
@pr0vId3nce on GitHub · 2026-11-27 12:13 UTC · original
pr0vId3nce:halves-through-tables→a-publier· +1282 −41 · 19 files · 6 commits · openThis ports fxceless/victory-fork#927 by tippythetaidum, in the final form fxceless merged into victory-fork main as 58de9bf4c. The work and the findings are theirs; I brought it to a-publier and checked it on an RTX 4080.
#541 goes at the same gap another way: it makes the run-time integer-view check cover views in tables, and the host writes the view kind for a fresh table's slots. This PR decides per program at translation time and moves the bits as unsigned integers, so it does not depend on a float-typed load passing an integer view's bits, and it also covers plain format loads read as halves. The two merge without conflicts but overlap; whichever goes in first, the other should be rebased onto it.
What was wrong. The title keeps half floats, and 16-bit indices beside them, in buffers it views as
R16G16B16A16_UINTandR16_UINT, and moves them withbuffer_load_format_d16_*andbuffer_store_format_d16_*. On the console each channel's 16 bits go through as they are. a-publier already keeps those bits for a view the program picks from the heap (integer_view,9a6c829d6), but a view loaded from a fixed place in a descriptor table, which is how the face network reaches its buffers, still went by way of floats (bufferLoad.f32thenlegacyF32ToF16, and the reverse for stores). A float access through an integer view is outside what D3D12 defines; on the fork PR author's RTX 5080 every value read came out 0. The GPU network that drives the faces works in such buffers, so its tensors and its output stayed zero and no character's mouth moved. The same symptom is reported on an RX 9070 XT (avatarmanz/VIctory-7900XTX#231) and an RTX 3080 (#346 here).The fix.
bufferLoad.i32/bufferStore.i32), packing and unpacking the halves as before.HostShader::half_viewsnames those places (root parameter, dword), and the shader cache stores them.v_cvt_f32_f16, or av_fma_mix*source with itsop_sel_hibit, through phis) takes the same path (emit/halves.rs).descriptor::host::half_view), and the fresh table reaches the half places past its range's start. The title's own heap slot keeps the title's format for other programs. A view in a format the integers do not carry exactly is logged once.TRANSLATOR_VERSION2 -> 3 (4 if my exec-entry-skip PR or #479, which also take 3, is merged first), shader cache entry format 2 -> 3.Left out of 58de9bf4c: the SDWA sign extension (a separate fix),
VICTORY_CLAMP_WINDOW,VICTORY_OCCLUSIONand the offline tools.Tests (the PR's, synthetic programs):
emit::valu_tests::halves_go_through_a_table_as_they_are_and_name_their_viewsemit::valu_tests::half_places_are_the_descriptors_the_program_loadsemit::valu_tests::a_format_load_read_as_halves_loads_the_integerdescriptor::tests::a_fresh_table_holds_the_half_views_past_its_range_startsdescriptor::host::tests::only_16_bit_float_and_signed_buffer_views_get_an_unsigned_twin,views_whose_values_the_console_would_convert_are_namedOn the RTX 4080:
cargo test --release -p victory-shader --lib306 passed, 0 failed (303 on a-publier);cargo test --release -p victory-gpu --lib400 passed, 0 failed (396 on a-publier).In the title's shader pack (fork census): 77 programs name half places, 65 of them the face network's.
Results on an RTX 4080 (NVIDIA, 32-lane waves; Ryzen 9 7900X, 32 GB, Windows 11; diagnostics build, the same checkpoint and scripted input, warm shader cache, Series S, 300 s runs, median of the frame lines from 200 to 295 s):
No crash, the same picture in the scene timed, and the once-logged inexact-format warning did not appear. Frame time is within run-to-run noise. This PR's run 1 was the first with the new translations (they were done before the 200 s window). The camera is behind the player in that scene, so I did not see mouths here; the fork PR's author measured the network's buffers going from all-zero to changing on an RTX 5080.
AMD. Not gated: the old lowering relies on behaviour D3D12 leaves undefined, and the symptom is reported on RDNA 4 too. On every host, the programs that move halves through such views change translation (77 in the title's pack), the translator version bump makes every host translate once more, and a table with a 16-bit float or signed view at a half place is made afresh per draw (none for this title's own views, which are already unsigned). I have no AMD card to try it on.
🤖 Generated with Claude Code
@MamaLeVrai on GitHub · 2026-11-27 15:56 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
1a29b5c:victory-gpu400 passed, 0 failed, 34 ignored;victory-shader306 passed, 0 failed, 4 ignored.AI-assisted (Claude Code); no game data.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.