mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
tests: Add test for mapping CPU inaccessible buffers.
This commit is contained in:
parent
69cd100d48
commit
34f6abc81d
@ -2568,7 +2568,7 @@ static void test_device_removed_reason(void)
|
||||
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
||||
}
|
||||
|
||||
static void test_map_texture(void)
|
||||
static void test_map_resource(void)
|
||||
{
|
||||
D3D12_HEAP_PROPERTIES heap_properties;
|
||||
D3D12_RESOURCE_DESC resource_desc;
|
||||
@ -2584,9 +2584,6 @@ static void test_map_texture(void)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&heap_properties, 0, sizeof(heap_properties));
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||
|
||||
resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
resource_desc.Alignment = 0;
|
||||
resource_desc.Width = 32;
|
||||
@ -2599,6 +2596,8 @@ static void test_map_texture(void)
|
||||
resource_desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
|
||||
resource_desc.Flags = 0;
|
||||
|
||||
memset(&heap_properties, 0, sizeof(heap_properties));
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
@ -2619,16 +2618,34 @@ static void test_map_texture(void)
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("Failed to create texture on custom heap.\n");
|
||||
goto failed;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The data pointer must be NULL for the UNKNOWN layout. */
|
||||
hr = ID3D12Resource_Map(resource, 0, NULL, &data);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
ID3D12Resource_Release(resource);
|
||||
}
|
||||
|
||||
/* The data pointer must be NULL for the UNKNOWN layout. */
|
||||
resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
|
||||
resource_desc.Height = 1;
|
||||
resource_desc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
|
||||
|
||||
memset(&heap_properties, 0, sizeof(heap_properties));
|
||||
heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
|
||||
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(SUCCEEDED(hr), "CreateCommittedResource failed, hr %#x.\n", hr);
|
||||
|
||||
/* Resources on a DEFAULT heap cannot be mapped. */
|
||||
hr = ID3D12Resource_Map(resource, 0, NULL, &data);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
todo(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
ID3D12Resource_Release(resource);
|
||||
|
||||
failed:
|
||||
refcount = ID3D12Device_Release(device);
|
||||
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
||||
}
|
||||
@ -2662,5 +2679,5 @@ START_TEST(d3d12)
|
||||
test_draw_instanced();
|
||||
test_invalid_texture_resource_barriers();
|
||||
test_device_removed_reason();
|
||||
test_map_texture();
|
||||
test_map_resource();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user