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 · 3 commits · merged 2026-11-26 10:53 UTCChange
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
@KainanP on GitHub · 2026-11-26 10:55 UTC · original
Test report for #333 on three adapters.
Merges cleanly onto current main. Setup: current
origin/main(afa30ce) merged with this PR, Windows 11,cargo test --lockedinthird_party/victory. Nothing underthird_party/victorychanged sincec4c93bd, so the main column is c4c93bd's run. Adapters: RTX 4060 Laptop (DXGI 0), Intel UHD 8086:a78b (16-lane waves, no FP64), WARP. The hardware adapter is picked by name through a local, uncommitted test hook and confirmed in its log. For WARP, victory-gpu uses--features diagnostics+VICTORY_D3D12_WARP=1and victory-shader usesVICTORY_WARP=1. victory-gpu runs with--test-threads=1.victory-gpu --libvictory-shader --lib"main's 3" =
descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others. The victory-shader failures on Intel have the same names as on main: FP64, permlane16, LDS float min/max and subtractions, and the four BVH node tests. Both new tests pass on all three adapters. No new failure, no new warning.Notes from reading the diff:
typed_int_flag's DXGI numbers match the enum: UINT 3/7/12/17/25/30/36/42/50/57/62 and SINT 4/8/14/18/32/38/43/52/59/64. R10G10B10A2 has no SINT form, so the SINT list correctly has nothing for it.typed_heap_indexrepeatshandle()'s match arm for arm and skips thehandlescache. A helper that returns(index, per_lane)for aSource, used by both, would keep them from drifting.Builtsources still get"a typed root view"as before, so nothing that translated before stops translating.SLOT_TYPEDand branches two ways, even in programs whose views are all float. Your in-world numbers show no cost. If it ever does cost something, the flags could be loaded once per descriptor, keyed likeself.strides.make_at,make_nullandraw_atnow write the strides entry for dynamic slots, which main did not. That also changes what readers ofSLOT_STRIDESget for those slots: a real stride where there was a stale or 0 entry before. That looks like an improvement, but it is a second behaviour change, worth a line in the description.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.