diff options
| author | totonii <totonicontato@gmail.com> | 2026-11-22 08:33:44 -0300 |
|---|---|---|
| committer | totonii <totonicontato@gmail.com> | 2026-11-22 08:33:44 -0300 |
| commit | 05e2e39db96234459ab8f74cc5e364f7ba01adeb (patch) | |
| tree | 60ddae38ef0a7e74819869bf661a04a7f450561e /runtime/test/descriptor_table_test.cpp | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (diff) | |
perf(vulkan): zero-copy DescriptorTable staging upload and uint32 wrap guard in read_slots
Diffstat (limited to 'runtime/test/descriptor_table_test.cpp')
| -rw-r--r-- | runtime/test/descriptor_table_test.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/runtime/test/descriptor_table_test.cpp b/runtime/test/descriptor_table_test.cpp index cda355a3f..a24a9c6e2 100644 --- a/runtime/test/descriptor_table_test.cpp +++ b/runtime/test/descriptor_table_test.cpp | |||
| @@ -326,8 +326,20 @@ int test_change_tracking() { | |||
| 326 | EXPECT(table.capacity() > before); | 326 | EXPECT(table.capacity() > before); |
| 327 | EXPECT(table.take_changes().all); | 327 | EXPECT(table.take_changes().all); |
| 328 | 328 | ||
| 329 | // Out-of-range slots are refused rather than read past the table. | 329 | // Out-of-range and wrapping uint32 slot ranges are refused rather than read past the table. |
| 330 | EXPECT(!table.read_slot(std::uint32_t(table.capacity()), read)); | 330 | EXPECT(!table.read_slot(std::uint32_t(table.capacity()), read)); |
| 331 | EXPECT(!table.read_slots(UINT32_MAX, 1, read)); | ||
| 332 | EXPECT(!table.read_slots(UINT32_MAX - 2, 4, read)); | ||
| 333 | EXPECT(!table.read_slots(0, 1, nullptr)); | ||
| 334 | EXPECT(table.read_slots(0, 0, nullptr)); | ||
| 335 | |||
| 336 | // Direct write_to_buffer matches build_gpu_buffer byte-for-byte for both clear_pad modes. | ||
| 337 | for (bool clear_pad : {false, true}) { | ||
| 338 | const auto expected = table.build_gpu_buffer(clear_pad); | ||
| 339 | std::vector<std::uint32_t> direct(table.size_dwords(), 0xccccccccu); | ||
| 340 | table.write_to_buffer(direct.data(), clear_pad); | ||
| 341 | EXPECT(direct == expected); | ||
| 342 | } | ||
| 331 | return 0; | 343 | return 0; |
| 332 | } | 344 | } |
| 333 | 345 | ||