GPU: Add test for byte pattern clearing of storage buffers

This commit is contained in:
Clément Foucault
2025-02-07 12:23:46 +01:00
parent 445ae53c8e
commit 954b800c3f

View File

@@ -98,6 +98,30 @@ static void test_storage_buffer_clear()
GPU_TEST(storage_buffer_clear);
static void test_storage_buffer_clear_byte_pattern()
{
GPUStorageBuf *ssbo = GPU_storagebuf_create_ex(
SIZE_IN_BYTES, nullptr, GPU_USAGE_STATIC, __func__);
EXPECT_NE(ssbo, nullptr);
/* Tests a different clear command on Metal. */
GPU_storagebuf_clear(ssbo, 0xFCFCFCFCu);
/* Read back data from SSBO. */
Vector<int32_t> read_data;
read_data.resize(SIZE, 0);
GPU_storagebuf_read(ssbo, read_data.data());
/* Check if datatest_ is the same. */
for (int i : IndexRange(SIZE)) {
EXPECT_EQ(0xFCFCFCFCu, read_data[i]);
}
GPU_storagebuf_free(ssbo);
}
GPU_TEST(storage_buffer_clear_byte_pattern);
static void test_storage_buffer_copy_from_vertex_buffer()
{
GPUStorageBuf *ssbo = GPU_storagebuf_create_ex(