Commit a1bcc9b7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d11/tests: Add some tests for copying between depth/stencil and colour formats.

parent 8572de60
......@@ -28184,6 +28184,8 @@ static void test_format_compatibility(void)
DXGI_FORMAT dst_format;
size_t texel_size;
BOOL success;
BOOL src_ds;
BOOL dst_ds;
}
test_data[] =
{
......@@ -28213,6 +28215,10 @@ static void test_format_compatibility(void)
{DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_UINT, 8, TRUE},
{DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_SINT, 8, TRUE},
{DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_TYPELESS, 8, TRUE},
{DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_R16_UNORM, 2, TRUE, TRUE},
{DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, 2, TRUE, FALSE, TRUE},
{DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_TYPELESS, 2, TRUE, TRUE},
{DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_TYPELESS, 2, TRUE, FALSE, TRUE},
};
static const DWORD initial_data[16] = {0};
static const DWORD bitmap_data[] =
......@@ -28235,7 +28241,6 @@ static void test_format_compatibility(void)
texture_desc.ArraySize = 1;
texture_desc.SampleDesc.Count = 1;
texture_desc.SampleDesc.Quality = 0;
texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
texture_desc.CPUAccessFlags = 0;
texture_desc.MiscFlags = 0;
......@@ -28247,7 +28252,8 @@ static void test_format_compatibility(void)
texture_desc.Width = sizeof(bitmap_data) / (texture_desc.Height * test_data[i].texel_size);
texture_desc.Format = test_data[i].src_format;
texture_desc.Usage = D3D11_USAGE_IMMUTABLE;
texture_desc.Usage = test_data[i].src_ds ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
texture_desc.BindFlags = test_data[i].src_ds ? D3D11_BIND_DEPTH_STENCIL : D3D11_BIND_SHADER_RESOURCE;
resource_data.pSysMem = bitmap_data;
resource_data.SysMemPitch = texture_desc.Width * test_data[i].texel_size;
......@@ -28258,6 +28264,7 @@ static void test_format_compatibility(void)
texture_desc.Format = test_data[i].dst_format;
texture_desc.Usage = D3D11_USAGE_DEFAULT;
texture_desc.BindFlags = test_data[i].dst_ds ? D3D11_BIND_DEPTH_STENCIL : D3D11_BIND_SHADER_RESOURCE;
resource_data.pSysMem = initial_data;
......@@ -28282,10 +28289,11 @@ static void test_format_compatibility(void)
x = j % 4;
y = j / 4;
colour = get_readback_color(&rb, x, y, 0);
expected = test_data[i].success && x >= texel_dwords && y
? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
i, colour, x, y, expected);
expected = test_data[i].success && !test_data[i].src_ds && !test_data[i].dst_ds
&& x >= texel_dwords && y ? bitmap_data[j - (4 + texel_dwords)] : initial_data[j];
todo_wine_if((test_data[i].src_ds || test_data[i].dst_ds) && colour)
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
i, colour, x, y, expected);
}
release_resource_readback(&rb);
......@@ -28298,8 +28306,9 @@ static void test_format_compatibility(void)
y = j / 4;
colour = get_readback_color(&rb, x, y, 0);
expected = test_data[i].success ? bitmap_data[j] : initial_data[j];
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
i, colour, x, y, expected);
todo_wine_if(test_data[i].src_ds || test_data[i].dst_ds)
ok(colour == expected, "Test %u: Got unexpected colour 0x%08x at (%u, %u), expected 0x%08x.\n",
i, colour, x, y, expected);
}
release_resource_readback(&rb);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment