mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-29 01:24:11 +01:00
[dxvk] Some minor refactoring
This commit is contained in:
parent
cc408e3329
commit
802fbe3cfd
@ -35,6 +35,30 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkCommandList::submit(
|
||||
VkQueue queue,
|
||||
VkSemaphore waitSemaphore,
|
||||
VkSemaphore wakeSemaphore,
|
||||
VkFence fence) {
|
||||
const VkPipelineStageFlags waitStageMask
|
||||
= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||
|
||||
VkSubmitInfo info;
|
||||
info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.waitSemaphoreCount = waitSemaphore == VK_NULL_HANDLE ? 0 : 1;
|
||||
info.pWaitSemaphores = &waitSemaphore;
|
||||
info.pWaitDstStageMask = &waitStageMask;
|
||||
info.commandBufferCount = 1;
|
||||
info.pCommandBuffers = &m_buffer;
|
||||
info.signalSemaphoreCount = wakeSemaphore == VK_NULL_HANDLE ? 0 : 1;
|
||||
info.pSignalSemaphores = &wakeSemaphore;
|
||||
|
||||
if (m_vkd->vkQueueSubmit(queue, 1, &info, fence) != VK_SUCCESS)
|
||||
throw DxvkError("DxvkDevice::submitCommandList: Command submission failed");
|
||||
}
|
||||
|
||||
|
||||
void DxvkCommandList::beginRecording() {
|
||||
VkCommandBufferBeginInfo info;
|
||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
|
@ -26,12 +26,18 @@ namespace dxvk {
|
||||
~DxvkCommandList();
|
||||
|
||||
/**
|
||||
* \brief Command buffer handle
|
||||
* \returns Command buffer handle
|
||||
* \brief Submits command list
|
||||
*
|
||||
* \param [in] queue Device queue
|
||||
* \param [in] waitSemaphore Semaphore to wait on
|
||||
* \param [in] wakeSemaphore Semaphore to signal
|
||||
* \param [in] fence Fence to signal
|
||||
*/
|
||||
VkCommandBuffer handle() const {
|
||||
return m_buffer;
|
||||
}
|
||||
void submit(
|
||||
VkQueue queue,
|
||||
VkSemaphore waitSemaphore,
|
||||
VkSemaphore wakeSemaphore,
|
||||
VkFence fence);
|
||||
|
||||
/**
|
||||
* \brief Begins recording
|
||||
|
@ -105,9 +105,8 @@ namespace dxvk {
|
||||
const Rc<DxvkSemaphore>& wakeSync) {
|
||||
Rc<DxvkFence> fence = new DxvkFence(m_vkd);
|
||||
|
||||
VkCommandBuffer commandBuffer = commandList->handle();
|
||||
VkSemaphore waitSemaphore = VK_NULL_HANDLE;
|
||||
VkSemaphore wakeSemaphore = VK_NULL_HANDLE;
|
||||
VkSemaphore waitSemaphore = VK_NULL_HANDLE;
|
||||
VkSemaphore wakeSemaphore = VK_NULL_HANDLE;
|
||||
|
||||
if (waitSync != nullptr) {
|
||||
waitSemaphore = waitSync->handle();
|
||||
@ -119,22 +118,8 @@ namespace dxvk {
|
||||
commandList->trackResource(wakeSync);
|
||||
}
|
||||
|
||||
const VkPipelineStageFlags waitStageMask
|
||||
= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||
|
||||
VkSubmitInfo info;
|
||||
info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
info.pNext = nullptr;
|
||||
info.waitSemaphoreCount = waitSemaphore == VK_NULL_HANDLE ? 0 : 1;
|
||||
info.pWaitSemaphores = &waitSemaphore;
|
||||
info.pWaitDstStageMask = &waitStageMask;
|
||||
info.commandBufferCount = commandBuffer == VK_NULL_HANDLE ? 0 : 1;
|
||||
info.pCommandBuffers = &commandBuffer;
|
||||
info.signalSemaphoreCount = wakeSemaphore == VK_NULL_HANDLE ? 0 : 1;
|
||||
info.pSignalSemaphores = &wakeSemaphore;
|
||||
|
||||
if (m_vkd->vkQueueSubmit(m_graphicsQueue, 1, &info, fence->handle()) != VK_SUCCESS)
|
||||
throw DxvkError("DxvkDevice::submitCommandList: Command submission failed");
|
||||
commandList->submit(m_graphicsQueue,
|
||||
waitSemaphore, wakeSemaphore, fence->handle());
|
||||
|
||||
// TODO Delay synchronization by putting these into a ring buffer
|
||||
fence->wait(std::numeric_limits<uint64_t>::max());
|
||||
|
Loading…
Reference in New Issue
Block a user