mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[dxvk] Submit sparse binding operations alongside command buffers
This commit is contained in:
parent
d3b6502a17
commit
2615af7664
2 changed files with 36 additions and 3 deletions
|
@ -194,6 +194,7 @@ namespace dxvk {
|
||||||
|
|
||||||
const auto& graphics = m_device->queues().graphics;
|
const auto& graphics = m_device->queues().graphics;
|
||||||
const auto& transfer = m_device->queues().transfer;
|
const auto& transfer = m_device->queues().transfer;
|
||||||
|
const auto& sparse = m_device->queues().sparse;
|
||||||
|
|
||||||
m_commandSubmission.reset();
|
m_commandSubmission.reset();
|
||||||
|
|
||||||
|
@ -203,15 +204,41 @@ namespace dxvk {
|
||||||
|
|
||||||
const auto& cmd = m_cmdSubmissions[i];
|
const auto& cmd = m_cmdSubmissions[i];
|
||||||
|
|
||||||
|
auto sparseBind = cmd.sparseBind
|
||||||
|
? &m_cmdSparseBinds[cmd.sparseCmd]
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
|
if (sparseBind) {
|
||||||
|
// Sparse bindig needs to serialize command execution, so wait
|
||||||
|
// for any prior submissions, then block any subsequent ones
|
||||||
|
sparseBind->waitSemaphore(semaphore, semaphoreValue);
|
||||||
|
sparseBind->signalSemaphore(semaphore, ++semaphoreValue);
|
||||||
|
|
||||||
|
m_commandSubmission.waitSemaphore(semaphore, semaphoreValue,
|
||||||
|
VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
// Wait for per-command list semaphores on first submission
|
// Wait for per-command list semaphores on first submission
|
||||||
for (const auto& entry : m_waitSemaphores) {
|
for (const auto& entry : m_waitSemaphores) {
|
||||||
m_commandSubmission.waitSemaphore(
|
if (sparseBind) {
|
||||||
entry.fence->handle(),
|
sparseBind->waitSemaphore(
|
||||||
entry.value, VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT);
|
entry.fence->handle(),
|
||||||
|
entry.value);
|
||||||
|
} else {
|
||||||
|
m_commandSubmission.waitSemaphore(
|
||||||
|
entry.fence->handle(),
|
||||||
|
entry.value, VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Execute sparse bind
|
||||||
|
if (sparseBind) {
|
||||||
|
if ((status = sparseBind->submit(m_device, sparse.queueHandle)))
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
// Submit transfer commands as necessary
|
// Submit transfer commands as necessary
|
||||||
if (cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer))
|
if (cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer))
|
||||||
m_commandSubmission.executeCommandBuffer(cmd.sdmaBuffer);
|
m_commandSubmission.executeCommandBuffer(cmd.sdmaBuffer);
|
||||||
|
@ -353,7 +380,9 @@ namespace dxvk {
|
||||||
|
|
||||||
m_waitSemaphores.clear();
|
m_waitSemaphores.clear();
|
||||||
m_signalSemaphores.clear();
|
m_signalSemaphores.clear();
|
||||||
|
|
||||||
m_cmdSubmissions.clear();
|
m_cmdSubmissions.clear();
|
||||||
|
m_cmdSparseBinds.clear();
|
||||||
|
|
||||||
m_wsiSemaphores = vk::PresenterSync();
|
m_wsiSemaphores = vk::PresenterSync();
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "dxvk_limits.h"
|
#include "dxvk_limits.h"
|
||||||
#include "dxvk_pipelayout.h"
|
#include "dxvk_pipelayout.h"
|
||||||
#include "dxvk_signal.h"
|
#include "dxvk_signal.h"
|
||||||
|
#include "dxvk_sparse.h"
|
||||||
#include "dxvk_staging.h"
|
#include "dxvk_staging.h"
|
||||||
#include "dxvk_stats.h"
|
#include "dxvk_stats.h"
|
||||||
|
|
||||||
|
@ -122,6 +123,8 @@ namespace dxvk {
|
||||||
VkCommandBuffer execBuffer = VK_NULL_HANDLE;
|
VkCommandBuffer execBuffer = VK_NULL_HANDLE;
|
||||||
VkCommandBuffer initBuffer = VK_NULL_HANDLE;
|
VkCommandBuffer initBuffer = VK_NULL_HANDLE;
|
||||||
VkCommandBuffer sdmaBuffer = VK_NULL_HANDLE;
|
VkCommandBuffer sdmaBuffer = VK_NULL_HANDLE;
|
||||||
|
VkBool32 sparseBind = VK_FALSE;
|
||||||
|
uint32_t sparseCmd = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -990,6 +993,7 @@ namespace dxvk {
|
||||||
std::vector<DxvkFenceValuePair> m_signalSemaphores;
|
std::vector<DxvkFenceValuePair> m_signalSemaphores;
|
||||||
|
|
||||||
std::vector<DxvkCommandSubmissionInfo> m_cmdSubmissions;
|
std::vector<DxvkCommandSubmissionInfo> m_cmdSubmissions;
|
||||||
|
std::vector<DxvkSparseBindSubmission> m_cmdSparseBinds;
|
||||||
|
|
||||||
std::vector<std::pair<
|
std::vector<std::pair<
|
||||||
Rc<DxvkDescriptorPool>,
|
Rc<DxvkDescriptorPool>,
|
||||||
|
|
Loading…
Add table
Reference in a new issue