vkd3d: Validate presence of flag ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL for multisampled resources.

This commit is contained in:
Conor McCarthy 2024-04-09 17:17:58 +10:00 committed by Alexandre Julliard
parent e46de1daa2
commit 78301d7202
Notes: Alexandre Julliard 2024-04-11 17:04:33 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/772
2 changed files with 7 additions and 3 deletions

View File

@ -1893,6 +1893,13 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3
WARN("Invalid sample count 0.\n"); WARN("Invalid sample count 0.\n");
return E_INVALIDARG; 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))) if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
{ {

View File

@ -1607,10 +1607,7 @@ static void test_create_committed_resource(void)
resource_desc.Flags = 0; resource_desc.Flags = 0;
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &IID_ID3D12Resource, (void **)&resource); D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, NULL, &IID_ID3D12Resource, (void **)&resource);
todo
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); 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.Format = DXGI_FORMAT_D32_FLOAT;
resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;