[PATCH 5/9] d3d11/tests: Introduce compare_uint().
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- dlls/d3d11/tests/d3d11.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index dcde0d1c10e..37ec829cd78 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -260,6 +260,13 @@ static BOOL compare_vec4(const struct vec4 *v1, const struct vec4 *v2, unsigned && compare_float(v1->w, v2->w, ulps); } +static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + + return diff <= max_diff; +} + static BOOL compare_uvec4(const struct uvec4* v1, const struct uvec4 *v2) { return v1->x == v2->x && v1->y == v2->y && v1->z == v2->z && v1->w == v2->w; @@ -267,18 +274,10 @@ static BOOL compare_uvec4(const struct uvec4* v1, const struct uvec4 *v2) static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) - return FALSE; - return TRUE; + return compare_uint(c1 & 0xff, c2 & 0xff, max_diff) + && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff) + && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff) + && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff); } struct srv_desc -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=68496 Your paranoid android. === w1064v1809 (32 bit report) === d3d11: d3d11.c:5775: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5776: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5777: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5780: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5781: Test failed: Got unexpected CPrimitives count: 0.
participants (2)
-
Henri Verbeet -
Marvin