Commit b1ba91b2 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11/tests: Test creating 2D array textures.

parent a0d54ccf
...@@ -818,6 +818,7 @@ static void test_create_texture2d(void) ...@@ -818,6 +818,7 @@ static void test_create_texture2d(void)
{ {
ULONG refcount, expected_refcount; ULONG refcount, expected_refcount;
D3D11_SUBRESOURCE_DATA data = {0}; D3D11_SUBRESOURCE_DATA data = {0};
D3D_FEATURE_LEVEL feature_level;
ID3D11Device *device, *tmp; ID3D11Device *device, *tmp;
D3D11_TEXTURE2D_DESC desc; D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D *texture; ID3D11Texture2D *texture;
...@@ -829,45 +830,73 @@ static void test_create_texture2d(void) ...@@ -829,45 +830,73 @@ static void test_create_texture2d(void)
static const struct static const struct
{ {
DXGI_FORMAT format; DXGI_FORMAT format;
UINT array_size;
D3D11_BIND_FLAG bind_flags; D3D11_BIND_FLAG bind_flags;
UINT misc_flags;
BOOL succeeds; BOOL succeeds;
BOOL todo; BOOL todo;
} }
tests[] = tests[] =
{ {
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_VERTEX_BUFFER, FALSE, TRUE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_INDEX_BUFFER, FALSE, TRUE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_CONSTANT_BUFFER, FALSE, TRUE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_RENDER_TARGET, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, D3D11_BIND_DEPTH_STENCIL, FALSE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R32G32B32_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R16G16B16A16_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R16G16B16A16_TYPELESS, D3D11_BIND_RENDER_TARGET, TRUE, FALSE}, FALSE, TRUE},
{DXGI_FORMAT_R32G32_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R32G8X24_TYPELESS, D3D11_BIND_DEPTH_STENCIL, TRUE, TRUE}, FALSE, TRUE},
{DXGI_FORMAT_R10G10B10A2_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 5, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R10G10B10A2_TYPELESS, D3D11_BIND_RENDER_TARGET, TRUE, FALSE}, FALSE, TRUE},
{DXGI_FORMAT_R32_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 6, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R24G8_TYPELESS, D3D11_BIND_VERTEX_BUFFER, FALSE, TRUE}, TRUE, FALSE},
{DXGI_FORMAT_R24G8_TYPELESS, D3D11_BIND_INDEX_BUFFER, FALSE, TRUE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 7, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R24G8_TYPELESS, D3D11_BIND_CONSTANT_BUFFER, FALSE, TRUE}, TRUE, FALSE},
{DXGI_FORMAT_R24G8_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 10, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R24G8_TYPELESS, D3D11_BIND_DEPTH_STENCIL, TRUE, FALSE}, TRUE, FALSE},
{DXGI_FORMAT_R8G8_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 12, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
{DXGI_FORMAT_R16_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, TRUE, FALSE},
{DXGI_FORMAT_R8_TYPELESS, D3D11_BIND_SHADER_RESOURCE, TRUE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_RENDER_TARGET, 0, FALSE, TRUE},
{DXGI_FORMAT_R8G8B8A8_UNORM, D3D11_BIND_DEPTH_STENCIL, FALSE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
{DXGI_FORMAT_D24_UNORM_S8_UINT, D3D11_BIND_RENDER_TARGET, FALSE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
{DXGI_FORMAT_D32_FLOAT, D3D11_BIND_RENDER_TARGET, FALSE, FALSE}, {DXGI_FORMAT_R32G32B32A32_TYPELESS, 9, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, FALSE, FALSE},
{DXGI_FORMAT_R32G32B32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R16G16B16A16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R16G16B16A16_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
{DXGI_FORMAT_R32G32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R32G8X24_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, TRUE},
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
{DXGI_FORMAT_R32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
{DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
TRUE, FALSE},
{DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
{DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R24G8_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, FALSE},
{DXGI_FORMAT_R8G8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R16_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R8_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, D3D11_BIND_DEPTH_STENCIL, 0, FALSE, FALSE},
{DXGI_FORMAT_D24_UNORM_S8_UINT, 1, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
{DXGI_FORMAT_D32_FLOAT, 1, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
}; };
if (!(device = create_device(NULL))) if (!(device = create_device(NULL)))
{ {
skip("Failed to create device, skipping tests.\n"); skip("Failed to create device.\n");
return; return;
} }
feature_level = ID3D11Device_GetFeatureLevel(device);
desc.Width = 512; desc.Width = 512;
desc.Height = 512; desc.Height = 512;
desc.MipLevels = 1; desc.MipLevels = 1;
...@@ -963,12 +992,25 @@ static void test_create_texture2d(void) ...@@ -963,12 +992,25 @@ static void test_create_texture2d(void)
desc.SampleDesc.Count = 1; desc.SampleDesc.Count = 1;
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
{ {
HRESULT expected_hr = tests[i].succeeds ? S_OK : E_INVALIDARG;
BOOL todo = tests[i].todo;
if (feature_level < D3D_FEATURE_LEVEL_10_1
&& (tests[i].misc_flags & D3D11_RESOURCE_MISC_TEXTURECUBE)
&& tests[i].array_size > 6)
{
expected_hr = E_INVALIDARG;
todo = TRUE;
}
desc.ArraySize = tests[i].array_size;
desc.Format = tests[i].format; desc.Format = tests[i].format;
desc.BindFlags = tests[i].bind_flags; desc.BindFlags = tests[i].bind_flags;
desc.MiscFlags = tests[i].misc_flags;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, (ID3D11Texture2D **)&texture); hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, (ID3D11Texture2D **)&texture);
todo_wine_if(tests[i].todo) todo_wine_if(todo)
ok(hr == (tests[i].succeeds ? S_OK : E_INVALIDARG), "Test %u: Got unexpected hr %#x.\n", i, hr); ok(hr == expected_hr, "Test %u: Got unexpected hr %#x.\n", i, hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
ID3D11Texture2D_Release(texture); ID3D11Texture2D_Release(texture);
......
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