Changeset 28ea92f in opengl-game
- Timestamp:
- Feb 14, 2021, 3:12:38 AM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 737c26a
- Parents:
- 4e2c709
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sdl-game.cpp
r4e2c709 r28ea92f 15 15 16 16 #define IMGUI_UNLIMITED_FRAME_RATE 17 18 static bool g_SwapChainRebuild = false;19 17 20 18 static void check_imgui_vk_result(VkResult res) { … … 172 170 173 171 // Resize swap chain? 174 if ( g_SwapChainRebuild) {172 if (shouldRecreateSwapChain) { 175 173 int width, height; 176 174 SDL_GetWindowSize(window, &width, &height); … … 184 182 185 183 imageIndex = 0; 186 g_SwapChainRebuild= false;184 shouldRecreateSwapChain = false; 187 185 } 188 186 } … … 823 821 824 822 if (result == VK_ERROR_OUT_OF_DATE_KHR) { 825 g_SwapChainRebuild= true;823 shouldRecreateSwapChain = true; 826 824 return; 827 } 828 else { 825 } else { 829 826 VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!"); 830 827 } … … 895 892 896 893 void VulkanGame::presentFrame() { 897 if ( g_SwapChainRebuild)894 if (shouldRecreateSwapChain) { 898 895 return; 896 } 899 897 900 898 VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] }; … … 914 912 // to framebufferResized, but not quite the same 915 913 if (result == VK_ERROR_OUT_OF_DATE_KHR) { 916 g_SwapChainRebuild= true;914 shouldRecreateSwapChain = true; 917 915 return; 918 } 919 else if (result != VK_SUCCESS) { 916 } else if (result != VK_SUCCESS) { 920 917 throw runtime_error("failed to present swap chain image!"); 921 918 } -
sdl-game.hpp
r4e2c709 r28ea92f 86 86 uint32_t currentFrame; 87 87 88 bool shouldRecreateSwapChain; 89 88 90 // My code, but not complete. Skips creating the SDL renderer, probably because it doesn't use hardware acceleration. 89 91 // I should try to get uncapped framerate and compare performance w/ and w/out an SDL renderer -
vulkan-game.cpp
r4e2c709 r28ea92f 65 65 66 66 this->currentFrame = 0; 67 this->framebufferResized= false;67 shouldRecreateSwapChain = false; 68 68 69 69 this->object_VP_mats = {}; … … 812 812 case UI_EVENT_WINDOWRESIZE: 813 813 cout << "Window resize event detected" << endl; 814 framebufferResized= true;814 shouldRecreateSwapChain = true; 815 815 break; 816 816 case UI_EVENT_KEYDOWN: … … 1800 1800 VkResult result = vkQueuePresentKHR(presentQueue, &presentInfo); 1801 1801 1802 if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || framebufferResized) {1803 framebufferResized= false;1802 if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || shouldRecreateSwapChain) { 1803 shouldRecreateSwapChain = false; 1804 1804 recreateSwapChain(); 1805 1805 } else if (result != VK_SUCCESS) { -
vulkan-game.hpp
r4e2c709 r28ea92f 293 293 uint32_t currentFrame; 294 294 295 bool framebufferResized;295 bool shouldRecreateSwapChain; 296 296 297 297 VkDescriptorPool imguiDescriptorPool;
Note:
See TracChangeset
for help on using the changeset viewer.