upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/command_list_test.cpp
diff options
context:
space:
mode:
authorKanameS <nk23a4@gmail.com>2026-11-22 23:06:44 +0700
committerKanameS <nk23a4@gmail.com>2026-11-22 23:06:44 +0700
commitb76c78acdb825ec65be5164a5ce89210e806ba60 (patch)
tree5ed18443908cc87c7b3009d4781753defd31c7c2 /runtime/test/command_list_test.cpp
parent4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/command_list_test.cpp')
-rw-r--r--runtime/test/command_list_test.cpp18
1 files changed, 18 insertions, 0 deletions
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() {
223 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4); 223 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4);
224 CHECK(!parent.execute_bundle(bundle)); // parent is closed 224 CHECK(!parent.execute_bundle(bundle)); // parent is closed
225 225
226 // The range form: [first, last) of the bundle, with last clamped to its size.
227 {
228 CommandList source, target, other;
229 CHECK(source.copy_resource({1, 2}) && source.copy_resource({3, 4}) && source.copy_resource({5, 6}));
230 CHECK(source.close());
231 CHECK(target.execute_bundle(source, 1, 2)); // the middle command only
232 CHECK(target.commands().size() == 1 && std::get<CopyResource>(target.commands()[0]).src == 4);
233 CHECK(target.execute_bundle(source, 2, 100)); // last beyond the size is clamped
234 CHECK(target.commands().size() == 2 && std::get<CopyResource>(target.commands()[1]).src == 6);
235 CHECK(target.execute_bundle(source, 1, 1) && target.commands().size() == 2); // first == last: nothing
236 CHECK(target.execute_bundle(source, 3, 3) && target.execute_bundle(source, 7, 9)); // first beyond the size
237 CHECK(target.execute_bundle(source, 2, 1) && target.commands().size() == 2); // first after last: nothing
238 CHECK(target.commands().size() == 2);
239 CHECK(other.execute_bundle(source)); // the default arguments copy all of it, as before
240 CHECK(other.commands().size() == 3 && std::get<CopyResource>(other.commands()[0]).src == 2 &&
241 std::get<CopyResource>(other.commands()[2]).src == 6);
242 }
243
226 CommandList open_parent, open_bundle; 244 CommandList open_parent, open_bundle;
227 CHECK(!open_parent.execute_bundle(open_bundle)); // bundle must be closed 245 CHECK(!open_parent.execute_bundle(open_bundle)); // bundle must be closed
228 CHECK(!open_parent.execute_bundle(open_parent)); // a list cannot execute itself 246 CHECK(!open_parent.execute_bundle(open_parent)); // a list cannot execute itself