mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-24 22:54:19 +01:00
[dxvk] Create timeline semaphores in submission queue
This commit is contained in:
parent
4c0cbbef6a
commit
5df5887095
@ -7,7 +7,20 @@ namespace dxvk {
|
|||||||
: m_device(device), m_callback(callback),
|
: m_device(device), m_callback(callback),
|
||||||
m_submitThread([this] () { submitCmdLists(); }),
|
m_submitThread([this] () { submitCmdLists(); }),
|
||||||
m_finishThread([this] () { finishCmdLists(); }) {
|
m_finishThread([this] () { finishCmdLists(); }) {
|
||||||
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
|
VkSemaphoreTypeCreateInfo semaphoreType = { VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO };
|
||||||
|
semaphoreType.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE;
|
||||||
|
|
||||||
|
VkSemaphoreCreateInfo semaphoreInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, &semaphoreType };
|
||||||
|
|
||||||
|
VkResult vrGraphics = vk->vkCreateSemaphore(vk->device(), &semaphoreInfo, nullptr, &m_semaphores.graphics);
|
||||||
|
VkResult vrTransfer = vk->vkCreateSemaphore(vk->device(), &semaphoreInfo, nullptr, &m_semaphores.transfer);
|
||||||
|
|
||||||
|
if (vrGraphics || vrTransfer) {
|
||||||
|
throw DxvkError(str::format("Failed to create timeline semaphores: ",
|
||||||
|
vrGraphics > vrTransfer ? vrGraphics : vrTransfer));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23,6 +36,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_submitThread.join();
|
m_submitThread.join();
|
||||||
m_finishThread.join();
|
m_finishThread.join();
|
||||||
|
|
||||||
|
vk->vkDestroySemaphore(vk->device(), m_semaphores.graphics, nullptr);
|
||||||
|
vk->vkDestroySemaphore(vk->device(), m_semaphores.transfer, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +59,26 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Timeline semaphore pair
|
||||||
|
*
|
||||||
|
* One semaphore for each queue.
|
||||||
|
*/
|
||||||
|
struct DxvkTimelineSemaphores {
|
||||||
|
VkSemaphore graphics = VK_NULL_HANDLE;
|
||||||
|
VkSemaphore transfer = VK_NULL_HANDLE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Timeline semaphore values
|
||||||
|
*/
|
||||||
|
struct DxvkTimelineSemaphoreValues {
|
||||||
|
uint64_t graphics = 0u;
|
||||||
|
uint64_t transfer = 0u;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Submission queue
|
* \brief Submission queue
|
||||||
*/
|
*/
|
||||||
@ -179,6 +199,9 @@ namespace dxvk {
|
|||||||
DxvkDevice* m_device;
|
DxvkDevice* m_device;
|
||||||
DxvkQueueCallback m_callback;
|
DxvkQueueCallback m_callback;
|
||||||
|
|
||||||
|
DxvkTimelineSemaphores m_semaphores;
|
||||||
|
DxvkTimelineSemaphoreValues m_timelines;
|
||||||
|
|
||||||
std::atomic<VkResult> m_lastError = { VK_SUCCESS };
|
std::atomic<VkResult> m_lastError = { VK_SUCCESS };
|
||||||
|
|
||||||
std::atomic<bool> m_stopped = { false };
|
std::atomic<bool> m_stopped = { false };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user