mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
tests: Introduce compare_uint().
Signed-off-by: Chip Davis <cdavis@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e57ad512ff
commit
5ad16f1458
@ -53,20 +53,19 @@ static void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
|
|||||||
vp->MaxDepth = max_depth;
|
vp->MaxDepth = max_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_color(DWORD c1, DWORD c2, BYTE max_diff)
|
static bool compare_color(DWORD c1, DWORD c2, BYTE max_diff)
|
||||||
{
|
{
|
||||||
if (abs((c1 & 0xff) - (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((c1 & 0xff) - (c2 & 0xff)) > max_diff)
|
&& compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
|
static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user