Module: vkd3d Branch: master Commit: 78301d720205439acac6f19952b5c16bc0dfd583 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/78301d720205439acac6f19952b5c1...
Author: Conor McCarthy cmccarthy@codeweavers.com Date: Tue Apr 9 17:17:58 2024 +1000
vkd3d: Validate presence of flag ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL for multisampled resources.
---
libs/vkd3d/resource.c | 7 +++++++ tests/d3d12.c | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-)
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;