diff options
Diffstat (limited to 'runtime/test/command_list_test.cpp')
| -rw-r--r-- | runtime/test/command_list_test.cpp | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/runtime/test/command_list_test.cpp b/runtime/test/command_list_test.cpp index 4d877d429..66750dbb3 100644 --- a/runtime/test/command_list_test.cpp +++ b/runtime/test/command_list_test.cpp | |||
| @@ -104,7 +104,8 @@ int main() { | |||
| 104 | CHECK(std::get<BufferBarrier>(list.commands()[2]).resource == 7); | 104 | CHECK(std::get<BufferBarrier>(list.commands()[2]).resource == 7); |
| 105 | CHECK(std::get<TextureBarrier>(list.commands()[3]).flags == texture_barrier_discard); | 105 | CHECK(std::get<TextureBarrier>(list.commands()[3]).flags == texture_barrier_discard); |
| 106 | 106 | ||
| 107 | // Copies: D3D12's own call rules (aligned footprints, a non-empty box, distinct CopyResource operands). | 107 | // Copies: D3D12's own call rules (aligned footprints; degenerate boxes and DEFAULT-heap |
| 108 | // CopyResource self-copies are accepted as no-ops and must not record Vulkan commands). | ||
| 108 | CHECK(list.reset()); | 109 | CHECK(list.reset()); |
| 109 | CHECK(list.copy_buffer({1, 0, 2, 16, 64})); | 110 | CHECK(list.copy_buffer({1, 0, 2, 16, 64})); |
| 110 | CHECK(list.copy_buffer({1, 0, 2, 16, 0})); | 111 | CHECK(list.copy_buffer({1, 0, 2, 16, 0})); |
| @@ -116,13 +117,18 @@ int main() { | |||
| 116 | CHECK(!list.copy_texture({placed, 0, 0, 0, placed, false, {}})); // footprint to footprint | 117 | CHECK(!list.copy_texture({placed, 0, 0, 0, placed, false, {}})); // footprint to footprint |
| 117 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 100, 8, 8, 1, 256}, false, {}})); // offset not 512 | 118 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 100, 8, 8, 1, 256}, false, {}})); // offset not 512 |
| 118 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 512, 8, 8, 1, 100}, false, {}})); // pitch not 256 | 119 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 512, 8, 8, 1, 100}, false, {}})); // pitch not 256 |
| 119 | CHECK(!list.copy_texture({texture, 0, 0, 0, texture, true, {2, 2, 0, 2, 6, 1}})); // empty box | 120 | CHECK(list.commands().size() == 3); |
| 121 | CHECK(list.copy_texture({texture, 0, 0, 0, texture, true, {2, 2, 0, 2, 6, 1}})); // empty box, no-op | ||
| 122 | CHECK(list.commands().size() == 3); | ||
| 120 | CHECK(list.copy_resource({5, 6})); | 123 | CHECK(list.copy_resource({5, 6})); |
| 121 | CHECK(!list.copy_resource({5, 5})); | 124 | CHECK(list.commands().size() == 4); |
| 125 | CHECK(list.copy_resource({5, 5})); // DEFAULT-heap self-copy; COM layer rejects UPLOAD self-copies | ||
| 126 | CHECK(list.commands().size() == 4); | ||
| 122 | // A volume's box has a z range, and its footprint a depth; a resolve needs two different resources. | 127 | // A volume's box has a z range, and its footprint a depth; a resolve needs two different resources. |
| 123 | CHECK(list.copy_texture({texture, 0, 0, 2, {4, true, 0, 512, 4, 4, 4, 256}, true, {0, 0, 1, 4, 4, 3}})); | 128 | CHECK(list.copy_texture({texture, 0, 0, 2, {4, true, 0, 512, 4, 4, 4, 256}, true, {0, 0, 1, 4, 4, 3}})); |
| 124 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 512, 4, 4, 0, 256}, false, {}})); // no slices | 129 | CHECK(!list.copy_texture({texture, 0, 0, 0, {4, true, 0, 512, 4, 4, 0, 256}, false, {}})); // no slices |
| 125 | CHECK(!list.copy_texture({texture, 0, 0, 0, texture, true, {0, 0, 2, 4, 4, 2}})); // empty in z | 130 | CHECK(list.copy_texture({texture, 0, 0, 0, texture, true, {0, 0, 2, 4, 4, 2}})); // empty in z, no-op |
| 131 | CHECK(list.commands().size() == 5); | ||
| 126 | CHECK(list.resolve_subresource({7, 1, 8, 0})); | 132 | CHECK(list.resolve_subresource({7, 1, 8, 0})); |
| 127 | CHECK(!list.resolve_subresource({7, 0, 7, 0})); | 133 | CHECK(!list.resolve_subresource({7, 0, 7, 0})); |
| 128 | CHECK(!list.resolve_subresource({0, 0, 8, 0})); | 134 | CHECK(!list.resolve_subresource({0, 0, 8, 0})); |
| @@ -181,12 +187,14 @@ int main() { | |||
| 181 | CHECK(!list.atomic_copy({42, 8, 42, 8, 8, {dependent}})); // onto itself | 187 | CHECK(!list.atomic_copy({42, 8, 42, 8, 8, {dependent}})); // onto itself |
| 182 | CHECK(!list.atomic_copy({42, 4, 43, 16, 8, {dependent}})); // UINT64 at an offset that is not 8-aligned | 188 | CHECK(!list.atomic_copy({42, 4, 43, 16, 8, {dependent}})); // UINT64 at an offset that is not 8-aligned |
| 183 | CHECK(!list.atomic_copy({42, 8, 43, 16, 2, {dependent}})); // neither UINT nor UINT64 | 189 | CHECK(!list.atomic_copy({42, 8, 43, 16, 2, {dependent}})); // neither UINT nor UINT64 |
| 184 | CHECK(!list.atomic_copy({42, 8, 43, 16, 4, {}})); // no dependencies | 190 | CHECK(list.atomic_copy({42, 8, 43, 16, 4, {}})); // zero dependencies is valid on Windows D3D12 |
| 191 | CHECK(!list.atomic_copy({42, 8, 43, 16, 4, {{41, 0, 8, 4}}})); // inverted dependent range | ||
| 192 | CHECK(!list.atomic_copy({42, 8, 43, 16, 4, {{41, 0, 4, 4}}})); // empty dependent range | ||
| 185 | CHECK(!list.atomic_copy({42, 8, 43, 16, 4, {{0, 0, 0, 4}}})); // a null dependent resource | 193 | CHECK(!list.atomic_copy({42, 8, 43, 16, 4, {{0, 0, 0, 4}}})); // a null dependent resource |
| 186 | CHECK(!list.atomic_copy({0, 8, 43, 16, 4, {dependent}})); | 194 | CHECK(!list.atomic_copy({0, 8, 43, 16, 4, {dependent}})); |
| 187 | CHECK(list.close()); | 195 | CHECK(list.close()); |
| 188 | CHECK(!list.discard({40, 0, 0, false, true}) && !list.discard({40, 0, 0, false})); | 196 | CHECK(!list.discard({40, 0, 0, false, true}) && !list.discard({40, 0, 0, false})); |
| 189 | CHECK(list.commands().size() == 5); | 197 | CHECK(list.commands().size() == 6); |
| 190 | CHECK(std::get<DiscardResource>(list.commands()[0]).whole); | 198 | CHECK(std::get<DiscardResource>(list.commands()[0]).whole); |
| 191 | CHECK(std::get<DiscardResource>(list.commands()[1]).first_subresource == 2 && | 199 | CHECK(std::get<DiscardResource>(list.commands()[1]).first_subresource == 2 && |
| 192 | std::get<DiscardResource>(list.commands()[1]).partial && !std::get<DiscardResource>(list.commands()[1]).whole); | 200 | std::get<DiscardResource>(list.commands()[1]).partial && !std::get<DiscardResource>(list.commands()[1]).whole); |
| @@ -307,5 +315,53 @@ int main() { | |||
| 307 | CHECK(query_fits_heap(h::so_statistics, q::so_statistics_stream3) && !query_fits_heap(6, q::occlusion)); | 315 | CHECK(query_fits_heap(h::so_statistics, q::so_statistics_stream3) && !query_fits_heap(6, q::occlusion)); |
| 308 | CHECK(query_result_size(q::occlusion) == 8 && query_result_size(q::timestamp) == 8); | 316 | CHECK(query_result_size(q::occlusion) == 8 && query_result_size(q::timestamp) == 8); |
| 309 | CHECK(query_result_size(q::pipeline_statistics) == 88 && query_result_size(q::so_statistics_stream0) == 16); | 317 | CHECK(query_result_size(q::pipeline_statistics) == 88 && query_result_size(q::so_statistics_stream0) == 16); |
| 318 | |||
| 319 | // Acceleration-structure commands: 256-byte AS/scratch alignment, 8-byte postbuild alignment, | ||
| 320 | // valid copy modes (0..4), valid postbuild info types (0..3), and PERFORM_UPDATE source checks. | ||
| 321 | CHECK(list.close()); | ||
| 322 | CHECK(list.reset()); | ||
| 323 | BuildAccelerationStructure build{}; | ||
| 324 | build.dst_va = 0x1000; | ||
| 325 | build.scratch_va = 0x2000; | ||
| 326 | CHECK(list.build_acceleration_structure(build)); | ||
| 327 | build.dst_va = 0; | ||
| 328 | CHECK(!list.build_acceleration_structure(build)); | ||
| 329 | build.dst_va = 0x1080; // misaligned | ||
| 330 | CHECK(!list.build_acceleration_structure(build)); | ||
| 331 | build.dst_va = 0x1000; | ||
| 332 | build.scratch_va = 0; | ||
| 333 | CHECK(!list.build_acceleration_structure(build)); | ||
| 334 | build.scratch_va = 0x2080; // misaligned | ||
| 335 | CHECK(!list.build_acceleration_structure(build)); | ||
| 336 | build.scratch_va = 0x2000; | ||
| 337 | build.update = true; | ||
| 338 | build.src_va = 0; | ||
| 339 | CHECK(!list.build_acceleration_structure(build)); | ||
| 340 | build.src_va = 0x3080; // misaligned update source | ||
| 341 | CHECK(!list.build_acceleration_structure(build)); | ||
| 342 | build.src_va = 0x3000; | ||
| 343 | CHECK(list.build_acceleration_structure(build)); | ||
| 344 | build.update = false; | ||
| 345 | build.src_va = 0x3080; // ignored when not updating | ||
| 346 | CHECK(list.build_acceleration_structure(build)); | ||
| 347 | |||
| 348 | CHECK(list.copy_acceleration_structure({0x1000, 0x2000, 0})); | ||
| 349 | CHECK(list.copy_acceleration_structure({0x1000, 0x2000, 4})); | ||
| 350 | CHECK(!list.copy_acceleration_structure({0x1000, 0x2000, 5})); | ||
| 351 | CHECK(!list.copy_acceleration_structure({0, 0x2000, 0})); | ||
| 352 | CHECK(!list.copy_acceleration_structure({0x1080, 0x2000, 0})); | ||
| 353 | CHECK(!list.copy_acceleration_structure({0x1000, 0, 0})); | ||
| 354 | CHECK(!list.copy_acceleration_structure({0x1000, 0x2080, 0})); | ||
| 355 | |||
| 356 | CHECK(list.acceleration_structure_postbuild({0x4000, 0, {0x1000}})); | ||
| 357 | CHECK(list.acceleration_structure_postbuild({0x4008, 3, {0x1000, 0x2000}})); | ||
| 358 | CHECK(!list.acceleration_structure_postbuild({0x4000, 4, {0x1000}})); | ||
| 359 | CHECK(!list.acceleration_structure_postbuild({0, 0, {0x1000}})); | ||
| 360 | CHECK(!list.acceleration_structure_postbuild({0x4004, 0, {0x1000}})); | ||
| 361 | CHECK(!list.acceleration_structure_postbuild({0x4000, 0, {}})); | ||
| 362 | CHECK(!list.acceleration_structure_postbuild({0x4000, 0, {0}})); | ||
| 363 | CHECK(!list.acceleration_structure_postbuild({0x4000, 0, {0x1080}})); | ||
| 364 | CHECK(list.close()); | ||
| 365 | CHECK(list.commands().size() == 7); | ||
| 310 | return 0; | 366 | return 0; |
| 311 | } | 367 | } |