Repository navigation
vulkan_replay: a clamped mesh draw's statistics segment is a mesh segment; a batch reads only its own lists (RT-REPLAY-STATISTICS-MESH-SEGMENTS) - #2530
Conversation
…ment; a batch reads only its own lists From kevincommits' finding (item 2) in ProjectLeonida#1608. - plan_overlapping_statistics_segments: a clamped indirect draw opens a segment of its own (the clamp is a helper dispatch), but the planner then set the segment's kind to vertex and skipped the draw-kind rule. A clamped indirect mesh draw under overlapping statistics queries therefore ran in the full 11-counter pool (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076) and had no mesh-primitives query. The clamped call now falls through to the same rule as every draw; a dispatch leaves the kind unset. The one-query-at-a-time planner already marked it mesh. - VulkanQueue::execute keeps the PreparedLists of its largest batch, but gathered the segment kinds from all of them, so a smaller batch could pick up a stale mesh segment and create the mesh pools (or fail as unsupported where the device has none). It now gathers from this batch's lists only, through batch_statistics_mesh in vulkan_replay.h. replay_query_predication_test gains case 16b: the clamped mesh draw's segment is mesh, a mesh draw after it stays in it, a vertex draw splits; the non-overlapping planner agrees; and batch_statistics_mesh over the first n lists leaves the stale tail out. 2 checks fail with the old planner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed at head Verification
Notes
Approve. AI-assisted review + local MSVC verification. |
|
#2530 | head 202786b (merged cleanly with main 09c1539) | |
lixonik
left a comment
There was a problem hiding this comment.
Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).
Clamping the indirect mesh draw segment in vulkan_replay.h and wiring batch_statistics_mesh in vulkan_backend.h look clean, and the new cases in replay_query_predication_test.cpp directly cover the changed paths.
Tests run
ctest --output-on-failure -R "^replay_query_predication$": 1/1 passed (replay_query_predication0.03 s).
AI-assisted (Antigravity, Gemini).
Claimed in the coordination issue as: RT-REPLAY-STATISTICS-MESH-SEGMENTS (#1608 (comment))
What and why
Item 2 of @kevincommits' finding in #1608 (#1608 (comment)). Thanks for the analysis.
Overlapping statistics queries and a clamped indirect mesh draw (
plan_overlapping_statistics_segments,runtime/src/vulkan_replay.h). A clamped indirect call opens a segment of its own, because the clamp is a helper dispatch. The planner then hardcodedif (draw_command(commands[i]).state) kind = 0;andcontinued, so the new segment was always a vertex segment, even for an indirect mesh draw (everyIndirectMeshDrawis clamped). That draw then ranvkCmdDrawMeshTasksIndirect[Count]EXTinside the full 11-counter pool (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076) with no mesh-primitives query. A mesh draw after it also split the segment again, since the kinds differed. The one-query-at-a-time planner (plan_statistics_segments) already marked the same draw mesh.Change: the clamped call falls through to the draw-kind rule every draw uses, as
has_helper_dispatchalready does. The segment it opened has no kind yet, so a draw sets it (vertex or mesh) and a dispatch leaves it unset.A smaller batch read the stale tail of a larger one (
VulkanQueue::execute,runtime/src/vulkan_backend.h).prepared_keeps the PreparedLists of the largest batch so their storage is reused, and the comment there says only the firstlists.size()entries are read. But the segment kinds for the statistics pool were gathered withfor (const auto& list : prepared). After a batch whose later lists had a mesh segment, a smaller batch with statistics queries could find that stale1. It then createdmesh_poolandprimitives_poolit did not need, or failed asqueue_unsupportedon a device without them.Change: the gather is
batch_statistics_meshinvulkan_replay.h, andexecutepasses it onlystd::span(prepared).first(lists.size()).Overlap: none found among open PRs touching
vulkan_replay.horvulkan_backend.h(#2491, #2489, #2486, #2485, #2469, #2402, #2365 change other functions). Items 1 and 3 of the same finding are #2526 and #2523.Tested
Windows 11, MSVC (VS 18), RelWithDebInfo, on
main431ceba. CPU tests, plus the existingd3d12_meshGPU test.replay_query_predication_testgains case 16b, following the repro:plan_statistics_segments): mesh too;batch_statistics_meshover the first list of two leaves the second list's mesh segment out; over both it keeps list order.ctest -R "^(replay_query_predication|replay_query_edges|indirect_topology_and_stats|d3d12_mesh)$": 4/4 pass.gta6rt_d3d12_com(which includesvulkan_backend.h) builds.scripts/check_no_game_data.py: clean.Not tested: the
executepath itself on a device with a multi-list batch followed by a smaller one. The helper it now calls is tested, but not the queue around it. Also no game boot.GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code