From: Conor McCarthy cmccarthy@codeweavers.com
--- tests/d3d12.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index b8d20a581..6a449762f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1601,7 +1601,18 @@ 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); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + /* D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET is required for multisampled resources. */ + resource_desc.SampleDesc.Count = 4; + 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.SampleDesc.Count = 1; + resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
resource_desc.Format = DXGI_FORMAT_UNKNOWN; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc,
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d/resource.c | 5 +++++ tests/d3d12.c | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 32f23ca23..dcba77784 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -2001,6 +2001,11 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12 WARN("Invalid initial resource state %#x.\n", initial_state); return E_INVALIDARG; } + if (initial_state == D3D12_RESOURCE_STATE_RENDER_TARGET && !(desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)) + { + WARN("Invalid initial resource state %#x for non-render-target.\n", initial_state); + return E_INVALIDARG; + }
if (optimized_clear_value && d3d12_resource_is_buffer(resource)) { diff --git a/tests/d3d12.c b/tests/d3d12.c index 318325697..5e79e4cc9 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1627,9 +1627,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, NULL, &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);
/* A texture cannot be created on a UPLOAD heap. */ heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD;
From: Conor McCarthy cmccarthy@codeweavers.com
--- libs/vkd3d/resource.c | 5 +++++ tests/d3d12.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index b83a45d06..32f23ca23 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1893,6 +1893,11 @@ 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)) + { + WARN("Sample count %u invalid without ALLOW_RENDER_TARGET.\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 6a449762f..318325697 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.SampleDesc.Count = 1; resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
This merge request was approved by Giovanni Mascellani.
Are multi-sampled depth/stencil resources allowed?