From: Henri Verbeet hverbeet@codeweavers.com
--- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 71 ++++++++++----------------- 1 file changed, 27 insertions(+), 44 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index 2f7b90b2346..357f215b5d0 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -703,24 +703,19 @@ static void test_trig(void) device = test_context.device;
ps_code = compile_shader(ps_source, "ps_2_0", 0); - if (ps_code) + draw_quad(device, ps_code); + init_readback(device, &rb); + for (i = 0; i < 32; ++i) { - draw_quad(device, ps_code); - init_readback(device, &rb); - - for (i = 0; i < 32; ++i) - { - float expect_x = (sinf(i * 2 * M_PI / 32) + 1.0f) / 2.0f; - float expect_y = (cosf(i * 2 * M_PI / 32) + 1.0f) / 2.0f; - v = get_readback_vec4(&rb, i * 640 / 32, 0); - ok(compare_vec4(v, expect_x, expect_y, 0.0f, 0.0f, 4096), - "Test %u: Got {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", - i, v->x, v->y, v->z, v->w, expect_x, expect_y, 0.0f, 0.0f); - } - - release_readback(&rb); - ID3D10Blob_Release(ps_code); + float expect_x = (sinf(i * 2 * M_PI / 32) + 1.0f) / 2.0f; + float expect_y = (cosf(i * 2 * M_PI / 32) + 1.0f) / 2.0f; + v = get_readback_vec4(&rb, i * 640 / 32, 0); + ok(compare_vec4(v, expect_x, expect_y, 0.0f, 0.0f, 4096), + "Test %u: Got {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + i, v->x, v->y, v->z, v->w, expect_x, expect_y, 0.0f, 0.0f); } + release_readback(&rb); + ID3D10Blob_Release(ps_code); release_test_context(&test_context); }
@@ -1086,21 +1081,18 @@ static void test_global_initializer(void) return;
ps_code = compile_shader(ps_source, "ps_2_0", 0); - if (ps_code) - { - hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants); - ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID3DXConstantTable_SetDefaults(constants, test_context.device); - ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); - ID3DXConstantTable_Release(constants); - draw_quad(test_context.device, ps_code); + hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DXConstantTable_SetDefaults(constants, test_context.device); + ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr); + ID3DXConstantTable_Release(constants); + draw_quad(test_context.device, ps_code);
- v = get_color_vec4(test_context.device, 0, 0); - ok(compare_vec4(&v, 0.8f, 0.2f, 0.0f, 0.0f, 4096), - "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w); + v = get_color_vec4(test_context.device, 0, 0); + ok(compare_vec4(&v, 0.8f, 0.2f, 0.0f, 0.0f, 4096), + "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
- ID3D10Blob_Release(ps_code); - } + ID3D10Blob_Release(ps_code); release_test_context(&test_context); }
@@ -1739,11 +1731,8 @@ static void test_include(void) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(!!blob, "Got unexpected blob.\n"); ok(!errors, "Got unexpected errors.\n"); - if (blob) - { - ID3D10Blob_Release(blob); - blob = NULL; - } + ID3D10Blob_Release(blob); + blob = NULL;
/* Windows always seems to resolve includes from the initial file location * instead of using the immediate parent, as it would be the case for @@ -1752,11 +1741,8 @@ static void test_include(void) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(!!blob, "Got unexpected blob.\n"); ok(!errors, "Got unexpected errors.\n"); - if (blob) - { - ID3D10Blob_Release(blob); - blob = NULL; - } + ID3D10Blob_Release(blob); + blob = NULL;
sprintf(ps_absolute_buffer, ps_absolute_template, include_filename); hr = D3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL, @@ -1797,11 +1783,8 @@ static void test_include(void) ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(!!blob, "Got unexpected blob.\n"); ok(!errors, "Got unexpected errors.\n"); - if (blob) - { - ID3D10Blob_Release(blob); - blob = NULL; - } + ID3D10Blob_Release(blob); + blob = NULL;
SetCurrentDirectoryW(directory); #endif /* D3D_COMPILER_VERSION >= 46 */