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:
authorkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 00:13:23 +0000
committerkotorvr <332716892+kotorvr@users.noreply.github.com>2026-11-22 00:13:23 +0000
commit1eaca53672187aed2d86b98264f9d617cd6c9720 (patch)
tree84b3d5945117ed20320245a84fa42e6ff037f0de /runtime/test/command_list_test.cpp
parent399b8ff8398b2d30ea178059bfc5a85f80186b95 (diff)
parent4abd54571b6efa02d97eda4711792fa00b455dc3 (diff)
Merge main into D3D-26: bundles and samplers on main; D3D-26 calls follow the bundle rules
main added ExecuteBundle (command_list.h, d3d12_com.cpp) and samplers (vulkan_backend.h); both sides are kept. DiscardResource and the atomic copies are now refused in a bundle, as D3D12 documents, and WriteBufferImmediate is allowed there (d3d12_com_test covers all four). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 88dce0a1d..101baf218 100644
--- a/runtime/test/command_list_test.cpp
+++ b/runtime/test/command_list_test.cpp
@@ -176,5 +176,39 @@ int main() {
176 const auto& atomic = std::get<AtomicCopyBuffer>(list.commands()[3]); 176 const auto& atomic = std::get<AtomicCopyBuffer>(list.commands()[3]);
177 CHECK(atomic.bytes == 8 && atomic.dst_offset == 8 && atomic.dependencies.size() == 1 && 177 CHECK(atomic.bytes == 8 && atomic.dst_offset == 8 && atomic.dependencies.size() == 1 &&
178 atomic.dependencies[0].end == 64); 178 atomic.dependencies[0].end == 64);
179
180 // Synthetic IR values here test copy-by-value mechanics only; the COM test below enforces D3D12 bundle
181 // restrictions on every currently implemented forbidden operation.
182 // Bundles are copied into the parent at ExecuteBundle time and can be reused independently.
183 CommandList parent, bundle;
184 CHECK(parent.copy_resource({1, 2}));
185 CHECK(bundle.copy_resource({3, 4}));
186 CHECK(bundle.copy_buffer({5, 0, 6, 16, 32}));
187 CHECK(bundle.close());
188 CHECK(parent.execute_bundle(bundle));
189 CHECK(parent.copy_resource({7, 8}));
190 CHECK(parent.execute_bundle(bundle)); // the same closed bundle can execute more than once
191 CHECK(parent.close());
192 CHECK(parent.commands().size() == 6);
193 CHECK(std::get<CopyResource>(parent.commands()[0]).src == 2);
194 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4);
195 CHECK(std::get<CopyBuffer>(parent.commands()[2]).size == 32);
196 CHECK(std::get<CopyResource>(parent.commands()[3]).src == 8);
197 CHECK(std::get<CopyResource>(parent.commands()[4]).src == 4);
198 CHECK(std::get<CopyBuffer>(parent.commands()[5]).size == 32);
199
200 // Resetting/rerecording the source bundle cannot mutate the parent's copied commands.
201 CHECK(bundle.reset());
202 CHECK(bundle.copy_resource({9, 10}));
203 CHECK(bundle.close());
204 CHECK(parent.commands().size() == 6);
205 CHECK(std::get<CopyResource>(parent.commands()[1]).src == 4);
206 CHECK(!parent.execute_bundle(bundle)); // parent is closed
207
208 CommandList open_parent, open_bundle;
209 CHECK(!open_parent.execute_bundle(open_bundle)); // bundle must be closed
210 CHECK(!open_parent.execute_bundle(open_parent)); // a list cannot execute itself
211 CHECK(open_parent.commands().empty());
212
179 return 0; 213 return 0;
180} 214}