mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests: Add a D3D11 shader runner backend.
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
ecbdd8f994
commit
22e6581ffc
@@ -19,9 +19,15 @@
|
||||
#ifndef __VKD3D_TEST_UTILS_H
|
||||
#define __VKD3D_TEST_UTILS_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct vec2
|
||||
{
|
||||
float x, y;
|
||||
};
|
||||
|
||||
struct vec4
|
||||
{
|
||||
float x, y, z, w;
|
||||
@@ -55,4 +61,37 @@ static inline bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool compare_float(float f, float g, unsigned int ulps)
|
||||
{
|
||||
int x, y;
|
||||
union
|
||||
{
|
||||
float f;
|
||||
int i;
|
||||
} u;
|
||||
|
||||
u.f = f;
|
||||
x = u.i;
|
||||
u.f = g;
|
||||
y = u.i;
|
||||
|
||||
if (x < 0)
|
||||
x = INT_MIN - x;
|
||||
if (y < 0)
|
||||
y = INT_MIN - y;
|
||||
|
||||
if (abs(x - y) > ulps)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool compare_vec4(const struct vec4 *v1, const struct vec4 *v2, unsigned int ulps)
|
||||
{
|
||||
return compare_float(v1->x, v2->x, ulps)
|
||||
&& compare_float(v1->y, v2->y, ulps)
|
||||
&& compare_float(v1->z, v2->z, ulps)
|
||||
&& compare_float(v1->w, v2->w, ulps);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user