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