From 75617db76ea5a2966498bb015666f98c4d98019a Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 20 Jan 2025 19:15:38 +0100 Subject: [PATCH] [d3d11] Add queue parameter to CS chunk injection --- src/d3d11/d3d11_buffer.cpp | 2 +- src/d3d11/d3d11_context_imm.cpp | 3 ++- src/d3d11/d3d11_context_imm.h | 4 +++- src/d3d11/d3d11_device.cpp | 4 ++-- src/d3d11/d3d11_initializer.cpp | 2 +- src/d3d11/d3d11_swapchain.cpp | 4 ++-- src/d3d11/d3d11_texture.cpp | 4 ++-- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 22aa6d715..134719ca0 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -214,7 +214,7 @@ namespace dxvk { void D3D11Buffer::SetDebugName(const char* pName) { if (m_buffer) { - m_parent->GetContext()->InjectCs([ + m_parent->GetContext()->InjectCs(DxvkCsQueue::HighPriority, [ cBuffer = m_buffer, cName = std::string(pName ? pName : "") ] (DxvkContext* ctx) { diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 09d6add3b..31426c850 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -920,11 +920,12 @@ namespace dxvk { void D3D11ImmediateContext::InjectCsChunk( + DxvkCsQueue Queue, DxvkCsChunkRef&& Chunk, bool Synchronize) { // Do not update the sequence number when emitting a chunk // from an external source since that would break tracking - m_csThread.injectChunk(DxvkCsQueue::HighPriority, std::move(Chunk), Synchronize); + m_csThread.injectChunk(Queue, std::move(Chunk), Synchronize); } diff --git a/src/d3d11/d3d11_context_imm.h b/src/d3d11/d3d11_context_imm.h index b9f8748eb..4bf35f83d 100644 --- a/src/d3d11/d3d11_context_imm.h +++ b/src/d3d11/d3d11_context_imm.h @@ -98,16 +98,18 @@ namespace dxvk { } void InjectCsChunk( + DxvkCsQueue Queue, DxvkCsChunkRef&& Chunk, bool Synchronize); template void InjectCs( + DxvkCsQueue Queue, Fn&& Command) { auto chunk = AllocCsChunk(); chunk->push(std::move(Command)); - InjectCsChunk(std::move(chunk), false); + InjectCsChunk(Queue, std::move(chunk), false); } private: diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index b2cbba4b7..308c4674b 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -2828,7 +2828,7 @@ namespace dxvk { feedback = ctx->ensureImageCompatibility(cImage, usageInfo); }); - m_device->GetContext()->InjectCsChunk(std::move(chunk), true); + m_device->GetContext()->InjectCsChunk(DxvkCsQueue::HighPriority, std::move(chunk), true); if (!feedback) { Logger::err(str::format("Failed to lock image:" @@ -2852,7 +2852,7 @@ namespace dxvk { ctx->ensureBufferAddress(cBuffer); }); - m_device->GetContext()->InjectCsChunk(std::move(chunk), true); + m_device->GetContext()->InjectCsChunk(DxvkCsQueue::HighPriority, std::move(chunk), true); } diff --git a/src/d3d11/d3d11_initializer.cpp b/src/d3d11/d3d11_initializer.cpp index 2e31dbe1a..585705f75 100644 --- a/src/d3d11/d3d11_initializer.cpp +++ b/src/d3d11/d3d11_initializer.cpp @@ -371,7 +371,7 @@ namespace dxvk { void D3D11Initializer::FlushCsChunkLocked() { - m_parent->GetContext()->InjectCsChunk(std::move(m_csChunk), false); + m_parent->GetContext()->InjectCsChunk(DxvkCsQueue::HighPriority, std::move(m_csChunk), false); m_csChunk = m_parent->AllocCsChunk(DxvkCsChunkFlag::SingleUse); } diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index c08243bf9..6219f3985 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -576,7 +576,7 @@ namespace dxvk { // Initialize images so that we can use them. Clearing // to black prevents garbled output for the first frame. - m_parent->GetContext()->InjectCs([ + m_parent->GetContext()->InjectCs(DxvkCsQueue::HighPriority, [ cImages = std::move(images) ] (DxvkContext* ctx) { for (size_t i = 0; i < cImages.size(); i++) { @@ -612,7 +612,7 @@ namespace dxvk { void D3D11SwapChain::DestroyLatencyTracker() { // Need to make sure the context stops using // the tracker for submissions - m_parent->GetContext()->InjectCs([ + m_parent->GetContext()->InjectCs(DxvkCsQueue::Ordered, [ cLatency = m_latency ] (DxvkContext* ctx) { ctx->endLatencyTracking(cLatency); diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 781c25960..dfb201237 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -377,7 +377,7 @@ namespace dxvk { void D3D11CommonTexture::SetDebugName(const char* pName) { if (m_image) { - m_device->GetContext()->InjectCs([ + m_device->GetContext()->InjectCs(DxvkCsQueue::HighPriority, [ cImage = m_image, cName = std::string(pName ? pName : "") ] (DxvkContext* ctx) { @@ -387,7 +387,7 @@ namespace dxvk { if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_STAGING) { for (uint32_t i = 0; i < m_buffers.size(); i++) { - m_device->GetContext()->InjectCs([ + m_device->GetContext()->InjectCs(DxvkCsQueue::HighPriority, [ cBuffer = m_buffers[i].buffer, cName = std::string(pName ? pName : "") ] (DxvkContext* ctx) {