mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1896] [MERGED] runtime: support dynamic topologies in indirect draws and report per-reason skip counts (RT-INDIRECT-TOPOLOGIES-AND-STATS) #1907
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1907
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1896
Author: @IlyassRS3
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:fix/rt-indirect-topologies-and-stats📝 Commits (1)
79a76a7runtime: support dynamic topologies in indirect draws and report per-reason skip counts (RT-INDIRECT-TOPOLOGIES-AND-STATS)📊 Changes
5 files changed (+506 additions, -23 deletions)
View changed files
📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_com.cpp(+2 -2)📝
runtime/src/indirect_draw_stats.h(+78 -19)📝
runtime/src/vulkan_replay.h(+10 -2)➕
runtime/test/indirect_topology_and_stats_test.cpp(+409 -0)📄 Description
Item ID:
RT-INDIRECT-TOPOLOGIES-AND-STATS(claimed in #1608).Context
In retail world-frame runs on RTX 5080 (#1608,
@DadaCap), 93% of indirect graphics calls were skipped at recording (recorded=4096 emitted=3918 record_skips=53405) with the only logged skip reasons beingmesh indirectandtopology, while[rt] indirect graphics:only printed aggregate totals without breaking down counts by reason.Both
d3d12_com.cpp(record_indirect) andvulkan_replay.h(prepare_draw) previously gated stateful indirect draws toD3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST(4) only, even though graphics pipelines already enableVK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGYandVK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE,emit_commands()already sets dynamic topology and strip primitive restart before emittingvkCmdDraw*Indirect*, andprepare_draw()already selects theGraphicsPipeline::rectangle_stagegeometry-shader variant for consoleRECTLIST(17).Changes
Shared indirect topology predicate (
runtime/src/indirect_draw_stats.h,runtime/shims/d3d12_com.cpp,runtime/src/vulkan_replay.h):leonida::indirect_stats::topology_supported(uint32_t)allowing allD3D_PRIMITIVE_TOPOLOGYvalues thatdetail::vulkan_topology()maps directly without CPU vertex/index-count expansion:POINTLIST(1),LINELIST(2),LINESTRIP(3),TRIANGLELIST(4),TRIANGLESTRIP(5),*_ADJ(10..13), and consoleRECTLIST(17).UNDEFINED(0),QUADLIST(19, requires CPUcount/4expansion), and patch lists (33..64) remain skipped withindirect_stats::topology.RECTLISTdraw targets a synchronous (!async_build) pipeline that cannot build arectangle_stagevariant (e.g., already has a GS, nogeometryShader, or unsupported VS outputs),prepare_draw()skips the indirect draw cleanly withindirect_stats::topologyinstead of failing the whole command list withReplayResult::unsupported(direct draws retainunsupported).record_indirect's viewport check inruntime/shims/d3d12_com.cppwithrecord_draw'sany_nonempty_viewport()so multi-viewport draws with an empty slot 0 and non-empty slot >0 are not dropped.Per-reason skip counters (
runtime/src/indirect_draw_stats.h):Counts::by_reason[reason_count], incremented beforenote(event)so power-of-2 reports include the triggering skip.Counts::report()preserves the exact[rt] indirect graphics: recorded=... emitted=... record_skips=... replay_skips=...prefix and appends a single-line[reason=count, ...]breakdown when any skip reason is non-zero.Portable unit tests (
runtime/test/indirect_topology_and_stats_test.cpp,runtime/CMakeLists.txt):topology_supported()across0..100, fullprepare+emitreplay across all 10 supported topologies (indexed/non-indexed, fixed/counted, allstrip_cut/ index-format combinations),RECTLISTbuilt-in GS vsrectangle_stagevariant vs unexpandable safe skip (with and withoutvk.compiles), direct-drawunsupportedpreservation, unsupported topology skips,Counts::report()formatting, and concurrentskip()accounting.Verification
indirect_topology_and_stats_test.cpp(Clang 20, C++20,-Wall -Wextra -Werror):skip()race check)-O2× 3: PASSruntime/test/d3d12_state_map_test.cpp: PASS (includingtopology_quad_listskip assertion)runtime/test/replay_pipeline_compiles_test.cpp: PASSmain:TRIANGLESTRIPindirect draw fails onmain(emitted=0) and passes on this branch (emitted=1).python3 -I scripts/check_no_game_data.pyon all 5 touched files andpython3 -I tests/test_text_write_line_endings.pypassed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.