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() {
|
void DxvkCommandList::beginRecording() {
|
||||||
VkCommandBufferBeginInfo info;
|
VkCommandBufferBeginInfo info;
|
||||||
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||||
|
@ -26,12 +26,18 @@ namespace dxvk {
|
|||||||
~DxvkCommandList();
|
~DxvkCommandList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Command buffer handle
|
* \brief Submits command list
|
||||||
* \returns Command buffer handle
|
*
|
||||||
|
* \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 {
|
void submit(
|
||||||
return m_buffer;
|
VkQueue queue,
|
||||||
}
|
VkSemaphore waitSemaphore,
|
||||||
|
VkSemaphore wakeSemaphore,
|
||||||
|
VkFence fence);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Begins recording
|
* \brief Begins recording
|
||||||
|
@ -105,9 +105,8 @@ namespace dxvk {
|
|||||||
const Rc<DxvkSemaphore>& wakeSync) {
|
const Rc<DxvkSemaphore>& wakeSync) {
|
||||||
Rc<DxvkFence> fence = new DxvkFence(m_vkd);
|
Rc<DxvkFence> fence = new DxvkFence(m_vkd);
|
||||||
|
|
||||||
VkCommandBuffer commandBuffer = commandList->handle();
|
VkSemaphore waitSemaphore = VK_NULL_HANDLE;
|
||||||
VkSemaphore waitSemaphore = VK_NULL_HANDLE;
|
VkSemaphore wakeSemaphore = VK_NULL_HANDLE;
|
||||||
VkSemaphore wakeSemaphore = VK_NULL_HANDLE;
|
|
||||||
|
|
||||||
if (waitSync != nullptr) {
|
if (waitSync != nullptr) {
|
||||||
waitSemaphore = waitSync->handle();
|
waitSemaphore = waitSync->handle();
|
||||||
@ -119,22 +118,8 @@ namespace dxvk {
|
|||||||
commandList->trackResource(wakeSync);
|
commandList->trackResource(wakeSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
const VkPipelineStageFlags waitStageMask
|
commandList->submit(m_graphicsQueue,
|
||||||
= VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
waitSemaphore, wakeSemaphore, fence->handle());
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
// TODO Delay synchronization by putting these into a ring buffer
|
// TODO Delay synchronization by putting these into a ring buffer
|
||||||
fence->wait(std::numeric_limits<uint64_t>::max());
|
fence->wait(std::numeric_limits<uint64_t>::max());
|
||||||
|
Loading…
Reference in New Issue
Block a user