1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-21 22:54:16 +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); ctx->setBarrierControl(cBarrierControlFlags);
}); });
// Stall here so that external submissions to the
// CS thread can actually access the command list
SynchronizeCsThread(DxvkCsThread::SynchronizeAll);
ClearState(); ClearState();
} }

View File

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

View File

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