Changeset 7734042 in opengl-game for vulkan-game.cpp
- Timestamp:
- Feb 14, 2021, 3:33:03 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 484334e
- Parents:
- 880cfc2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-game.cpp
r880cfc2 r7734042 1714 1714 imageAcquiredSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex); 1715 1715 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; 1718 1720 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!"); 1729 1731 1730 1732 VKUTIL_CHECK_RESULT(vkResetCommandPool(device, commandPools[imageIndex], 0), … … 1733 1735 VkCommandBufferBeginInfo beginInfo = {}; 1734 1736 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!"); 1741 1741 1742 1742 VkRenderPassBeginInfo renderPassInfo = {}; … … 1762 1762 vkCmdEndRenderPass(commandBuffers[imageIndex]); 1763 1763 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!"); 1767 1766 1768 1767 VkSemaphore waitSemaphores[] = { imageAcquiredSemaphores[currentFrame] };
Note:
See TracChangeset
for help on using the changeset viewer.