GPU: typed buffer views of 32-bit integer formats move their bits #684
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/fxceless--victory-fork!684
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-684"
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?
@GamingRipperDoc on GitHub · 2026-11-25 04:25 UTC · original
GamingRipperDoc:fix/typed-buffer-bits→main· +52 −0 · 1 files · 1 commits · openTyped buffer views of 32-bit integer formats: make them in the float format of the same width, so the translated shaders' float loads and stores move the bits unchanged.
Why
The translator declares every typed buffer access as 32-bit float (
victory_shaderemit/lower.rsannotates typed buffers as 4×f32). The title's descriptors are passed on with their own format, so a buffer the title views asR32_UINTis read and written through a float declaration over an integer view. D3D12 GPU-based validation flags each such dispatch (UAV resource format channel class differs from that expected by shader … Expected: FLOAT/UNORM/SNORM, In Descriptor: UINT). The console moves the bits, so a value stored this way may not come back as the integer the title wrote. The meshlet culling programs, for example, append packed meshlet numbers to anR32_UINTlist.What
One function in
crates/victory-gpu/src/descriptor/host.rs,bit_exact_format, mapsR32{,G32,G32B32,G32B32A32}_{UINT,SINT}to the_FLOATformat of the same width; every other format is left as it is.buffer_srvandbuffer_uavapply it before the element size is worked out (the width is the same, so offsets and counts don't change). It applies to buffer views only, where the format is the view's alone. Textures are untouched. A unit test covers the mapping and checks that element sizes match.Not covered: narrower integer formats (
R16_UINT,R8G8B8A8_UINT, …) have no float format that keeps their bits. Typed texture views can't be changed this way either, since a texture can only be viewed in formats its resource was created to allow. One texture case remains (below). It needs integer declarations in the translator instead.Tested
Windows 10 22H2 (19045), AMD RX 9070 XT (Adrenalin 32.0.32015.7029), Rust 1.98.1.
main310c6eb+ this commit):cargo test -p victory-gpu --lib --locked: 118 passed, 1 failed. The new test passed. The failure,pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws, fails the same way onmainwithout this commit, on Windows 10 without the Agility SDK runtime staged. Clippy reports no warnings in the changed lines, and rustfmt finds nothing to change there.VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1on my test stack (this change plus other open PRs and local diagnostics), diag build, fresh cache and data folders, same machine:fc5e66f8f873d3bb,1f32b2302bce7ce4,ce684a9201818f3f)All the SRV warnings, before and after, come from one program (
6c4160eab4a573bb). It reads aTexture2D<float4>that the title views with a UINT format, which is the texture case above, so this change doesn't reach it. Both runs ended on their own while GPU-based validation was on, as other validation runs on this machine did. Neither lost the device.This doesn't fix the AMD page faults in #3 (the
_Prevculling programs fault with or without it).No game data used.
AI-assisted (Claude Code); I ran the checks above on my machine.
🤖 Generated with Claude Code
@avt0m4t48 on GitHub · 2026-11-25 05:36 UTC · original
I independently checked the descriptor construction at base
310c6eb6c16822ab95076aad61fce19bba86bb98and head3467f1aeb3f4b2f665a46ff6c009237eee9308a5.cargo check -p victory-gpu --tests --target x86_64-pc-windows-msvc --locked --features diagnostics,blake3/purepassed at both revisions from Linux using Rust 1.98.1. Both emitted the existingdepth_writtenwarning.The 96-bit UAV cases in the fixture show what the code submits to the device. Microsoft’s FL 12.0 format table lists typed UAVs as unavailable for all three
R32G32B32_{FLOAT,UINT,SINT}formats, so the three-component format was already limited to uses such as SRV loads at the base. Microsoft format tableWindows device execution and bitwise GPU readback remain unverified by this check. It used only synthetic descriptors.
3467f1aeb3toce1c419402@AaronMacArthur on GitHub · 2026-11-25 08:49 UTC · original
We independently observed the typed-UAV format mismatch on an RTX 4080 SUPER in the Series S opening. In a scoped test of GamingRipperDoc’s change, all three compute outputs originally received
R32_UINT. Switching those outputs toR32_FLOATmade the plaster and clothing seams easier to see. The uniform remained largely black and the bunk fabric showed bright speckles.We adapted commit
3467f1aeb3f4b2f665a46ff6c009237eee9308a5to a local guarded build. Our version creates a private view for the command list only for these scalar, shadow-backed output buffers. The upstream change also covers shader resource views and additional integer formats. We matched each observed pipeline to its shader’s first-bind record.fc5e66f8f873d3bb1f32b2302bce7ce4ce684a9201818f3fBoth runs used one binary and the same 3,100 starting save and cache files. We took a stationary screenshot 305 frames after the courtyard marker. Across two 64-interval windows per setting, pooled presentation went from 5.608 FPS off to 5.491 FPS on. The enabled run followed the control, so the 2.1% difference is a single-pair result.
After a scripted camera turn, the two indoor frames had different framing. We compared 179,544 screen positions with similar depth and normals. Nonzero base color rose from 38,273 to 41,906 of those positions, or 2.02 percentage points. Some surfaces lost color, and this screen-space comparison cannot identify the same mesh at every pixel. A repeat from an identical indoor camera pose would help establish which materials benefit.
These measurements come from a Codex-assisted local port and test harness. Upstream change
@tippythetaidum on GitHub · 2026-11-25 13:15 UTC · original
On the 16-bit case this leaves out ("narrower integer formats ... need integer declarations in the translator"): #927 does that for the title's 16-bit accesses. They are
buffer_load_format_d16_*andbuffer_store_format_d16_*, all in the face network'scompute_graph_opsprograms, throughR16G16B16A16_UINTandR16_UINTbuffer views. The translator now moves those 16 bits as unsigned integers, and a 16-bit float or signed view at such a place is shown as its unsigned twin. Through the integer views every value had read as 0, so no character's mouth moved.The two don't overlap: this changes 32-bit integer buffer views everywhere; #927 only acts at d16 accesses and only on 16-bit formats.
AI-assisted (Claude Code, Claude Opus 5.5).
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.