d3d10core/tests: Fix test failures in test_render_target_views().

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-11-08 12:11:49 +01:00 committed by Alexandre Julliard
parent db4e9f7e17
commit 9bb2c987fb
1 changed files with 17 additions and 1 deletions

View File

@ -2407,7 +2407,8 @@ static void test_render_target_views(void)
ID3D10RenderTargetView *rtv;
ID3D10Texture2D *texture;
ID3D10Device *device;
unsigned int i, j;
unsigned int i, j, k;
void *data;
HRESULT hr;
if (!init_test_context(&test_context))
@ -2425,6 +2426,9 @@ static void test_render_target_views(void)
texture_desc.CPUAccessFlags = 0;
texture_desc.MiscFlags = 0;
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, texture_desc.Width * texture_desc.Height * 4);
ok(!!data, "Failed to allocate memory.\n");
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
{
const struct test *test = &tests[i];
@ -2440,6 +2444,17 @@ static void test_render_target_views(void)
hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)texture, &rtv_desc, &rtv);
ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr);
for (j = 0; j < texture_desc.ArraySize; ++j)
{
for (k = 0; k < texture_desc.MipLevels; ++k)
{
unsigned int sub_resource_idx = j * texture_desc.MipLevels + k;
ID3D10Device_UpdateSubresource(device,
(ID3D10Resource *)texture, sub_resource_idx, NULL, data, texture_desc.Width * 4, 0);
}
}
check_texture_color(texture, 0, 0);
ID3D10Device_OMSetRenderTargets(device, 1, &rtv, NULL);
draw_color_quad(&test_context, &red);
@ -2452,6 +2467,7 @@ static void test_render_target_views(void)
ID3D10Texture2D_Release(texture);
}
HeapFree(GetProcessHeap(), 0, data);
release_test_context(&test_context);
}