add check for starting a frame in an invalid situation

This commit is contained in:
Matthew 2026-03-09 13:47:41 +11:00
parent 4d9d8cf57e
commit ca41d7e4f4

View File

@ -439,6 +439,11 @@ struct Vulkan
Arena arena;
Arena[FRAME_OVERLAP] frame_arenas;
debug
{
bool frame_started;
}
u32 frame_index;
u32 semaphore_index;
@ -774,6 +779,16 @@ MapBuffer(T)(Buffer* buffer, u64 count)
void
BeginFrame()
{
debug
{
if(g_vk.frame_started)
{
assert(false, "BeginFrame called twice, did you forget to end the frame?");
}
g_vk.frame_started = true;
}
// TODO: move vkWaitForFences so it no longer holds up the frame, will need to change how fences are handled in regards to images though
VkResult result = vkWaitForFences(g_vk.device, 1, g_vk.render_fence_ptr, VK_TRUE, 1000000000);
VkCheckA("BeginFrame failure: vkWaitForFences error", result);
@ -961,6 +976,11 @@ SubmitAndPresent()
{
VkCheckA("FinishFrame failure: vkQueuePresentKHR failure", result);
}
debug
{
g_vk.frame_started = false;
}
}
void