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:
parent
89ebabd8fd
commit
129efdaba6
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user