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.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp
index 8baa5fd81..13b9afcba 100644
--- a/runtime/test/command_list_test.cpp
+++ b/runtime/test/command_list_test.cpp
@@ -69,6 +69,41 @@ int main() {
69 const auto* both = std::get_if<ClearDepthStencil>(&commands[6]); 69 const auto* both = std::get_if<ClearDepthStencil>(&commands[6]);
70 CHECK(both && both->flags == (clear_depth | clear_stencil) && both->depth == 0.25f && both->stencil == 3); 70 CHECK(both && both->flags == (clear_depth | clear_stencil) && both->depth == 0.25f && both->stencil == 3);
71 71
72 // Rectangles are copied while recording.
73 CHECK(list.reset());
74 Rect rects[] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
75 CHECK(list.clear_render_target({36, 0, 0, 1}, color, rects));
76 CHECK(list.clear_depth_stencil({48, 0, 0, 1}, clear_depth, 0.5f, 0, {rects, 1}));
77 rects[0] = {};
78 CHECK(list.close());
79 const auto& rect_clear = std::get<ClearRenderTarget>(list.commands()[0]);
80 CHECK(rect_clear.rects.size() == 2 && rect_clear.rects[0].left == 1 && rect_clear.rects[1].bottom == 8);
81 CHECK(std::get<ClearDepthStencil>(list.commands()[1]).rects.size() == 1);
82
83 // Enhanced barriers: split begin halves are dropped, end halves kept; invalid shapes are refused.
84 namespace y = d3d12_sync;
85 namespace a = d3d12_access;
86 namespace l = d3d12_layout;
87 CHECK(list.reset());
88 const BarrierSubresourceRange all{all_subresources, 0, 0, 0, 0, 0};
89 CHECK(list.barrier(GlobalBarrier{y::all, y::all, a::common, a::common}));
90 CHECK(list.barrier(GlobalBarrier{y::compute_shading, y::split, a::unordered_access, a::shader_resource}));
91 CHECK(list.barrier(GlobalBarrier{y::split, y::pixel_shading, a::unordered_access, a::shader_resource}));
92 CHECK(!list.barrier(GlobalBarrier{y::split, y::split, 0, 0}));
93 CHECK(list.barrier(BufferBarrier{y::copy, y::vertex_shading, a::copy_dest, a::vertex_buffer, 7}));
94 CHECK(!list.barrier(BufferBarrier{y::copy, y::vertex_shading, a::copy_dest, a::vertex_buffer, 0}));
95 CHECK(list.barrier(TextureBarrier{y::none, y::render_target, a::no_access, a::render_target, l::undefined,
96 l::render_target, 9, all, texture_barrier_discard}));
97 CHECK(!list.barrier(TextureBarrier{y::all, y::all, a::common, a::common, l::common, l::undefined, 9, all, 0}));
98 CHECK(!list.barrier(TextureBarrier{y::all, y::all, a::common, a::common, l::common, l::common, 9, all, 0x2}));
99 CHECK(!list.barrier(TextureBarrier{y::all, y::all, a::common, a::common, l::common, l::common, 9,
100 {0, 1, 0, 0, 0, 1}, 0})); // zero layers
101 CHECK(list.close());
102 CHECK(list.commands().size() == 4);
103 CHECK(std::get<GlobalBarrier>(list.commands()[1]).sync_before == y::split);
104 CHECK(std::get<BufferBarrier>(list.commands()[2]).resource == 7);
105 CHECK(std::get<TextureBarrier>(list.commands()[3]).flags == texture_barrier_discard);
106
72 CHECK(list.reset()); 107 CHECK(list.reset());
73 CHECK(!list.closed() && list.commands().empty()); 108 CHECK(!list.closed() && list.commands().empty());
74 CHECK(!list.reset()); 109 CHECK(!list.reset());