mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Store WSI semaphore pair directly with the command list
This commit is contained in:
parent
85aa0a0ecb
commit
23c3960f65
@ -332,8 +332,8 @@ namespace dxvk {
|
||||
cHud = m_hud,
|
||||
cCommandList = m_context->endRecording()
|
||||
] (DxvkContext* ctx) {
|
||||
m_device->submitCommandList(cCommandList,
|
||||
cSync.acquire, cSync.present);
|
||||
cCommandList->setWsiSemaphores(cSync);
|
||||
m_device->submitCommandList(cCommandList);
|
||||
|
||||
if (cHud != nullptr && !cFrameId)
|
||||
cHud->update();
|
||||
@ -526,9 +526,7 @@ namespace dxvk {
|
||||
subresources, VK_IMAGE_LAYOUT_UNDEFINED);
|
||||
|
||||
m_device->submitCommandList(
|
||||
m_context->endRecording(),
|
||||
VK_NULL_HANDLE,
|
||||
VK_NULL_HANDLE);
|
||||
m_context->endRecording());
|
||||
}
|
||||
|
||||
|
||||
|
@ -715,8 +715,8 @@ namespace dxvk {
|
||||
cHud = m_hud,
|
||||
cCommandList = m_context->endRecording()
|
||||
] (DxvkContext* ctx) {
|
||||
m_device->submitCommandList(cCommandList,
|
||||
cSync.acquire, cSync.present);
|
||||
cCommandList->setWsiSemaphores(cSync);
|
||||
m_device->submitCommandList(cCommandList);
|
||||
|
||||
if (cHud != nullptr && !cFrameId)
|
||||
cHud->update();
|
||||
@ -890,9 +890,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
m_device->submitCommandList(
|
||||
m_context->endRecording(),
|
||||
VK_NULL_HANDLE,
|
||||
VK_NULL_HANDLE);
|
||||
m_context->endRecording());
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,9 +78,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
VkResult DxvkCommandList::submit(
|
||||
VkSemaphore waitSemaphore,
|
||||
VkSemaphore wakeSemaphore) {
|
||||
VkResult DxvkCommandList::submit() {
|
||||
const auto& graphics = m_device->queues().graphics;
|
||||
const auto& transfer = m_device->queues().transfer;
|
||||
|
||||
@ -123,16 +121,16 @@ namespace dxvk {
|
||||
m_submission.cmdBuffers.push_back(cmdInfo);
|
||||
}
|
||||
|
||||
if (waitSemaphore) {
|
||||
if (m_wsiSemaphores.acquire) {
|
||||
VkSemaphoreSubmitInfo waitInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||
waitInfo.semaphore = waitSemaphore;
|
||||
waitInfo.semaphore = m_wsiSemaphores.acquire;
|
||||
waitInfo.stageMask = VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT;
|
||||
m_submission.waitSync.push_back(waitInfo);
|
||||
}
|
||||
|
||||
if (wakeSemaphore) {
|
||||
if (m_wsiSemaphores.present) {
|
||||
VkSemaphoreSubmitInfo signalInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO };
|
||||
signalInfo.semaphore = wakeSemaphore;
|
||||
signalInfo.semaphore = m_wsiSemaphores.present;
|
||||
signalInfo.stageMask = VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT;
|
||||
m_submission.wakeSync.push_back(signalInfo);
|
||||
}
|
||||
@ -233,6 +231,8 @@ namespace dxvk {
|
||||
|
||||
m_waitSemaphores.clear();
|
||||
m_signalSemaphores.clear();
|
||||
|
||||
m_wsiSemaphores = vk::PresenterSync();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "../vulkan/vulkan_presenter.h"
|
||||
|
||||
#include "dxvk_bind_mask.h"
|
||||
#include "dxvk_buffer.h"
|
||||
#include "dxvk_descriptor.h"
|
||||
@ -71,13 +73,9 @@ namespace dxvk {
|
||||
* \brief Submits command list
|
||||
*
|
||||
* \param [in] queue Device queue
|
||||
* \param [in] waitSemaphore Semaphore to wait on
|
||||
* \param [in] wakeSemaphore Semaphore to signal
|
||||
* \returns Submission status
|
||||
*/
|
||||
VkResult submit(
|
||||
VkSemaphore waitSemaphore,
|
||||
VkSemaphore wakeSemaphore);
|
||||
VkResult submit();
|
||||
|
||||
/**
|
||||
* \brief Synchronizes command buffer execution
|
||||
@ -225,7 +223,17 @@ namespace dxvk {
|
||||
void signalFence(Rc<DxvkFence> fence, uint64_t value) {
|
||||
m_signalSemaphores.emplace_back(std::move(fence), value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Sets WSI semaphores to synchronize with
|
||||
*
|
||||
* The given semaphores must be binary semaphores.
|
||||
* \param [in] wsiSemaphores Pair of WSI semaphores
|
||||
*/
|
||||
void setWsiSemaphores(const vk::PresenterSync& wsiSemaphores) {
|
||||
m_wsiSemaphores = wsiSemaphores;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Resets the command list
|
||||
*
|
||||
@ -816,6 +824,8 @@ namespace dxvk {
|
||||
|
||||
VkSemaphore m_sdmaSemaphore = VK_NULL_HANDLE;
|
||||
|
||||
vk::PresenterSync m_wsiSemaphores = { };
|
||||
|
||||
DxvkCmdBufferFlags m_cmdBuffersUsed;
|
||||
DxvkLifetimeTracker m_resources;
|
||||
DxvkSignalTracker m_signalTracker;
|
||||
|
@ -135,9 +135,7 @@ namespace dxvk {
|
||||
|
||||
void DxvkContext::flushCommandList() {
|
||||
m_device->submitCommandList(
|
||||
this->endRecording(),
|
||||
VK_NULL_HANDLE,
|
||||
VK_NULL_HANDLE);
|
||||
this->endRecording());
|
||||
|
||||
this->beginRecording(
|
||||
m_device->createCommandList());
|
||||
|
@ -267,13 +267,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkDevice::submitCommandList(
|
||||
const Rc<DxvkCommandList>& commandList,
|
||||
VkSemaphore waitSync,
|
||||
VkSemaphore wakeSync) {
|
||||
const Rc<DxvkCommandList>& commandList) {
|
||||
DxvkSubmitInfo submitInfo;
|
||||
submitInfo.cmdList = commandList;
|
||||
submitInfo.waitSync = waitSync;
|
||||
submitInfo.wakeSync = wakeSync;
|
||||
m_submissionQueue.submit(submitInfo);
|
||||
|
||||
std::lock_guard<sync::Spinlock> statLock(m_statLock);
|
||||
|
@ -435,13 +435,9 @@ namespace dxvk {
|
||||
* Submits the given command list to the device using
|
||||
* the given set of optional synchronization primitives.
|
||||
* \param [in] commandList The command list to submit
|
||||
* \param [in] waitSync (Optional) Semaphore to wait on
|
||||
* \param [in] wakeSync (Optional) Semaphore to notify
|
||||
*/
|
||||
void submitCommandList(
|
||||
const Rc<DxvkCommandList>& commandList,
|
||||
VkSemaphore waitSync,
|
||||
VkSemaphore wakeSync);
|
||||
const Rc<DxvkCommandList>& commandList);
|
||||
|
||||
/**
|
||||
* \brief Locks submission queue
|
||||
|
@ -104,9 +104,7 @@ namespace dxvk {
|
||||
std::lock_guard<dxvk::mutex> lock(m_mutexQueue);
|
||||
|
||||
if (entry.submit.cmdList != nullptr) {
|
||||
status = entry.submit.cmdList->submit(
|
||||
entry.submit.waitSync,
|
||||
entry.submit.wakeSync);
|
||||
status = entry.submit.cmdList->submit();
|
||||
} else if (entry.present.presenter != nullptr) {
|
||||
status = entry.present.presenter->presentImage();
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ namespace dxvk {
|
||||
*/
|
||||
struct DxvkSubmitInfo {
|
||||
Rc<DxvkCommandList> cmdList;
|
||||
VkSemaphore waitSync;
|
||||
VkSemaphore wakeSync;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user