mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
libs/vkd3d: Validate "optimized_clear_value" for buffer resources.
This commit is contained in:
parent
60959ecf3c
commit
f601cbc04a
@ -621,9 +621,6 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st
|
||||
|
||||
resource->desc = *desc;
|
||||
|
||||
if (optimized_clear_value)
|
||||
FIXME("Ignoring optimized clear value.\n");
|
||||
|
||||
if (desc->Dimension != D3D12_RESOURCE_DIMENSION_BUFFER
|
||||
&& (heap_properties->Type == D3D12_HEAP_TYPE_UPLOAD || heap_properties->Type == D3D12_HEAP_TYPE_READBACK))
|
||||
{
|
||||
@ -642,6 +639,15 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (optimized_clear_value && desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
{
|
||||
WARN("Optimized clear value must be NULL for buffers.\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (optimized_clear_value)
|
||||
FIXME("Ignoring optimized clear value.\n");
|
||||
|
||||
switch (desc->Dimension)
|
||||
{
|
||||
case D3D12_RESOURCE_DIMENSION_BUFFER:
|
||||
|
@ -890,20 +890,23 @@ static void test_create_committed_resource(void)
|
||||
refcount = ID3D12Resource_Release(resource);
|
||||
ok(!refcount, "ID3D12Resource has %u references left.\n", (unsigned int)refcount);
|
||||
|
||||
/* For D3D12_RESOURCE_STATE_RENDER_TARGET the D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET flag is required. */
|
||||
resource_desc.Flags = 0;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
todo(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
ID3D12Resource_Release(resource);
|
||||
|
||||
/* A texture cannot be created on a UPLOAD heap. */
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
/* A texture cannot be created on a READBACK heap. */
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_READBACK;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COPY_DEST, NULL,
|
||||
@ -937,6 +940,12 @@ static void test_create_committed_resource(void)
|
||||
refcount = ID3D12Resource_Release(resource);
|
||||
ok(!refcount, "ID3D12Resource has %u references left.\n", (unsigned int)refcount);
|
||||
|
||||
/* The clear value must be NULL for buffers. */
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, &clear_value,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
/* For D3D12_HEAP_TYPE_UPLOAD the state must be D3D12_RESOURCE_STATE_GENERIC_READ. */
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user