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:
authorAndrea <dreuzcompa@gmail.com>2026-11-22 00:32:28 +0100
committerAndrea <dreuzcompa@gmail.com>2026-11-22 00:32:28 +0100
commitfe12da7edd1a36121af84c4957953452ccc657c9 (patch)
tree71bc0883e457e1a0e3e4f0c704e21ddfb14d6aa1 /runtime/test/command_list_test.cpp
parentd937b7f092dbc188b59754e5c73c1a9dac553cf9 (diff)
D3D-35: implement ExecuteBundle IR inlining and validation
Diffstat (limited to 'runtime/test/command_list_test.cpp')
-rw-r--r--runtime/test/command_list_test.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp
index 797ba03d5..148f973e4 100644
--- a/runtime/test/command_list_test.cpp
+++ b/runtime/test/command_list_test.cpp
@@ -146,5 +146,39 @@ int main() {
146 CHECK(list.close()); 146 CHECK(list.close());
147 CHECK(list.commands().size() == 1); 147 CHECK(list.commands().size() == 1);
148 CHECK(std::get<ClearRenderTarget>(list.commands()[0]).target.resource == 36); 148 CHECK(std::get<ClearRenderTarget>(list.commands()[0]).target.resource == 36);
149
150 // Synthetic IR values here test copy-by-value mechanics only; the COM test below enforces D3D12 bundle
151 // restrictions on every currently implemented forbidden operation.
152 // Bundles are copied into the parent at ExecuteBundle time and can be reused independently.
153 CommandList parent, bundle;
154 CHECK(parent.copy_resource({1, 2}));
155 CHECK(bundle.copy_resource({3, 4}));
156 CHECK(bundle.copy_buffer({5, 0, 6, 16, 32}));
157 CHECK(bundle.close());
158 CHECK(parent.execute_bundle(bundle));
159 CHECK(parent.copy_resource({7, 8}));
160 CHECK(parent.execute_bundle(bundle)); // the same closed bundle can execute more than once
161 CHECK(parent.close());
162 CHECK(parent.commands().size() == 6);
163 CHECK(std::get<CopyResource>(parent.commands()[0]).src == 2);
164 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4);
165 CHECK(std::get<CopyBuffer>(parent.commands()[2]).size == 32);
166 CHECK(std::get<CopyResource>(parent.commands()[3]).src == 8);
167 CHECK(std::get<CopyResource>(parent.commands()[4]).src == 4);
168 CHECK(std::get<CopyBuffer>(parent.commands()[5]).size == 32);
169
170 // Resetting/rerecording the source bundle cannot mutate the parent's copied commands.
171 CHECK(bundle.reset());
172 CHECK(bundle.copy_resource({9, 10}));
173 CHECK(bundle.close());
174 CHECK(parent.commands().size() == 6);
175 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4);
176 CHECK(!parent.execute_bundle(bundle)); // parent is closed
177
178 CommandList open_parent, open_bundle;
179 CHECK(!open_parent.execute_bundle(open_bundle)); // bundle must be closed
180 CHECK(!open_parent.execute_bundle(open_parent)); // a list cannot execute itself
181 CHECK(open_parent.commands().empty());
182
149 return 0; 183 return 0;
150} 184}