1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[vulkan] Add optional fence paratemer to acquireNextImage

We'll reset the fence prior to acquisition, so that the user of
this API won't have to do it.
This commit is contained in:
Philip Rebohle 2019-02-21 15:55:40 +01:00
parent 6d814b24da
commit 2231caaa9e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 13 additions and 4 deletions

View File

@ -227,7 +227,7 @@ namespace dxvk {
uint32_t imageIndex = 0; uint32_t imageIndex = 0;
VkResult status = m_presenter->acquireNextImage( VkResult status = m_presenter->acquireNextImage(
sync.acquire, imageIndex); sync.acquire, VK_NULL_HANDLE, imageIndex);
while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) { while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) {
RecreateSwapChain(m_vsync); RecreateSwapChain(m_vsync);
@ -236,7 +236,7 @@ namespace dxvk {
sync = m_presenter->getSyncSemaphores(); sync = m_presenter->getSyncSemaphores();
status = m_presenter->acquireNextImage( status = m_presenter->acquireNextImage(
sync.acquire, imageIndex); sync.acquire, VK_NULL_HANDLE, imageIndex);
} }
// Use an appropriate texture filter depending on whether // Use an appropriate texture filter depending on whether

View File

@ -42,11 +42,18 @@ namespace dxvk::vk {
VkResult Presenter::acquireNextImage( VkResult Presenter::acquireNextImage(
VkSemaphore signal, VkSemaphore signal,
VkFence fence,
uint32_t& index) { uint32_t& index) {
VkResult status = m_vkd->vkAcquireNextImageKHR( VkResult status;
if (fence && ((status = m_vkd->vkResetFences(
m_vkd->device(), 1, &fence)) != VK_SUCCESS))
return status;
status = m_vkd->vkAcquireNextImageKHR(
m_vkd->device(), m_swapchain, m_vkd->device(), m_swapchain,
std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::max(),
signal, VK_NULL_HANDLE, &m_imageIndex); signal, fence, &m_imageIndex);
if (status != VK_SUCCESS if (status != VK_SUCCESS
&& status != VK_SUBOPTIMAL_KHR) && status != VK_SUBOPTIMAL_KHR)

View File

@ -123,11 +123,13 @@ namespace dxvk::vk {
* must be recreated and a new image must * must be recreated and a new image must
* be acquired before proceeding. * be acquired before proceeding.
* \param [in] signal Semaphore to signal * \param [in] signal Semaphore to signal
* \param [in] fence Fence to signal (optional)
* \param [out] index Acquired image index * \param [out] index Acquired image index
* \returns Status of the operation * \returns Status of the operation
*/ */
VkResult acquireNextImage( VkResult acquireNextImage(
VkSemaphore signal, VkSemaphore signal,
VkFence fence,
uint32_t& index); uint32_t& index);
/** /**