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:
Diffstat (limited to 'runtime/test/command_list_test.cpp')
-rw-r--r--runtime/test/command_list_test.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp
index 49b7e27a8..d918cd67c 100644
--- a/runtime/test/command_list_test.cpp
+++ b/runtime/test/command_list_test.cpp
@@ -229,5 +229,50 @@ int main() {
229 CHECK(std::get<Predication>(predicated.commands()[1]).offset == 16); 229 CHECK(std::get<Predication>(predicated.commands()[1]).offset == 16);
230 const auto& off = std::get<Predication>(predicated.commands()[2]); 230 const auto& off = std::get<Predication>(predicated.commands()[2]);
231 CHECK(off.buffer == 0 && off.offset == 0 && off.op == 0); 231 CHECK(off.buffer == 0 && off.offset == 0 && off.op == 0);
232 // Queries: timestamps only end; other queries are begun and ended in one list, with the same type, and are not
233 // begun twice or resolved while running. Resolve offsets are multiples of 8; a resolve of nothing records nothing.
234 namespace q = d3d12_query;
235 namespace h = d3d12_query_heap;
236 CHECK(list.reset());
237 constexpr QueryHeapId heap = 70, other = 71;
238 CHECK(!list.begin_query({0, q::occlusion, 0}));
239 CHECK(!list.begin_query({heap, q::timestamp, 0}));
240 CHECK(list.end_query({heap, q::timestamp, 3}));
241 CHECK(list.end_query({heap, q::timestamp, 3})); // a timestamp can be written again
242 CHECK(!list.end_query({heap, q::occlusion, 1})); // never begun
243 CHECK(list.begin_query({heap, q::occlusion, 1}));
244 CHECK(!list.begin_query({heap, q::binary_occlusion, 1})); // already running
245 CHECK(list.begin_query({other, q::occlusion, 1})); // same index, another heap
246 CHECK(!list.end_query({heap, q::binary_occlusion, 1})); // begun with another type
247 CHECK(!list.resolve_queries({heap, q::occlusion, 0, 2, 9, 0})); // query 1 is running
248 CHECK(list.resolve_queries({heap, q::occlusion, 2, 2, 9, 0}));
249 CHECK(list.queries_open());
250 CHECK(list.end_query({heap, q::occlusion, 1}));
251 CHECK(list.end_query({other, q::occlusion, 1}));
252 CHECK(!list.queries_open());
253 CHECK(!list.resolve_queries({heap, q::occlusion, 0, 2, 9, 4})); // offset not a multiple of 8
254 CHECK(!list.resolve_queries({heap, q::occlusion, 0, 2, 0, 8})); // no destination
255 CHECK(!list.resolve_queries({heap, q::occlusion, 0xffffffff, 2, 9, 8})); // range wraps
256 CHECK(list.resolve_queries({heap, q::occlusion, 0, 2, 9, 16}));
257 CHECK(list.resolve_queries({heap, q::occlusion, 0, 0, 9, 16})); // nothing to resolve
258 CHECK(list.close());
259 CHECK(list.commands().size() == 8);
260 CHECK(std::get<EndQuery>(list.commands()[0]).index == 3 && std::get<EndQuery>(list.commands()[0]).type == q::timestamp);
261 CHECK(std::get<BeginQuery>(list.commands()[2]).heap == heap && std::get<BeginQuery>(list.commands()[3]).heap == other);
262 const auto& query_resolve = std::get<ResolveQueries>(list.commands()[7]);
263 CHECK(query_resolve.first == 0 && query_resolve.count == 2 && query_resolve.dst == 9 && query_resolve.offset == 16);
264
265 // A query still running at Close leaves the list closed and marked; Reset clears it.
266 CHECK(list.reset());
267 CHECK(list.begin_query({heap, q::pipeline_statistics, 0}));
268 CHECK(list.close() && list.queries_open());
269 CHECK(list.reset() && !list.queries_open());
270 CHECK(list.begin_query({heap, q::pipeline_statistics, 0})); // free again after the reset
271
272 CHECK(query_fits_heap(h::occlusion, q::binary_occlusion) && !query_fits_heap(h::occlusion, q::timestamp));
273 CHECK(query_fits_heap(h::copy_queue_timestamp, q::timestamp) && !query_fits_heap(h::timestamp, q::occlusion));
274 CHECK(query_fits_heap(h::so_statistics, q::so_statistics_stream3) && !query_fits_heap(6, q::occlusion));
275 CHECK(query_result_size(q::occlusion) == 8 && query_result_size(q::timestamp) == 8);
276 CHECK(query_result_size(q::pipeline_statistics) == 88 && query_result_size(q::so_statistics_stream0) == 0);
232 return 0; 277 return 0;
233} 278}