mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
libs/vkd3d: Forbid creating textures on UPLOAD/READBACK heaps.
This commit is contained in:
parent
fc1c9d914d
commit
e3fb82d544
@ -620,6 +620,13 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st
|
||||
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))
|
||||
{
|
||||
WARN("Texture cannot be created on a UPLOAD/READBACK heap.\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if (heap_properties->Type == D3D12_HEAP_TYPE_UPLOAD && initial_state != D3D12_RESOURCE_STATE_GENERIC_READ)
|
||||
{
|
||||
WARN("For D3D12_HEAP_TYPE_UPLOAD the state must be D3D12_RESOURCE_STATE_GENERIC_READ.\n");
|
||||
|
@ -853,6 +853,26 @@ static void test_create_committed_resource(void)
|
||||
refcount = ID3D12Resource_Release(resource);
|
||||
ok(!refcount, "ID3D12Resource has %u references left.\n", (unsigned int)refcount);
|
||||
|
||||
resource_desc.Flags = 0;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
todo(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
ID3D12Resource_Release(resource);
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD;
|
||||
|
||||
resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
|
||||
|
Loading…
Reference in New Issue
Block a user