tests/hlsl: Add float64 wave op tests.

This commit is contained in:
Conor McCarthy
2024-12-03 11:56:01 +10:00
committed by Henri Verbeet
parent 9d4bcc951d
commit f0f8bb3f36
Notes: Henri Verbeet 2024-12-09 16:17:26 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/820
4 changed files with 289 additions and 0 deletions

View File

@@ -222,6 +222,12 @@ static inline bool compare_vec4(const struct vec4 *v1, const struct vec4 *v2, un
return compare_vec(v1, v2, ulps, 4);
}
static inline bool compare_dvec2(const struct dvec2 *v1, const struct dvec2 *v2, unsigned int ulps)
{
return compare_double(v1->x, v2->x, ulps)
&& compare_double(v1->y, v2->y, ulps);
}
static inline void set_rect(RECT *rect, int left, int top, int right, int bottom)
{
rect->left = left;
@@ -262,6 +268,11 @@ static const struct vec4 *get_readback_vec4(const struct resource_readback *rb,
return get_readback_data(rb, x, y, 0, sizeof(struct vec4));
}
static const struct dvec2 *get_readback_dvec2(const struct resource_readback *rb, unsigned int x, unsigned int y)
{
return get_readback_data(rb, x, y, 0, sizeof(struct dvec2));
}
static const struct uvec4 *get_readback_uvec4(const struct resource_readback *rb, unsigned int x, unsigned int y)
{
return get_readback_data(rb, x, y, 0, sizeof(struct uvec4));
@@ -419,6 +430,36 @@ static inline void check_readback_data_vec_(const char *file, unsigned int line,
got.x, got.y, got.z, got.w, expected->x, expected->y, expected->z, expected->w, x, y);
}
#define check_readback_data_dvec2(a, b, c, d) check_readback_data_dvec2_(__FILE__, __LINE__, a, b, c, d)
static inline void check_readback_data_dvec2_(const char *file, unsigned int line, const struct resource_readback *rb,
const RECT *rect, const struct dvec2 *expected, unsigned int max_diff)
{
RECT r = {0, 0, rb->width, rb->height};
unsigned int x = 0, y = 0;
struct dvec2 got = {0};
bool all_match = true;
if (rect)
r = *rect;
for (y = r.top; y < r.bottom; ++y)
{
for (x = r.left; x < r.right; ++x)
{
got = *get_readback_dvec2(rb, x, y);
if (!compare_dvec2(&got, expected, max_diff))
{
all_match = false;
break;
}
}
if (!all_match)
break;
}
ok_(file, line)(all_match, "Got {%.15e, %.15e}, expected {%.15e, %.15e} at (%u, %u).\n",
got.x, got.y, expected->x, expected->y, x, y);
}
#define check_readback_data_ivec4(a, b, c) \
check_readback_data_uvec4_(__FILE__, __LINE__, a, b, (const struct uvec4 *)(c))
#define check_readback_data_uvec4(a, b, c) check_readback_data_uvec4_(__FILE__, __LINE__, a, b, c)