-
Notifications
You must be signed in to change notification settings - Fork 66
Description
In this chapter there are multiple issues:
1.) The code for handling the return value of vk::raii::Queue::presentKHR is duplicated.
2.) The variable framebufferResized is used before it is introduced.
3.) We defined glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); in the past. It should be mentioned to set this to GLFW_TRUE for resizing.
4.) Subsection Fixing a deadlock fixes a problem that doesn't exist in my code. The fence was never reset above the return value handling. I suspect previous chapters already took care of the right structure? If we should get a deadlock, then previous chapters would need to restructure the fence position.
5.) Would be cool to mention how VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS has to be defined for the compiler to see it.
E.g. in CMakeLists.txt
target_compile_definitions(Vulkan-HppModule PUBLIC
...
VULKAN_HPP_HANDLE_ERROR_OUT_OF_DATE_AS_SUCCESS=1
)Edit 1: Another minor issue in Handling minimization: If the window is closed while minimized, the application will not close.
One solution could be:
void recreateSwapChain()
{
int width = 0, height = 0;
glfwGetFramebufferSize(window, &width, &height);
while ((width == 0 || height == 0) && !glfwWindowShouldClose(window))
{
glfwGetFramebufferSize(window, &width, &height);
glfwWaitEvents();
}
device.waitIdle();
if (glfwWindowShouldClose(window))
return;
cleanupSwapchain();
createSwapChain();
createImageViews();
}