Static arrays for fences and semaphores
This commit is contained in:
@@ -105,9 +105,9 @@ wapp_intern VmaAllocation depth_allocation = VK_NULL_HANDLE;
|
||||
wapp_intern VkBuffer vert_index_buf = VK_NULL_HANDLE;
|
||||
wapp_intern VmaAllocation vert_index_buf_alloc = VK_NULL_HANDLE;
|
||||
wapp_intern ShaderData shader_data = {};
|
||||
wapp_intern ShaderDataBufferArray shader_data_bufs;
|
||||
wapp_intern VkFenceArray fences = nullptr;
|
||||
wapp_intern VkSemaphoreArray image_acquired_semaphores = nullptr;
|
||||
wapp_intern ShaderDataBufferArray shader_data_bufs;
|
||||
wapp_intern VkFenceArray fences;
|
||||
wapp_intern VkSemaphoreArray image_acquired_semaphores;
|
||||
wapp_intern VkSemaphoreArray render_completed_semaphores = nullptr;
|
||||
|
||||
int main() {
|
||||
@@ -511,7 +511,7 @@ int main() {
|
||||
wapp_mem_arena_allocator_temp_end(&arena);
|
||||
|
||||
// {{{ Shader Data Buffers
|
||||
shader_data_bufs = wapp_array_with_capacity(ShaderDataBuffer, 3, ARRAY_INIT_FILLED);
|
||||
shader_data_bufs = wapp_array_with_capacity(ShaderDataBuffer, max_frames_in_flight, ARRAY_INIT_FILLED);
|
||||
for (u32 i = 0; i < max_frames_in_flight; ++i) {
|
||||
// {{{ Create Buffer
|
||||
VkBufferUsageFlags2CreateInfo data_buf_usage_flags = {};
|
||||
@@ -545,11 +545,8 @@ int main() {
|
||||
// }}}
|
||||
|
||||
// Synchronization Objects {{{
|
||||
fences = wapp_array_alloc_capacity(VkFence, &arena, max_frames_in_flight, ARRAY_INIT_FILLED);
|
||||
check(fences != nullptr, EXIT_CODE_SYNC_OBJ_CREATE_FAILED);
|
||||
|
||||
image_acquired_semaphores = wapp_array_alloc_capacity(VkSemaphore, &arena, max_frames_in_flight, ARRAY_INIT_FILLED);
|
||||
check(image_acquired_semaphores != nullptr, EXIT_CODE_SYNC_OBJ_CREATE_FAILED);
|
||||
fences = wapp_array_with_capacity(VkFence, max_frames_in_flight, ARRAY_INIT_FILLED);
|
||||
image_acquired_semaphores = wapp_array_with_capacity(VkSemaphore, max_frames_in_flight, ARRAY_INIT_FILLED);
|
||||
|
||||
// The number of semaphores used to signal rendering needs to match that of the swapchain's images
|
||||
render_completed_semaphores = wapp_array_alloc_capacity(VkSemaphore, &arena, swapchain_image_count, ARRAY_INIT_FILLED);
|
||||
@@ -572,6 +569,10 @@ int main() {
|
||||
}
|
||||
// }}}
|
||||
|
||||
// Command Pool {{{
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ Render Loop
|
||||
SDL_Event event = {};
|
||||
while (running) {
|
||||
@@ -591,7 +592,6 @@ int main() {
|
||||
// }}}
|
||||
|
||||
// {{{ Cleanup
|
||||
|
||||
for (u32 i = 0; i < swapchain_image_count; ++i) {
|
||||
vkDestroySemaphore(device, render_completed_semaphores[i], NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user