[PATCH 4/9] d3d10core/tests: Introduce compare_uint().
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> --- dlls/d3d10core/tests/d3d10core.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index f29ebf97f2c..8332257d379 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -204,6 +204,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; @@ -211,18 +218,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((int)(c1 & 0xff) - (int)(c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((int)(c1 & 0xff) - (int)(c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((int)(c1 & 0xff) - (int)(c2 & 0xff)) > max_diff) - return FALSE; - c1 >>= 8; c2 >>= 8; - if (abs((int)(c1 & 0xff) - (int)(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=68495 Your paranoid android. === w2008s64 (32 bit report) === d3d10core: d3d10core.c:4765: Test failed: Got unexpected hr 0x1. d3d10core.c:4765: Test failed: Got unexpected hr 0x1. d3d10core.c:4766: Test failed: Got unexpected IAVertices count: 4294967295. d3d10core.c:4767: Test failed: Got unexpected IAPrimitives count: 4294967295. d3d10core.c:4768: Test failed: Got unexpected VSInvocations count: 4294967295. d3d10core.c:4769: Test failed: Got unexpected GSInvocations count: 4294967295. d3d10core.c:4770: Test failed: Got unexpected GSPrimitives count: 4294967295. d3d10core.c:4771: Test failed: Got unexpected CInvocations count: 4294967295. d3d10core.c:4772: Test failed: Got unexpected CPrimitives count: 4294967295. d3d10core.c:4774: Test failed: Got unexpected PSInvocations count: 4294967295. === w2008s64 (64 bit report) === d3d10core: d3d10core.c:4969: Test failed: Got unexpected PrimitivesStorageNeeded: 4292088672. === debiant (32 bit Chinese:China report) === d3d10core: d3d10core.c:12597: Test failed: Got {-1.00003052e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 0.00000000e+000} at (0, 0), sub-resource 0.
participants (2)
-
Henri Verbeet -
Marvin