tests: Implement readback for multisample textures.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia
2018-11-27 17:04:31 +01:00
committed by Alexandre Julliard
parent 404a459139
commit fedefca2ab
2 changed files with 62 additions and 48 deletions

View File

@@ -3630,16 +3630,15 @@ static void test_clear_depth_stencil_view(void)
static void test_clear_render_target_view(void)
{
static const unsigned int array_expected_colors[] = {0xff0000ff, 0xff00ff00, 0xffff0000};
static const unsigned int array_expected_colors[] = {0xff00ff00, 0xff0000ff, 0xffff0000};
static const struct vec4 array_colors[] =
{
{1.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 1.0f, 0.0f, 1.0f},
{1.0f, 0.0f, 0.0f, 1.0f},
{0.0f, 0.0f, 1.0f, 1.0f},
};
static const float color[] = {0.1f, 0.5f, 0.3f, 0.75f};
static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f};
ID3D12Resource *resource, *resolved_resource;
ID3D12GraphicsCommandList *command_list;
D3D12_CPU_DESCRIPTOR_HANDLE rtv_handle;
D3D12_RENDER_TARGET_VIEW_DESC rtv_desc;
@@ -3652,6 +3651,7 @@ static void test_clear_render_target_view(void)
struct resource_readback rb;
struct test_context context;
ID3D12CommandQueue *queue;
ID3D12Resource *resource;
ID3D12Device *device;
unsigned int i;
D3D12_BOX box;
@@ -3770,13 +3770,6 @@ static void test_clear_render_target_view(void)
D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value,
&IID_ID3D12Resource, (void **)&resource);
ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
resource_desc.DepthOrArraySize = 1;
resource_desc.SampleDesc.Count = 1;
hr = ID3D12Device_CreateCommittedResource(device,
&heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12_RESOURCE_STATE_COPY_SOURCE, NULL,
&IID_ID3D12Resource, (void **)&resolved_resource);
ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(array_colors); ++i)
{
@@ -3795,23 +3788,16 @@ static void test_clear_render_target_view(void)
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
for (i = 0; i < ARRAY_SIZE(array_expected_colors); ++i)
{
transition_resource_state(command_list, resolved_resource,
D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_COPY_DEST);
ID3D12GraphicsCommandList_ResolveSubresource(command_list,
resolved_resource, 0, resource, i, DXGI_FORMAT_R8G8B8A8_UNORM);
transition_resource_state(command_list, resolved_resource,
D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE);
check_sub_resource_uint(resolved_resource, 0, queue, command_list, array_expected_colors[i], 2);
check_sub_resource_uint(resource, i, queue, command_list, array_expected_colors[i], 2);
reset_command_list(command_list, context.allocator);
}
ID3D12Resource_Release(resolved_resource);
/* 3D texture */
ID3D12Resource_Release(resource);
resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
resource_desc.DepthOrArraySize = 32;
resource_desc.MipLevels = 1;
resource_desc.SampleDesc.Count = 1;
hr = ID3D12Device_CreateCommittedResource(device,
&heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc,
D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value,