1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d11] Do not use separate context to initialize back buffers

This commit is contained in:
Philip Rebohle 2024-10-01 23:34:42 +02:00 committed by Philip Rebohle
parent 89ebabd8fd
commit 129efdaba6
3 changed files with 20 additions and 16 deletions

View File

@ -30,6 +30,10 @@ namespace dxvk {
ctx->setBarrierControl(cBarrierControlFlags);
});
// Stall here so that external submissions to the
// CS thread can actually access the command list
SynchronizeCsThread(DxvkCsThread::SynchronizeAll);
ClearState();
}

View File

@ -101,6 +101,15 @@ namespace dxvk {
DxvkCsChunkRef&& Chunk,
bool Synchronize);
template<typename Fn>
void InjectCsCommand(
Fn&& Command) {
auto chunk = AllocCsChunk();
chunk->push(std::move(Command));
EmitCsChunkExternal(std::move(chunk), false);
}
private:
DxvkCsThread m_csThread;

View File

@ -626,22 +626,13 @@ namespace dxvk {
// Initialize the image so that we can use it. Clearing
// to black prevents garbled output for the first frame.
VkImageSubresourceRange subresources;
subresources.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
subresources.baseMipLevel = 0;
subresources.levelCount = 1;
subresources.baseArrayLayer = 0;
subresources.layerCount = 1;
m_context->beginRecording(
m_device->createCommandList());
m_context->initImage(m_swapImage,
subresources, VK_IMAGE_LAYOUT_UNDEFINED);
m_device->submitCommandList(
m_context->endRecording(),
nullptr);
m_parent->GetContext()->InjectCsCommand([
cSwapImage = m_swapImage
] (DxvkContext* ctx) {
ctx->initImage(cSwapImage,
cSwapImage->getAvailableSubresources(),
VK_IMAGE_LAYOUT_UNDEFINED);
});
}