d3d10core/tests: Introduce compare_uint().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e9ff8bc75
commit
689e00c785
|
@ -204,6 +204,13 @@ static BOOL compare_vec4(const struct vec4 *v1, const struct vec4 *v2, unsigned
|
||||||
&& compare_float(v1->w, v2->w, ulps);
|
&& 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)
|
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;
|
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)
|
static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff)
|
||||||
{
|
{
|
||||||
if (abs((int)(c1 & 0xff) - (int)(c2 & 0xff)) > max_diff)
|
return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
|
||||||
return FALSE;
|
&& compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
|
||||||
c1 >>= 8; c2 >>= 8;
|
&& compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
|
||||||
if (abs((int)(c1 & 0xff) - (int)(c2 & 0xff)) > max_diff)
|
&& compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct srv_desc
|
struct srv_desc
|
||||||
|
|
Loading…
Reference in New Issue