From a86a6819121a448d091b5e48192d624886016bf7 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Fri, 15 Oct 2021 01:37:40 +0200 Subject: [PATCH] vkd3d: Reject 0 sample count textures in d3d12_resource_validate_desc(). Buffers with 0 sample counts were already rejected here. Signed-off-by: Conor McCarthy Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d/resource.c | 6 ++++++ tests/d3d12.c | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index d6e5d4be..705e720f 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1681,6 +1681,12 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC *desc, struct d3d /* Fall through. */ case D3D12_RESOURCE_DIMENSION_TEXTURE2D: case D3D12_RESOURCE_DIMENSION_TEXTURE3D: + if (!desc->SampleDesc.Count) + { + WARN("Invalid sample count 0.\n"); + return E_INVALIDARG; + } + if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0))) { WARN("Invalid format %#x.\n", desc->Format); diff --git a/tests/d3d12.c b/tests/d3d12.c index 4a7309d6..08334765 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1703,9 +1703,7 @@ static void test_create_committed_resource(void) resource_desc.SampleDesc.Count = 0; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value, &IID_ID3D12Resource, (void **)&resource); - todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - ID3D12Resource_Release(resource); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); resource_desc.SampleDesc.Count = 1; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,