From: Conor McCarthy Subject: [PATCH vkd3d 09/10] vkd3d: Return E_INVALIDARG for texture creation if SampleDesc.Count == 0. Message-Id: <20210917153708.27834-9-cmccarthy@codeweavers.com> Date: Sat, 18 Sep 2021 01:37:07 +1000 In-Reply-To: <20210917153708.27834-1-cmccarthy@codeweavers.com> References: <20210917153708.27834-1-cmccarthy@codeweavers.com> Signed-off-by: Conor McCarthy --- libs/vkd3d/resource.c | 6 ++++++ tests/d3d12.c | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index e950868b..e6b326e6 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 == 0) + { + 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 066a4346..2f81f027 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1778,10 +1778,7 @@ static void test_create_committed_resource(void) 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); resource_desc.SampleDesc.Count = 1; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, -- 2.32.0