Changeset 28ea92f in opengl-game for sdl-game.cpp


Ignore:
Timestamp:
Feb 14, 2021, 3:12:38 AM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
737c26a
Parents:
4e2c709
Message:

Rename the flag for recreating the swap chain to shouldRecreateSwapChain in both VulkanGame and SDLGame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sdl-game.cpp

    r4e2c709 r28ea92f  
    1515
    1616#define IMGUI_UNLIMITED_FRAME_RATE
    17 
    18 static bool g_SwapChainRebuild = false;
    1917
    2018static void check_imgui_vk_result(VkResult res) {
     
    172170
    173171      // Resize swap chain?
    174       if (g_SwapChainRebuild) {
     172      if (shouldRecreateSwapChain) {
    175173         int width, height;
    176174         SDL_GetWindowSize(window, &width, &height);
     
    184182
    185183            imageIndex = 0;
    186             g_SwapChainRebuild = false;
     184            shouldRecreateSwapChain = false;
    187185         }
    188186      }
     
    823821
    824822   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    825       g_SwapChainRebuild = true;
     823      shouldRecreateSwapChain = true;
    826824      return;
    827    }
    828    else {
     825   } else {
    829826      VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!");
    830827   }
     
    895892
    896893void VulkanGame::presentFrame() {
    897    if (g_SwapChainRebuild)
     894   if (shouldRecreateSwapChain) {
    898895      return;
     896   }
    899897
    900898   VkSemaphore signalSemaphores[] = { renderCompleteSemaphores[currentFrame] };
     
    914912   // to framebufferResized, but not quite the same
    915913   if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    916       g_SwapChainRebuild = true;
     914      shouldRecreateSwapChain = true;
    917915      return;
    918    }
    919    else if (result != VK_SUCCESS) {
     916   } else if (result != VK_SUCCESS) {
    920917      throw runtime_error("failed to present swap chain image!");
    921918   }
Note: See TracChangeset for help on using the changeset viewer.