Changeset 7734042 in opengl-game


Ignore:
Timestamp:
Feb 14, 2021, 3:33:03 PM (4 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
484334e
Parents:
880cfc2
Message:

Cleanup VulkanGame code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r880cfc2 r7734042  
    17141714      imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);
    17151715
    1716    if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    1717       recreateSwapChain();
     1716   if (result == VK_SUBOPTIMAL_KHR) {
     1717      shouldRecreateSwapChain = true;
     1718   } else if (result == VK_ERROR_OUT_OF_DATE_KHR) {
     1719      shouldRecreateSwapChain = true;
    17181720      return;
    1719    } else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
    1720       throw runtime_error("failed to acquire swap chain image!");
    1721    }
    1722 
    1723    if (vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()) != VK_SUCCESS) {
    1724       throw runtime_error("failed waiting for fence!");
    1725    }
    1726    if (vkResetFences(device, 1, &inFlightFences[imageIndex]) != VK_SUCCESS) {
    1727       throw runtime_error("failed to reset fence!");
    1728    }
     1721   } else {
     1722      VKUTIL_CHECK_RESULT(result, "failed to acquire swap chain image!");
     1723   }
     1724
     1725   VKUTIL_CHECK_RESULT(
     1726      vkWaitForFences(device, 1, &inFlightFences[imageIndex], VK_TRUE, numeric_limits<uint64_t>::max()),
     1727      "failed waiting for fence!");
     1728
     1729   VKUTIL_CHECK_RESULT(vkResetFences(device, 1, &inFlightFences[imageIndex]),
     1730      "failed to reset fence!");
    17291731
    17301732   VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0),
     
    17331735   VkCommandBufferBeginInfo beginInfo = {};
    17341736   beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
    1735    beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
    1736    beginInfo.pInheritanceInfo = nullptr;
    1737 
    1738    if (vkBeginCommandBuffer(commandBuffers[imageIndex], &beginInfo) != VK_SUCCESS) {
    1739       throw runtime_error("failed to begin recording command buffer!");
    1740    }
     1737   beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
     1738
     1739   VKUTIL_CHECK_RESULT(vkBeginCommandBuffer(commandBuffers[imageIndex], &beginInfo),
     1740      "failed to begin recording command buffer!");
    17411741
    17421742   VkRenderPassBeginInfo renderPassInfo = {};
     
    17621762   vkCmdEndRenderPass(commandBuffers[imageIndex]);
    17631763
    1764    if (vkEndCommandBuffer(commandBuffers[imageIndex]) != VK_SUCCESS) {
    1765       throw runtime_error("failed to record command buffer!");
    1766    }
     1764   VKUTIL_CHECK_RESULT(vkEndCommandBuffer(commandBuffers[imageIndex]),
     1765      "failed to record command buffer!");
    17671766
    17681767   VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
Note: See TracChangeset for help on using the changeset viewer.