mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/shader_runner: Allow probing a single component.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
4a9d675c49
commit
6ff6cb4ed2
@@ -120,11 +120,45 @@ static void *get_readback_data(const struct resource_readback *rb,
|
||||
return &((uint8_t *)rb->data)[slice_pitch * z + rb->row_pitch * y + x * element_size];
|
||||
}
|
||||
|
||||
static float get_readback_float(const struct resource_readback *rb, unsigned int x, unsigned int y)
|
||||
{
|
||||
return *(float *)get_readback_data(rb, x, y, 0, sizeof(float));
|
||||
}
|
||||
|
||||
static const struct vec4 *get_readback_vec4(const struct resource_readback *rb, unsigned int x, unsigned int y)
|
||||
{
|
||||
return get_readback_data(rb, x, y, 0, sizeof(struct vec4));
|
||||
}
|
||||
|
||||
#define check_readback_data_float(a, b, c, d) check_readback_data_float_(__LINE__, a, b, c, d)
|
||||
static inline void check_readback_data_float_(unsigned int line, const struct resource_readback *rb,
|
||||
const RECT *rect, float expected, unsigned int max_diff)
|
||||
{
|
||||
RECT r = {0, 0, rb->width, rb->height};
|
||||
unsigned int x = 0, y;
|
||||
bool all_match = true;
|
||||
float got = 0;
|
||||
|
||||
if (rect)
|
||||
r = *rect;
|
||||
|
||||
for (y = r.top; y < r.bottom; ++y)
|
||||
{
|
||||
for (x = r.left; x < r.right; ++x)
|
||||
{
|
||||
got = get_readback_float(rb, x, y);
|
||||
if (!compare_float(got, expected, max_diff))
|
||||
{
|
||||
all_match = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!all_match)
|
||||
break;
|
||||
}
|
||||
ok_(line)(all_match, "Got %.8e, expected %.8e at (%u, %u).\n", got, expected, x, y);
|
||||
}
|
||||
|
||||
#define check_readback_data_vec4(a, b, c, d) check_readback_data_vec4_(__LINE__, a, b, c, d)
|
||||
static inline void check_readback_data_vec4_(unsigned int line, const struct resource_readback *rb,
|
||||
const RECT *rect, const struct vec4 *expected, unsigned int max_diff)
|
||||
|
Reference in New Issue
Block a user