[PATCH 3/5] d3d10core/tests: Fix test failures in test_render_target_views().
Józef Kucia
jkucia at codeweavers.com
Tue Nov 8 05:11:49 CST 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
The initial texture data is not necessarily initialized to 0.
---
dlls/d3d10core/tests/device.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 9f98850..e617319 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -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);
}
--
2.7.3
More information about the wine-patches
mailing list