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

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

parent db4e9f7e
......@@ -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);
}
......
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