d3d11/tests: Limit the flood of failures in test_depth_bias().

Only report the first failed row for each bias clamp test.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2019-04-25 09:53:36 +02:00 committed by Alexandre Julliard
parent d9150a66b3
commit 4385a3ecb6
1 changed files with 8 additions and 4 deletions

View File

@ -25681,6 +25681,7 @@ static void test_depth_bias(void)
for (k = 0; k < ARRAY_SIZE(bias_clamp_tests); ++k) for (k = 0; k < ARRAY_SIZE(bias_clamp_tests); ++k)
{ {
BOOL all_match = TRUE;
rasterizer_desc.DepthBiasClamp = bias_clamp_tests[k]; rasterizer_desc.DepthBiasClamp = bias_clamp_tests[k];
ID3D11Device_CreateRasterizerState(device, &rasterizer_desc, &rs); ID3D11Device_CreateRasterizerState(device, &rasterizer_desc, &rs);
ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
@ -25691,21 +25692,23 @@ static void test_depth_bias(void)
m = quad_slopes[i] / texture_desc.Height; m = quad_slopes[i] / texture_desc.Height;
bias = clamp_depth_bias(rasterizer_desc.SlopeScaledDepthBias * m, rasterizer_desc.DepthBiasClamp); bias = clamp_depth_bias(rasterizer_desc.SlopeScaledDepthBias * m, rasterizer_desc.DepthBiasClamp);
get_texture_readback(texture, 0, &rb); get_texture_readback(texture, 0, &rb);
for (y = 0; y < texture_desc.Height; ++y) for (y = 0; y < texture_desc.Height && all_match; ++y)
{ {
depth = min(max(0.0f, depth_values[y] + bias), 1.0f); depth = min(max(0.0f, depth_values[y] + bias), 1.0f);
switch (format) switch (format)
{ {
case DXGI_FORMAT_D32_FLOAT: case DXGI_FORMAT_D32_FLOAT:
data = get_readback_float(&rb, 0, y); data = get_readback_float(&rb, 0, y);
ok(compare_float(data, depth, 64), all_match = compare_float(data, depth, 64);
ok(all_match,
"Got depth %.8e, expected %.8e.\n", data, depth); "Got depth %.8e, expected %.8e.\n", data, depth);
break; break;
case DXGI_FORMAT_D24_UNORM_S8_UINT: case DXGI_FORMAT_D24_UNORM_S8_UINT:
u32 = get_readback_data(&rb, 0, y, 0, sizeof(*u32)); u32 = get_readback_data(&rb, 0, y, 0, sizeof(*u32));
u32_value = *u32 >> shift; u32_value = *u32 >> shift;
expected_value = depth * 16777215.0f + 0.5f; expected_value = depth * 16777215.0f + 0.5f;
ok(abs(u32_value - expected_value) <= 3, all_match = abs(u32_value - expected_value) <= 3;
ok(all_match,
"Got value %#x (%.8e), expected %#x (%.8e).\n", "Got value %#x (%.8e), expected %#x (%.8e).\n",
u32_value, u32_value / 16777215.0f, u32_value, u32_value / 16777215.0f,
expected_value, expected_value / 16777215.0f); expected_value, expected_value / 16777215.0f);
@ -25713,7 +25716,8 @@ static void test_depth_bias(void)
case DXGI_FORMAT_D16_UNORM: case DXGI_FORMAT_D16_UNORM:
u16 = get_readback_data(&rb, 0, y, 0, sizeof(*u16)); u16 = get_readback_data(&rb, 0, y, 0, sizeof(*u16));
expected_value = depth * 65535.0f + 0.5f; expected_value = depth * 65535.0f + 0.5f;
ok(abs(*u16 - expected_value) <= 1, all_match = abs(*u16 - expected_value) <= 1;
ok(all_match,
"Got value %#x (%.8e), expected %#x (%.8e).\n", "Got value %#x (%.8e), expected %#x (%.8e).\n",
*u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f); *u16, *u16 / 65535.0f, expected_value, expected_value / 65535.0f);
break; break;