From b76c78acdb825ec65be5164a5ce89210e806ba60 Mon Sep 17 00:00:00 2001 From: KanameS Date: Sun, 22 Nov 2026 23:06:44 +0700 Subject: Runtime: a bundle's draws run with the parent's state, and what the bundle set stays on the parent A draw recorded in a bundle took the bundle's own viewport, targets, root arguments and buffers. A bundle cannot set a viewport, so every bundle draw was dropped without an error, and nothing of the parent's state reached it. Only the stencil reference and the blend factor were handed back. Inside a bundle, state calls, draws and Dispatch are now kept as deferred calls, and ExecuteBundle plays them on the parent through the members a direct call uses, between the bundle's state-free commands, in order. A draw sees the parent's state plus what the bundle set, and what the bundle set stays on the parent, as measured on the PC runtime. This replaces the stencil-reference and blend-factor carry-back fields. Trace lines are written once, when the bundle records the call. ClearUnorderedAccessView is refused in a bundle, like the other clears. Co-Authored-By: Claude Fable 5.2 --- runtime/test/command_list_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'runtime/test/command_list_test.cpp') diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp index 69fe14679..e459b4cc8 100644 --- a/runtime/test/command_list_test.cpp +++ b/runtime/test/command_list_test.cpp @@ -223,6 +223,24 @@ int main() { CHECK(std::get(parent.commands()[1]).src == 4); CHECK(!parent.execute_bundle(bundle)); // parent is closed + // The range form: [first, last) of the bundle, with last clamped to its size. + { + CommandList source, target, other; + CHECK(source.copy_resource({1, 2}) && source.copy_resource({3, 4}) && source.copy_resource({5, 6})); + CHECK(source.close()); + CHECK(target.execute_bundle(source, 1, 2)); // the middle command only + CHECK(target.commands().size() == 1 && std::get(target.commands()[0]).src == 4); + CHECK(target.execute_bundle(source, 2, 100)); // last beyond the size is clamped + CHECK(target.commands().size() == 2 && std::get(target.commands()[1]).src == 6); + CHECK(target.execute_bundle(source, 1, 1) && target.commands().size() == 2); // first == last: nothing + CHECK(target.execute_bundle(source, 3, 3) && target.execute_bundle(source, 7, 9)); // first beyond the size + CHECK(target.execute_bundle(source, 2, 1) && target.commands().size() == 2); // first after last: nothing + CHECK(target.commands().size() == 2); + CHECK(other.execute_bundle(source)); // the default arguments copy all of it, as before + CHECK(other.commands().size() == 3 && std::get(other.commands()[0]).src == 2 && + std::get(other.commands()[2]).src == 6); + } + CommandList open_parent, open_bundle; CHECK(!open_parent.execute_bundle(open_bundle)); // bundle must be closed CHECK(!open_parent.execute_bundle(open_parent)); // a list cannot execute itself -- cgit v1.2.3