diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index b83a45d0..60dffe3d 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1893,6 +1893,13 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3 WARN("Invalid sample count 0.\n"); return E_INVALIDARG; } + if (desc->SampleDesc.Count > 1 + && !(desc->Flags & (D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL))) + { + WARN("Sample count %u invalid without ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL.\n", + desc->SampleDesc.Count); + return E_INVALIDARG; + } if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0))) { diff --git a/tests/d3d12.c b/tests/d3d12.c index a0d738ac..69d72fb7 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1607,10 +1607,7 @@ static void test_create_committed_resource(void) resource_desc.Flags = 0; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &IID_ID3D12Resource, (void **)&resource); - todo ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); - if (SUCCEEDED(hr)) - ID3D12Resource_Release(resource); resource_desc.Format = DXGI_FORMAT_D32_FLOAT; resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;