vkd3d: Don't create user descriptors until we have observed a pipeline.
If we don't get a swapchain on first frame for whatever reason, defer creating the descriptors. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
4ac0a3b455
commit
a94e9b8b6a
|
@ -804,11 +804,16 @@ static BOOL d3d12_swapchain_is_present_mode_supported(struct d3d12_swapchain *sw
|
|||
return supported;
|
||||
}
|
||||
|
||||
static BOOL d3d12_swapchain_has_user_images(struct d3d12_swapchain *swapchain)
|
||||
static bool d3d12_swapchain_has_user_images(struct d3d12_swapchain *swapchain)
|
||||
{
|
||||
return !!swapchain->vk_images[0];
|
||||
}
|
||||
|
||||
static bool d3d12_swapchain_has_user_descriptors(struct d3d12_swapchain *swapchain)
|
||||
{
|
||||
return swapchain->descriptors.pool != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static HRESULT d3d12_swapchain_get_user_graphics_pipeline(struct d3d12_swapchain *swapchain, VkFormat format)
|
||||
{
|
||||
struct d3d12_device *device = d3d12_swapchain_device(swapchain);
|
||||
|
@ -929,9 +934,6 @@ static HRESULT d3d12_swapchain_create_user_buffers(struct d3d12_swapchain *swapc
|
|||
HRESULT hr;
|
||||
UINT i;
|
||||
|
||||
if (d3d12_swapchain_has_user_images(swapchain))
|
||||
return S_OK;
|
||||
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||
heap_properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
|
||||
heap_properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
|
||||
|
@ -951,6 +953,8 @@ static HRESULT d3d12_swapchain_create_user_buffers(struct d3d12_swapchain *swapc
|
|||
resource_desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
|
||||
resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||
|
||||
if (!d3d12_swapchain_has_user_images(swapchain))
|
||||
{
|
||||
for (i = 0; i < swapchain->desc.BufferCount; i++)
|
||||
{
|
||||
if (FAILED(hr = d3d12_resource_create_committed(d3d12_swapchain_device(swapchain),
|
||||
|
@ -973,7 +977,12 @@ static HRESULT d3d12_swapchain_create_user_buffers(struct d3d12_swapchain *swapc
|
|||
* right away. We will also drain the queue when we release the images, so there is no risk of early delete. */
|
||||
vkd3d_enqueue_initial_transition(&swapchain->command_queue->ID3D12CommandQueue_iface, swapchain->buffers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a swapchain pipeline layout yet (0x0 surface on first frame),
|
||||
* we cannot allocate any descriptors yet. We'll create the descriptors eventually
|
||||
* when we get a proper swapchain working. */
|
||||
if (!d3d12_swapchain_has_user_descriptors(swapchain) && swapchain->pipeline.vk_set_layout)
|
||||
if (FAILED(hr = d3d12_swapchain_create_user_descriptors(swapchain, vk_format)))
|
||||
return hr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue