mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[dxvk] Add fence support to command list
Co-authored-by: Derek Lesho <dlesho@codeweavers.com>
This commit is contained in:
parent
4167e1b887
commit
05a827703b
@ -106,7 +106,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||||
waitInfo.semaphore = m_sdmaSemaphore;
|
waitInfo.semaphore = m_sdmaSemaphore;
|
||||||
waitInfo.stageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
waitInfo.stageMask = VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT;
|
||||||
m_submission.waitSync.push_back(waitInfo);
|
m_submission.waitSync.push_back(waitInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ namespace dxvk {
|
|||||||
if (waitSemaphore) {
|
if (waitSemaphore) {
|
||||||
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||||
waitInfo.semaphore = waitSemaphore;
|
waitInfo.semaphore = waitSemaphore;
|
||||||
waitInfo.stageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
waitInfo.stageMask = VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT;
|
||||||
m_submission.waitSync.push_back(waitInfo);
|
m_submission.waitSync.push_back(waitInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +137,22 @@ namespace dxvk {
|
|||||||
m_submission.wakeSync.push_back(signalInfo);
|
m_submission.wakeSync.push_back(signalInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto& entry : m_waitSemaphores) {
|
||||||
|
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||||
|
waitInfo.semaphore = entry.fence->handle();
|
||||||
|
waitInfo.value = entry.value;
|
||||||
|
waitInfo.stageMask = VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT;
|
||||||
|
m_submission.waitSync.push_back(waitInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& entry : m_signalSemaphores) {
|
||||||
|
VkSemaphoreSubmitInfo signalInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||||
|
signalInfo.semaphore = entry.fence->handle();
|
||||||
|
signalInfo.value = entry.value;
|
||||||
|
signalInfo.stageMask = VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT;
|
||||||
|
m_submission.wakeSync.push_back(signalInfo);
|
||||||
|
}
|
||||||
|
|
||||||
return submitToQueue(graphics.queueHandle, m_fence, m_submission);
|
return submitToQueue(graphics.queueHandle, m_fence, m_submission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +223,9 @@ namespace dxvk {
|
|||||||
descriptorPools.second->recycleDescriptorPool(descriptorPools.first);
|
descriptorPools.second->recycleDescriptorPool(descriptorPools.first);
|
||||||
|
|
||||||
m_descriptorPools.clear();
|
m_descriptorPools.clear();
|
||||||
|
|
||||||
|
m_waitSemaphores.clear();
|
||||||
|
m_signalSemaphores.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "dxvk_bind_mask.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_buffer.h"
|
#include "dxvk_buffer.h"
|
||||||
#include "dxvk_descriptor.h"
|
#include "dxvk_descriptor.h"
|
||||||
|
#include "dxvk_fence.h"
|
||||||
#include "dxvk_gpu_event.h"
|
#include "dxvk_gpu_event.h"
|
||||||
#include "dxvk_gpu_query.h"
|
#include "dxvk_gpu_query.h"
|
||||||
#include "dxvk_lifetime.h"
|
#include "dxvk_lifetime.h"
|
||||||
@ -195,6 +196,26 @@ namespace dxvk {
|
|||||||
m_signalTracker.notify();
|
m_signalTracker.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Waits for fence
|
||||||
|
*
|
||||||
|
* \param [in] fence Fence to wait on
|
||||||
|
* \param [in] value Value to wait for
|
||||||
|
*/
|
||||||
|
void waitFence(Rc<DxvkFence> fence, uint64_t value) {
|
||||||
|
m_waitSemaphores.emplace_back(std::move(fence), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Signals fence
|
||||||
|
*
|
||||||
|
* \param [in] fence Fence to signal
|
||||||
|
* \param [in] value Value to signal to
|
||||||
|
*/
|
||||||
|
void signalFence(Rc<DxvkFence> fence, uint64_t value) {
|
||||||
|
m_signalSemaphores.emplace_back(std::move(fence), value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Resets the command list
|
* \brief Resets the command list
|
||||||
*
|
*
|
||||||
@ -784,7 +805,7 @@ namespace dxvk {
|
|||||||
VkCommandBuffer m_sdmaBuffer = VK_NULL_HANDLE;
|
VkCommandBuffer m_sdmaBuffer = VK_NULL_HANDLE;
|
||||||
|
|
||||||
VkSemaphore m_sdmaSemaphore = VK_NULL_HANDLE;
|
VkSemaphore m_sdmaSemaphore = VK_NULL_HANDLE;
|
||||||
|
|
||||||
DxvkCmdBufferFlags m_cmdBuffersUsed;
|
DxvkCmdBufferFlags m_cmdBuffersUsed;
|
||||||
DxvkLifetimeTracker m_resources;
|
DxvkLifetimeTracker m_resources;
|
||||||
DxvkSignalTracker m_signalTracker;
|
DxvkSignalTracker m_signalTracker;
|
||||||
@ -794,6 +815,9 @@ namespace dxvk {
|
|||||||
DxvkStatCounters m_statCounters;
|
DxvkStatCounters m_statCounters;
|
||||||
DxvkQueueSubmission m_submission;
|
DxvkQueueSubmission m_submission;
|
||||||
|
|
||||||
|
std::vector<DxvkFenceValuePair> m_waitSemaphores;
|
||||||
|
std::vector<DxvkFenceValuePair> m_signalSemaphores;
|
||||||
|
|
||||||
std::vector<std::pair<
|
std::vector<std::pair<
|
||||||
Rc<DxvkDescriptorPool>,
|
Rc<DxvkDescriptorPool>,
|
||||||
Rc<DxvkDescriptorManager>>> m_descriptorPools;
|
Rc<DxvkDescriptorManager>>> m_descriptorPools;
|
||||||
|
@ -2646,6 +2646,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkContext::waitFence(const Rc<DxvkFence>& fence, uint64_t value) {
|
||||||
|
m_cmd->waitFence(fence, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxvkContext::signalFence(const Rc<DxvkFence>& fence, uint64_t value) {
|
||||||
|
m_cmd->signalFence(fence, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::beginDebugLabel(VkDebugUtilsLabelEXT *label) {
|
void DxvkContext::beginDebugLabel(VkDebugUtilsLabelEXT *label) {
|
||||||
if (!m_device->instance()->extensions().extDebugUtils)
|
if (!m_device->instance()->extensions().extDebugUtils)
|
||||||
return;
|
return;
|
||||||
|
@ -1088,7 +1088,27 @@ namespace dxvk {
|
|||||||
void signal(
|
void signal(
|
||||||
const Rc<sync::Signal>& signal,
|
const Rc<sync::Signal>& signal,
|
||||||
uint64_t value);
|
uint64_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Waits for fence
|
||||||
|
*
|
||||||
|
* Stalls current command list execution until
|
||||||
|
* the fence reaches the given value or higher.
|
||||||
|
* \param [in] fence Fence to wait on
|
||||||
|
* \param [in] value Value to wait on
|
||||||
|
*/
|
||||||
|
void waitFence(const Rc<DxvkFence>& fence, uint64_t value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Signals fence
|
||||||
|
*
|
||||||
|
* Signals fence to the given value once the current
|
||||||
|
* command list execution completes on the GPU.
|
||||||
|
* \param [in] fence Fence to signal
|
||||||
|
* \param [in] value Value to signal
|
||||||
|
*/
|
||||||
|
void signalFence(const Rc<DxvkFence>& fence, uint64_t value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Begins a debug label region
|
* \brief Begins a debug label region
|
||||||
* \param [in] label The debug label
|
* \param [in] label The debug label
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "dxvk_resource.h"
|
#include "dxvk_resource.h"
|
||||||
|
|
||||||
@ -10,6 +12,7 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
class DxvkDevice;
|
class DxvkDevice;
|
||||||
|
class DxvkFence;
|
||||||
|
|
||||||
using DxvkFenceEvent = std::function<void ()>;
|
using DxvkFenceEvent = std::function<void ()>;
|
||||||
|
|
||||||
@ -20,6 +23,20 @@ namespace dxvk {
|
|||||||
uint64_t initialValue;
|
uint64_t initialValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Fence-value pair
|
||||||
|
*/
|
||||||
|
struct DxvkFenceValuePair {
|
||||||
|
DxvkFenceValuePair() { }
|
||||||
|
DxvkFenceValuePair(Rc<DxvkFence>&& fence_, uint64_t value_)
|
||||||
|
: fence(std::move(fence_)), value(value_) { }
|
||||||
|
DxvkFenceValuePair(const Rc<DxvkFence>& fence_, uint64_t value_)
|
||||||
|
: fence(fence_), value(value_) { }
|
||||||
|
|
||||||
|
Rc<DxvkFence> fence;
|
||||||
|
uint64_t value;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fence
|
* \brief Fence
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user