d3d10core/tests: Add test for invalid RTV descriptions.

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 2016-06-17 10:41:44 +02:00 committed by Alexandre Julliard
parent 09dbd7bef8
commit 8929be2c23
1 changed files with 147 additions and 16 deletions

View File

@ -236,7 +236,17 @@ static void get_rtv_desc(D3D10_RENDER_TARGET_VIEW_DESC *d3d10_desc, const struct
{ {
d3d10_desc->Format = desc->format; d3d10_desc->Format = desc->format;
d3d10_desc->ViewDimension = desc->dimension; d3d10_desc->ViewDimension = desc->dimension;
if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE2D) if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE1D)
{
U(*d3d10_desc).Texture1D.MipSlice = desc->miplevel_idx;
}
else if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE1DARRAY)
{
U(*d3d10_desc).Texture1DArray.MipSlice = desc->miplevel_idx;
U(*d3d10_desc).Texture1DArray.FirstArraySlice = desc->layer_idx;
U(*d3d10_desc).Texture1DArray.ArraySize = desc->layer_count;
}
else if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE2D)
{ {
U(*d3d10_desc).Texture2D.MipSlice = desc->miplevel_idx; U(*d3d10_desc).Texture2D.MipSlice = desc->miplevel_idx;
} }
@ -246,13 +256,19 @@ static void get_rtv_desc(D3D10_RENDER_TARGET_VIEW_DESC *d3d10_desc, const struct
U(*d3d10_desc).Texture2DArray.FirstArraySlice = desc->layer_idx; U(*d3d10_desc).Texture2DArray.FirstArraySlice = desc->layer_idx;
U(*d3d10_desc).Texture2DArray.ArraySize = desc->layer_count; U(*d3d10_desc).Texture2DArray.ArraySize = desc->layer_count;
} }
else if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
U(*d3d10_desc).Texture2DMSArray.FirstArraySlice = desc->layer_idx;
U(*d3d10_desc).Texture2DMSArray.ArraySize = desc->layer_count;
}
else if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE3D) else if (desc->dimension == D3D10_RTV_DIMENSION_TEXTURE3D)
{ {
U(*d3d10_desc).Texture3D.MipSlice = desc->miplevel_idx; U(*d3d10_desc).Texture3D.MipSlice = desc->miplevel_idx;
U(*d3d10_desc).Texture3D.FirstWSlice = desc->layer_idx; U(*d3d10_desc).Texture3D.FirstWSlice = desc->layer_idx;
U(*d3d10_desc).Texture3D.WSize = desc->layer_count; U(*d3d10_desc).Texture3D.WSize = desc->layer_count;
} }
else else if (desc->dimension != D3D10_RTV_DIMENSION_UNKNOWN
&& desc->dimension != D3D10_RTV_DIMENSION_TEXTURE2DMS)
{ {
trace("Unhandled view dimension %#x.\n", desc->dimension); trace("Unhandled view dimension %#x.\n", desc->dimension);
} }
@ -288,6 +304,15 @@ static void check_rtv_desc_(unsigned int line, const D3D10_RENDER_TARGET_VIEW_DE
"Got ArraySize %u, expected %u.\n", "Got ArraySize %u, expected %u.\n",
U(*desc).Texture2DArray.ArraySize, expected_desc->layer_count); U(*desc).Texture2DArray.ArraySize, expected_desc->layer_count);
} }
else if (desc->ViewDimension == D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
ok_(__FILE__, line)(U(*desc).Texture2DMSArray.FirstArraySlice == expected_desc->layer_idx,
"Got FirstArraySlice %u, expected %u.\n",
U(*desc).Texture2DMSArray.FirstArraySlice, expected_desc->layer_idx);
ok_(__FILE__, line)(U(*desc).Texture2DMSArray.ArraySize == expected_desc->layer_count,
"Got ArraySize %u, expected %u.\n",
U(*desc).Texture2DMSArray.ArraySize, expected_desc->layer_count);
}
else if (desc->ViewDimension == D3D10_RTV_DIMENSION_TEXTURE3D) else if (desc->ViewDimension == D3D10_RTV_DIMENSION_TEXTURE3D)
{ {
ok_(__FILE__, line)(U(*desc).Texture3D.MipSlice == expected_desc->miplevel_idx, ok_(__FILE__, line)(U(*desc).Texture3D.MipSlice == expected_desc->miplevel_idx,
@ -300,7 +325,7 @@ static void check_rtv_desc_(unsigned int line, const D3D10_RENDER_TARGET_VIEW_DE
"Got WSize %u, expected %u.\n", "Got WSize %u, expected %u.\n",
U(*desc).Texture3D.WSize, expected_desc->layer_count); U(*desc).Texture3D.WSize, expected_desc->layer_count);
} }
else else if (desc->ViewDimension != D3D10_RTV_DIMENSION_TEXTURE2DMS)
{ {
trace("Unhandled view dimension %#x.\n", desc->ViewDimension); trace("Unhandled view dimension %#x.\n", desc->ViewDimension);
} }
@ -1736,11 +1761,23 @@ static void test_create_rendertarget_view(void)
ID3D10Device *device, *tmp; ID3D10Device *device, *tmp;
ID3D10Texture3D *texture3d; ID3D10Texture3D *texture3d;
ID3D10Texture2D *texture2d; ID3D10Texture2D *texture2d;
ID3D10Resource *texture;
ID3D10Buffer *buffer; ID3D10Buffer *buffer;
IUnknown *iface; IUnknown *iface;
unsigned int i; unsigned int i;
HRESULT hr; HRESULT hr;
#define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN
#define RGBA8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM
#define RGBA8_TL DXGI_FORMAT_R8G8B8A8_TYPELESS
#define DIM_UNKNOWN D3D10_RTV_DIMENSION_UNKNOWN
#define TEX_1D D3D10_RTV_DIMENSION_TEXTURE1D
#define TEX_1D_ARRAY D3D10_RTV_DIMENSION_TEXTURE1DARRAY
#define TEX_2D D3D10_RTV_DIMENSION_TEXTURE2D
#define TEX_2D_ARRAY D3D10_RTV_DIMENSION_TEXTURE2DARRAY
#define TEX_2DMS D3D10_RTV_DIMENSION_TEXTURE2DMS
#define TEX_2DMS_ARR D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY
#define TEX_3D D3D10_RTV_DIMENSION_TEXTURE3D
static const struct static const struct
{ {
struct struct
@ -1754,16 +1791,13 @@ static void test_create_rendertarget_view(void)
} }
tests[] = tests[] =
{ {
#define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN
#define RGBA8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM
#define TEX_2D D3D10_RTV_DIMENSION_TEXTURE2D
#define TEX_2D_ARRAY D3D10_RTV_DIMENSION_TEXTURE2DARRAY
#define TEX_3D D3D10_RTV_DIMENSION_TEXTURE3D
{{ 1, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}}, {{ 1, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}}, {{10, 1, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 0}, {RGBA8_UNORM, TEX_2D, 0}}, {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 0}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 1}, {RGBA8_UNORM, TEX_2D, 1}}, {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 1}, {RGBA8_UNORM, TEX_2D, 1}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 9}, {RGBA8_UNORM, TEX_2D, 9}}, {{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D, 9}, {RGBA8_UNORM, TEX_2D, 9}},
{{ 1, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_2D, 0, -1}, {RGBA8_UNORM, TEX_2D, 0}},
{{10, 1, RGBA8_TL}, {RGBA8_UNORM, TEX_2D, 0, -1}, {RGBA8_UNORM, TEX_2D, 0}},
{{ 1, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, {{ 1, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}},
{{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, {{10, 4, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 0, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}}, {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 0, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 4}},
@ -1774,6 +1808,16 @@ static void test_create_rendertarget_view(void)
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 1, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 1, 3}}, {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 1, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 1, 3}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 2, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 2, 2}}, {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 2, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 2, 2}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 3, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 3, 1}}, {{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 3, -1}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 3, 1}},
{{ 1, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS}, {RGBA8_UNORM, TEX_2DMS}},
{{ 1, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS}, {RGBA8_UNORM, TEX_2DMS}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS}, {RGBA8_UNORM, TEX_2DMS}},
{{ 1, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, 1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 1}},
{{ 1, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, -1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 1}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, 1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 1}},
{{10, 1, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, -1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 1}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, 1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 1}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, 4}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 4}},
{{10, 4, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_2DMS_ARR, 0, 0, -1}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 4}},
{{ 1, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}}, {{ 1, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}},
{{ 2, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}}, {{ 2, 6, RGBA8_UNORM}, {0}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}},
{{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, 0, -1}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}}, {{ 2, 6, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 0, 0, -1}, {RGBA8_UNORM, TEX_3D, 0, 0, 6}},
@ -1791,16 +1835,71 @@ static void test_create_rendertarget_view(void)
{{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 3, 0, -1}, {RGBA8_UNORM, TEX_3D, 3, 0, 1}}, {{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 3, 0, -1}, {RGBA8_UNORM, TEX_3D, 3, 0, 1}},
{{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 4, 0, -1}, {RGBA8_UNORM, TEX_3D, 4, 0, 1}}, {{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 4, 0, -1}, {RGBA8_UNORM, TEX_3D, 4, 0, 1}},
{{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 5, 0, -1}, {RGBA8_UNORM, TEX_3D, 5, 0, 1}}, {{ 6, 8, RGBA8_UNORM}, {FMT_UNKNOWN, TEX_3D, 5, 0, -1}, {RGBA8_UNORM, TEX_3D, 5, 0, 1}},
};
static const struct
{
struct
{
D3D10_RTV_DIMENSION dimension;
unsigned int miplevel_count;
unsigned int depth_or_array_size;
DXGI_FORMAT format;
} texture;
struct rtv_desc rtv_desc;
}
invalid_desc_tests[] =
{
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, DIM_UNKNOWN}},
{{TEX_2D, 6, 4, RGBA8_UNORM}, {RGBA8_UNORM, DIM_UNKNOWN}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, -1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_TL, TEX_2D, 0}},
{{TEX_2D, 1, 1, RGBA8_TL}, {FMT_UNKNOWN, TEX_2D, 0}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 0}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 1, 0, 1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 2}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 1, 1}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 0, 2}},
{{TEX_2D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2DMS_ARR, 0, 1, 1}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 1}},
{{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D, 0}},
{{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_1D_ARRAY, 0, 0, 1}},
{{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D, 0}},
{{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_UNORM, TEX_2D_ARRAY, 0, 0, 1}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 0}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 0, 1}},
{{TEX_3D, 1, 1, RGBA8_UNORM}, {RGBA8_TL, TEX_3D, 0, 0, 1}},
{{TEX_3D, 1, 9, RGBA8_UNORM}, {RGBA8_TL, TEX_3D, 0, 0, 1}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 0, 9}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 3, 0, 2}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 2, 0, 4}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 0, 8}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 0, 8, -1}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 1, 4, -1}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 2, 2, -1}},
{{TEX_3D, 4, 8, RGBA8_UNORM}, {RGBA8_UNORM, TEX_3D, 3, 1, -1}},
};
#undef FMT_UNKNOWN #undef FMT_UNKNOWN
#undef RGBA8_UNORM #undef RGBA8_UNORM
#undef RGBA8_TL
#undef DIM_UNKNOWN
#undef TEX_1D
#undef TEX_1D_ARRAY
#undef TEX_2D #undef TEX_2D
#undef TEX_2D_ARRAY #undef TEX_2D_ARRAY
#undef TEX_2DMS
#undef TEX_2DMS_ARR
#undef TEX_3D #undef TEX_3D
};
if (!(device = create_device())) if (!(device = create_device()))
{ {
skip("Failed to create device, skipping tests.\n"); skip("Failed to create device.\n");
return; return;
} }
@ -1815,7 +1914,7 @@ static void test_create_rendertarget_view(void)
expected_refcount = get_refcount((IUnknown *)device) + 1; expected_refcount = get_refcount((IUnknown *)device) + 1;
hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer); hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer);
ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x\n", hr); ok(SUCCEEDED(hr), "Failed to create a buffer, hr %#x.\n", hr);
refcount = get_refcount((IUnknown *)device); refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount); ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
tmp = NULL; tmp = NULL;
@ -1833,7 +1932,7 @@ static void test_create_rendertarget_view(void)
expected_refcount = get_refcount((IUnknown *)device) + 1; expected_refcount = get_refcount((IUnknown *)device) + 1;
hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)buffer, &rtv_desc, &rtview); hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)buffer, &rtv_desc, &rtview);
ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x\n", hr); ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr);
refcount = get_refcount((IUnknown *)device); refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount); ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
tmp = NULL; tmp = NULL;
@ -1871,7 +1970,6 @@ static void test_create_rendertarget_view(void)
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
{ {
D3D10_RENDER_TARGET_VIEW_DESC *current_desc; D3D10_RENDER_TARGET_VIEW_DESC *current_desc;
ID3D10Resource *texture;
if (tests[i].expected_rtv_desc.dimension != D3D10_RTV_DIMENSION_TEXTURE3D) if (tests[i].expected_rtv_desc.dimension != D3D10_RTV_DIMENSION_TEXTURE3D)
{ {
@ -1920,6 +2018,39 @@ static void test_create_rendertarget_view(void)
ID3D10Resource_Release(texture); ID3D10Resource_Release(texture);
} }
for (i = 0; i < sizeof(invalid_desc_tests) / sizeof(*invalid_desc_tests); ++i)
{
assert(invalid_desc_tests[i].texture.dimension == D3D10_RTV_DIMENSION_TEXTURE2D
|| invalid_desc_tests[i].texture.dimension == D3D10_RTV_DIMENSION_TEXTURE3D);
if (invalid_desc_tests[i].texture.dimension != D3D10_RTV_DIMENSION_TEXTURE3D)
{
texture2d_desc.MipLevels = invalid_desc_tests[i].texture.miplevel_count;
texture2d_desc.ArraySize = invalid_desc_tests[i].texture.depth_or_array_size;
texture2d_desc.Format = invalid_desc_tests[i].texture.format;
hr = ID3D10Device_CreateTexture2D(device, &texture2d_desc, NULL, &texture2d);
ok(SUCCEEDED(hr), "Test %u: Failed to create 2d texture, hr %#x.\n", i, hr);
texture = (ID3D10Resource *)texture2d;
}
else
{
texture3d_desc.MipLevels = invalid_desc_tests[i].texture.miplevel_count;
texture3d_desc.Depth = invalid_desc_tests[i].texture.depth_or_array_size;
texture3d_desc.Format = invalid_desc_tests[i].texture.format;
hr = ID3D10Device_CreateTexture3D(device, &texture3d_desc, NULL, &texture3d);
ok(SUCCEEDED(hr), "Test %u: Failed to create 3d texture, hr %#x.\n", i, hr);
texture = (ID3D10Resource *)texture3d;
}
get_rtv_desc(&rtv_desc, &invalid_desc_tests[i].rtv_desc);
hr = ID3D10Device_CreateRenderTargetView(device, texture, &rtv_desc, &rtview);
ok(hr == E_INVALIDARG, "Test %u: Got unexpected hr %#x.\n", i, hr);
ID3D10Resource_Release(texture);
}
refcount = ID3D10Device_Release(device); refcount = ID3D10Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
} }