GPU: walk active vertex buffer slots by set bits in draw #3654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3654"
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?
Imported from Marvisak/VIctory. Originally posted by Luislariosss on 2026-11-28T03:20:41Z.
Avoid scanning all 32 vertex-buffer slots on every draw when only a subset (or none) are active.
Changes
[D3D12_VERTEX_BUFFER_VIEW; 32]and callingIASetVertexBufferswhenp.slots == 0.p.slots(active_slots/vertex_slot_count) in the vertex-buffer bind path.rectangles()instead of allocating up to 32 temporaryVec<(u32, u32)>s per draw.draw::tests::vertex_slots_are_walked_by_their_set_bits.Verification
cargo xtask policy(191 files ok)cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics)cargo test -p victory-gpu --lib draw::(21 passed, 0 failed)Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-28T03:35:30Z.
Independent WARP verification and diff review. AI-assisted by Codex (gpt-6.2-sol).
63bcca43c6a00a758510398fa43096ce7e4f7df0, PR headb275f5430b14d894974f2ff6e2f0fe703abe8bb5, clean merge tree5a9b5bdc895c8c4f91668d81bafb09f64099e7fc.VICTORY_WARP=1andVICTORY_D3D12_WARP=1. DXGI reported software adapter flags (0x2), the compositor initialized, and the GPU test processes loadedd3d10warp.dll10.0.26100.9818. A separate loader probe resolved SDKdxil.dll1.8.2502.11viaPATH. The GPU test processes showed nodxil.dllload.victory-gpusuites withdiagnosticspassed on base (246 passed, 1 ignored) and on the merge (247 passed, 1 ignored). The first full merge run failed the unchangedframe::tests::waits_end_on_ticks_and_count_framestiming assertion and passed on retry.draw::tests::vertex_slots_are_walked_by_their_set_bitswas absent on base and passed on the merge. Diagnosticsdraw::passed 21 tests. Both default-feature test binaries compiled with--no-run, since the host's WARP switch requiresdiagnostics.-D warnings(2/2, zero warnings).xtask policypassed (191 files, zero violations). All Cargo commands used-j 4.GraphicsState::slots()andelements()use the same layout and clamp each slot to0..=31, so every stored element is represented. A zero mask implies an empty IA layout (or compute/mesh), so earlier vertex-buffer bindings are unread. The base already skipped the bind for zero, and subsequent draws bind their required slots. Sparse holes keep their null views,vertex_slot_count(0)is zero, and the full mask yields slots0..=31with a 32-view span.draw.rsconflict with #2729 in rectangle expansion. Each PR merges individually onto the pinned base.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T03:47:14Z.
I combined this exact head
b275f54with #2729 at857f394in9577abe. The overlap inrectangleskeeps the active-slot iterator while retaining the common POSITION-derived corner order for all vertex streams.Test commit
e702f1dextends the existing render-and-readback fixture. All three color cases passed with adjacent slots and with POSITION in slot 31 and COLOR in slot 7. The latter exercises the high mask bit and unused gaps, including the stride-zero constant-color case. The two sampled pixels per rectangle matched the expected colors.App-local WARP 1.0.22 with Agility 1.620.2 passed 11 focused repository tests plus the local runtime identity check, with the debug switch off and on. Strict all-feature GPU Clippy and asset policy passed.
Please retain the Git authors on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding my test into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T22:31:38Z.
NVIDIA full-suite run, to go with the reports above by andrewpozdnakov7-jpg, oni-swr, since none of them names a GPU run. Tested exact head
b275f54(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.vertex_slots_are_walked_by_their_set_bits.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.