mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1929] runtime: drop zero-Z mesh draws in CommandList::draw(Draw&&) (RT-CMDLIST-DRAW-MOVE-AND-INDIRECT-GUARDS) #1936
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#1936
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/1929
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rt-cmdlist-draw-move-and-indirect-guards📝 Commits (1)
a5b2023runtime: drop zero-Z mesh draws in CommandList::draw(Draw&&) (RT-CMDLIST-DRAW-MOVE-AND-INDIRECT-GUARDS)📊 Changes
2 files changed (+39 additions, -1 deletions)
View changed files
📝
runtime/src/command_list.h(+1 -1)📝
runtime/test/command_list_test.cpp(+38 -0)📄 Description
Item ID:
RT-CMDLIST-DRAW-MOVE-AND-INDIRECT-GUARDS(claim: #1608, comment 7167438871)Problem
CommandList::draw(const Draw&)(runtime/src/command_list.h:814) drops no-op zero-Z mesh dispatches with:(where
Draw::firststoresgroupCountZforDispatchMesh).However, the rvalue overload
CommandList::draw(Draw&&)(runtime/src/command_list.h:817-821) omitted|| (draw.mesh && !draw.first). BecauseGraphicsCommandList::DispatchMesh(runtime/shims/d3d12_com.cpp:572) callslist_.draw(std::move(draw)), aDispatchMesh(x, y, 0)call with nonzeroxandywas recorded into the command list and replayed directly intovkCmdDrawMeshTasksEXT(cb, x, y, 0)(runtime/src/vulkan_replay.h:5225).(Note on scope: my initial claim comment also proposed validating
IndirectDrawArgsinsideCommandList::draw_indirect(), but runningd3d12_state_map_testshowed lines 797 and 810 intentionally record invalidcount_offsetvalues throughdraw_indirect()to test replay'sReplayResult::invalid_indirect_argumentshandling. Keepingdraw_indirect()unchanged preserves that test contract.)Fix
runtime/src/command_list.h: add|| (draw.mesh && !draw.first)toCommandList::draw(Draw&&)so both copy and move overloads enforce the same no-op drop rule (and still return!closed_when called on a closed list).runtime/test/command_list_test.cpp: add coverage for bothdraw(const Draw&)anddraw(Draw&&)on zero-vertex, zero-instance, zero-Z mesh, non-zero mesh, null-pipeline, and closed-list cases.Verification
clang++ -std=c++20 -Wall -Wextra -Werror -O1 -g -fsanitize=address,undefined runtime/test/command_list_test.cpp-> PASSclang++ -std=c++20 -Wall -Wextra -Werror -O1 -g -fsanitize=thread runtime/test/command_list_test.cpp-> PASSclang++ -std=c++20 -Wall -Wextra -Werror -O2 runtime/test/command_list_test.cpp(x3) -> PASSd3d12_state_map_test(default +--bounded-index-view),replay_pipeline_compiles_test,replay_quad_list_test-> ALL PASScommand_list_test.cppagainst unpatchedmain:runtime/src/command_list.h-> FAILED atlist.commands().size() == 4as expected (exit 1)python3 -I scripts/check_no_game_data.py runtime/src/command_list.h runtime/test/command_list_test.cpp-> PASSpython3 -I tests/test_text_write_line_endings.py-> PASS (3/3)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.