fix: read and write typed buffer views of integer formats as integers #333
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!333
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-333"
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?
@Skyfrye on GitHub · 2026-11-26 03:59 UTC · original
Skyfrye:nep/face-typed-uint→main· +532 −136 · 8 files · 2 commits · openChange
The translator lowered every typed buffer load and store (
buffer_load_format_*,buffer_store_format_*,_d16_included) throughTypedBuffer<float4>withbufferLoad.f32/bufferStore.f32, and for_d16_converted withlegacyF32ToF16/legacyF16ToF32. GTA VI's facial animation graph (compute_graph_ops:*, thenped_standard_head_cs:*) keeps its tensors in typed buffer views of integer formats (R16G16B16A16_UINT):CS_AddOperation(#13c8daa0bad76f2a), for one, reads such a view with d16 loads and stores around f16 arithmetic. Through a float view andlegacyF32ToF16, those loads gave 0 and the stores wrote garbage, so the graph that moves the faces computed nothing.Now the format of a typed buffer view is known to the shader:
victory-gpu: the view heap's strides table carries two flags in its high bits for typed buffer views,SLOT_TYPED_UINT(bit 31) andSLOT_TYPED_SINT(bit 30) (descriptor/host.rs,view_stride, also for dynamic slots:make_at,make_null,raw_at); the table is bound to a new root viewSLOT_TYPED(252) without the heap pass's scan (draw.rsheap_typed_table); every reader of the strides table masks the stride withSLOT_STRIDE_MASK.victory-shader(emit/lower.rs): a typed load or store readsSLOT_TYPED[heap_index]and takesTypedBuffer<uint4>(bufferLoad.i32/bufferStore.i32) for UINT views,TypedBuffer<int4>for SINT views, with d16 halves packed and unpacked as bits; float, UNORM and SNORM views keep the path they had.Two changes on top of the first version of this work (found in review):
Shl16 thenAShr16 for the low one,AShr16 for the high one); zero-extended, -1 was 65,535, which the typed store clamps to 32,767;SLOT_TYPEDwith no view heap set is dropped, as one that reads title memory by address without one is (State::bind); it ran with the root view unset before.Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), RTX 5080, on upstream
mainatc4c93bd, fromthird_party/victory:The failures are those of
mainwithout this change, on the same adapter: 5 invictory-shaderon WARP (ds_min_max_f32_order_floats_and_return_the_old_value,lds_subtractions_get_a_pipeline_and_stay_atomic,v_permlane16_and_x16_read_the_lanes_their_selectors_pick,whole_wave_f64_sum_and_cvt_f32_f64,a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is) and the 3 known invictory-gpu(spans_say_the_next_start_and_the_lowest_level_viewed,warp_card_fetch_copies_flagged_pieces_to_their_slots,warp_card_patch_writes_the_masked_bytes_and_no_others).New tests:
descriptor::host::tests::typed_integer_buffer_views_carry_their_format_flag_in_the_strides_tableandemit::descriptor_tests::typed_d16_buffer_load_and_store_use_slot_typed_and_validate(validated withdxil.dll); both fail without the change (the flags and the root view do not exist).Translation of my copy's
shaders.rpfon the CPU (victory translate --list --validate, before and after, also withVICTORY_HOST_MAX_WAVE=32): identical summaries, 0 of 26,503 outcome lines differ, all 73 programs of the face pipeline validate before and after (the change is in the code they emit, not in whether they translate).In the world (launcher fast set; with
VICTORY_INDIRECT_RAW=3, which onmainclamps every indirect record): 3 runs of 300 s, no exception, no device lost, no draw dropped for want ofSLOT_TYPED. The first run made 2,646 pipelines again (the root signatures of programs that use typed buffers changed) and ran at 5 fps; the next two at 10.5 fps median, against 10.4 fps formainatc4c93bdin the same run order (GPU 45 % against 46 % busy): no cost.In the world, diagnostics builds of
main(c4c93bd) and of this change, 600 s each, buffers dumped at 14 frames from the world's first frame on (a diagnostics-only dump patch of my own, not part of this PR):CS_GatherOperationwrites (1,064,960 bytes, read byCS_BlendshapeTranslationsHSSGraphOutputExtract): onmainall zeros in all 93 dumps; with this change 78,000 to 94,000 of its 266,240 words are non-zero, and 8.5 to 31 % of it changes between dumped frames.CS_PedStandardSkinning_11reads: onmain97 to 100 % of the written words are the "no displacement" value and 0 of 20,048 change between frames; with this change 2,316 to 2,319 of 5,121 words of one region change from frame to frame.mainthe bind pose, eyes rolled up and the mouth smeared. (Screenshots kept locally, not attached: game imagery.)SLOT_TYPEDin either run.What this does not show: that the values equal the console's.
Oracle and test data
No game file in the tests. Program names and hashes come from the translator's listing of my copy's archive and from a frame capture of my own run; no game code, disassembly or address is in this PR.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: Google Antigravity (model
gemini-4-neon-medium) found the root cause and wrote the change and its two tests. Claude Opus 5.5 (a subagent) reviewed it and ran the tests and the translation comparison; Claude Opus 5.5 (coordinating) fixed the signed d16 store and the unbound root view, ran the game, and wrote this description.🤖 Generated with Claude Code
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.