MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / test_all

Method test_all

tests/cgpu/ResourceCreation/ResourceCreation.cpp:81–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80template <ECGPUBackend backend>
81void ResourceCreation<backend>::test_all()
82 {
83 SUBCASE("CreateDStorageQueue")
84 {
85 SKR_DECLARE_ZERO(CGPUDStorageQueueDescriptor, desc)
86 desc.name = u8"DStorageQueue";
87 desc.capacity = 1024;
88 desc.priority = SKR_DSTORAGE_PRIORITY_NORMAL;
89 desc.source = SKR_DSTORAGE_SOURCE_FILE;
90 #ifdef _WIN32
91 if (backend == CGPU_BACKEND_D3D12)
92 {
93 SkrDStorageConfig config = {};
94 auto dstorageInstance = skr_create_dstorage_instance(&config);(void)dstorageInstance;
95 const auto support = cgpu_query_dstorage_availability(device);
96 EXPECT_EQ(support, SKR_DSTORAGE_AVAILABILITY_HARDWARE);
97 auto dstorageQueue = cgpu_create_dstorage_queue(device, &desc);
98 EXPECT_NE(dstorageQueue, nullptr);
99 cgpu_free_dstorage_queue(dstorageQueue);
100 skr_free_dstorage_instance(dstorageInstance);
101 }
102 #endif
103 }
104
105 SUBCASE("CreateIndexBuffer")
106 {
107 SKR_DECLARE_ZERO(CGPUBufferDescriptor, desc)
108 desc.flags = CGPU_BCF_NONE;
109 desc.descriptors = CGPU_RESOURCE_TYPE_INDEX_BUFFER;
110 desc.memory_usage = CGPU_MEM_USAGE_GPU_ONLY;
111 desc.element_stride = sizeof(uint16_t);
112 desc.elemet_count = 3;
113 desc.size = sizeof(uint16_t) * 3;
114 desc.name = u8"IndexBuffer";
115 auto buffer = cgpu_create_buffer(device, &desc);
116 EXPECT_NE(buffer, CGPU_NULLPTR);
117 EXPECT_EQ(buffer->info->cpu_mapped_address, CGPU_NULLPTR);
118 cgpu_free_buffer(buffer);
119 }
120
121 SUBCASE("CreateTexture")
122 {
123 SKR_DECLARE_ZERO(CGPUTextureDescriptor, desc)
124 desc.name = u8"Texture";
125 desc.flags = CGPU_TCF_DEDICATED_BIT;
126 desc.format = CGPU_FORMAT_R8G8B8A8_UNORM;
127 desc.start_state = CGPU_RESOURCE_STATE_COMMON;
128 desc.descriptors = CGPU_RESOURCE_TYPE_TEXTURE;
129 desc.width = 512;
130 desc.height = 512;
131 desc.depth = 1;
132 auto texture = cgpu_create_texture(device, &desc);
133 EXPECT_NE(texture, CGPU_NULLPTR);
134 cgpu_free_texture(texture);
135 }
136
137 SUBCASE("CreateTiledTexture")
138 {

Callers

nothing calls this directly

Calls 15

cgpu_free_dstorage_queueFunction · 0.85
cgpu_create_bufferFunction · 0.85
cgpu_free_bufferFunction · 0.85
cgpu_create_textureFunction · 0.85
cgpu_free_textureFunction · 0.85
cgpu_map_bufferFunction · 0.85
cgpu_unmap_bufferFunction · 0.85

Tested by

no test coverage detected