From: Conor McCarthy Subject: [PATCH vkd3d 05/10] vkd3d: Use ALLOW_ONLY_BUFFERS for committed buffer resources. Message-Id: <20210917153708.27834-5-cmccarthy@codeweavers.com> Date: Sat, 18 Sep 2021 01:37:03 +1000 In-Reply-To: <20210917153708.27834-1-cmccarthy@codeweavers.com> References: <20210917153708.27834-1-cmccarthy@codeweavers.com> Otherwise, we may end up failing to allocate memory on Tier 1 hardware, and also fail to use dedicated allocations in some cases. Based on a vkd3d-proton patch by Philip Rebohle. Signed-off-by: Conor McCarthy --- libs/vkd3d/resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index f6c1851b..e950868b 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -611,7 +611,7 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap, if (d3d12_resource_is_buffer(resource)) { hr = vkd3d_allocate_buffer_memory(device, resource->u.vk_buffer, - &heap->desc.Properties, heap->desc.Flags, + &heap->desc.Properties, heap->desc.Flags | D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS, &heap->vk_memory, &heap->vk_memory_type, &vk_memory_size); } else @@ -4004,7 +4004,7 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, resource_desc.SampleDesc.Count = 1; resource_desc.SampleDesc.Quality = 0; resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; - resource_desc.Flags = D3D12_RESOURCE_FLAG_NONE; + resource_desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS; if (FAILED(hr = vkd3d_create_buffer(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, &null_resources->vk_buffer))) @@ -4020,7 +4020,7 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, &resource_desc, &null_resources->vk_storage_buffer))) goto fail; if (!use_sparse_resources && FAILED(hr = vkd3d_allocate_buffer_memory(device, null_resources->vk_storage_buffer, - &heap_properties, D3D12_HEAP_FLAG_NONE, &null_resources->vk_storage_buffer_memory, NULL, NULL))) + &heap_properties, D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS, &null_resources->vk_storage_buffer_memory, NULL, NULL))) goto fail; /* 2D SRV */ -- 2.32.0