Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
configuration: [Debug, Release]
compiler: [gcc-9, gcc-13, clang-16]
cmake_options: [""]
cmake_options: ["-DFSO_BUILD_WITH_VULKAN=ON"]
include:
# Also include configurations that check if the code compiles without the graphics backends
- configuration: Debug
Expand All @@ -22,7 +22,7 @@ jobs:
cmake_options: -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_VULKAN=OFF
name: Linux
runs-on: ubuntu-latest
container: ghcr.io/scp-fs2open/linux_build:sha-1ff82e8
container: ghcr.io/scp-fs2open/linux_build:sha-efdf8d0
steps:
- uses: actions/checkout@v1
name: Checkout
Expand Down
14 changes: 11 additions & 3 deletions code/graphics/vulkan/RenderFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ void RenderFrame::waitForFinish()
return;
}

m_device.waitForFences(m_frameInFlightFence.get(), true, std::numeric_limits<uint64_t>::max());
// waitForFences can theoretically return a timeout, but as this passes the maximum uint64_t value in microseconds,
// this won't happen in practice, and the result can be ignored.
(void)m_device.waitForFences(m_frameInFlightFence.get(), true, std::numeric_limits<uint64_t>::max());
m_device.resetFences(m_frameInFlightFence.get());

// That frame is now definitely not in flight anymore so we can call the functions that depend on that
Expand All @@ -41,11 +43,14 @@ uint32_t RenderFrame::acquireSwapchainImage()
Assertion(!m_inFlight, "Cannot acquire swapchain image when frame is still in flight.");

uint32_t imageIndex;
m_device.acquireNextImageKHR(m_swapChain,
vk::Result res = m_device.acquireNextImageKHR(m_swapChain,
std::numeric_limits<uint64_t>::max(),
m_imageAvailableSemaphore.get(),
nullptr,
&imageIndex);
// TODO: This should handle at least VK_SUBOPTIMAL_KHR, which means that the swap chain is no longer
// optimal and should be recreated.
(void)res;

m_swapChainIdx = imageIndex;

Expand Down Expand Up @@ -85,7 +90,10 @@ void RenderFrame::submitAndPresent(const std::vector<vk::CommandBuffer>& cmdBuff
presentInfo.pImageIndices = &m_swapChainIdx;
presentInfo.pResults = nullptr;

m_presentQueue.presentKHR(presentInfo);
vk::Result res = m_presentQueue.presentKHR(presentInfo);
// TODO: This should handle at least VK_SUBOPTIMAL_KHR, which means that the swap chain is no longer
// optimal and should be recreated.
(void)res;
}

} // namespace vulkan
Expand Down
3 changes: 2 additions & 1 deletion code/graphics/vulkan/VulkanRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ bool VulkanRenderer::createSwapChain(const PhysicalDeviceValues& deviceValues)

m_swapChain = m_device->createSwapchainKHRUnique(createInfo);

m_swapChainImages = m_device->getSwapchainImagesKHR(m_swapChain.get());
std::vector<vk::Image> swapChainImages = m_device->getSwapchainImagesKHR(m_swapChain.get());
m_swapChainImages = SCP_vector<vk::Image>(swapChainImages.begin(), swapChainImages.end());
m_swapChainImageFormat = surfaceFormat.format;
m_swapChainExtent = createInfo.imageExtent;

Expand Down
Loading