mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -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:
parent
ecbdd8f994
commit
22e6581ffc
@ -395,6 +395,7 @@ EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def)
|
|||||||
|
|
||||||
shader_runner_cross_sources = \
|
shader_runner_cross_sources = \
|
||||||
$(srcdir)/tests/shader_runner.c \
|
$(srcdir)/tests/shader_runner.c \
|
||||||
|
$(srcdir)/tests/shader_runner_d3d11.c \
|
||||||
$(srcdir)/tests/shader_runner_d3d12.c
|
$(srcdir)/tests/shader_runner_d3d12.c
|
||||||
|
|
||||||
if HAVE_CROSSTARGET32
|
if HAVE_CROSSTARGET32
|
||||||
|
@ -26,11 +26,6 @@
|
|||||||
static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;
|
static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;
|
||||||
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSignature;
|
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSignature;
|
||||||
|
|
||||||
struct vec2
|
|
||||||
{
|
|
||||||
float x, y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct uvec4
|
struct uvec4
|
||||||
{
|
{
|
||||||
unsigned int x, y, z, w;
|
unsigned int x, y, z, w;
|
||||||
|
@ -82,31 +82,6 @@ static void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
|
|||||||
vp->MaxDepth = max_depth;
|
vp->MaxDepth = max_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 bool compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
|
static bool compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
|
||||||
{
|
{
|
||||||
unsigned int diff = x > y ? x - y : y - x;
|
unsigned int diff = x > y ? x - y : y - x;
|
||||||
@ -122,14 +97,6 @@ static bool compare_color(DWORD c1, DWORD c2, BYTE max_diff)
|
|||||||
&& compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
|
&& compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
|
static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
|
||||||
{
|
{
|
||||||
D3D12_SHADER_BYTECODE shader_bytecode = { code, size };
|
D3D12_SHADER_BYTECODE shader_bytecode = { code, size };
|
||||||
|
@ -278,7 +278,7 @@ static void parse_texture_directive(struct texture_params *texture, const char *
|
|||||||
|
|
||||||
static void set_uniforms(struct shader_context *context, size_t offset, size_t count, const void *uniforms)
|
static void set_uniforms(struct shader_context *context, size_t offset, size_t count, const void *uniforms)
|
||||||
{
|
{
|
||||||
context->uniform_count = max(context->uniform_count, offset + count);
|
context->uniform_count = align(max(context->uniform_count, offset + count), 4);
|
||||||
vkd3d_array_reserve((void **)&context->uniforms, &context->uniform_capacity,
|
vkd3d_array_reserve((void **)&context->uniforms, &context->uniform_capacity,
|
||||||
context->uniform_count, sizeof(*context->uniforms));
|
context->uniform_count, sizeof(*context->uniforms));
|
||||||
memcpy(context->uniforms + offset, uniforms, count * sizeof(*context->uniforms));
|
memcpy(context->uniforms + offset, uniforms, count * sizeof(*context->uniforms));
|
||||||
@ -680,9 +680,14 @@ void run_shader_tests(struct shader_context *context, int argc, char **argv, con
|
|||||||
free(context->textures);
|
free(context->textures);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
vkd3d_test_set_context(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(shader_runner)
|
START_TEST(shader_runner)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
run_shader_tests_d3d11(argc, argv);
|
||||||
|
#endif
|
||||||
run_shader_tests_d3d12(argc, argv);
|
run_shader_tests_d3d12(argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include "vkd3d_windows.h"
|
#include "vkd3d_windows.h"
|
||||||
#include "vkd3d_d3dcommon.h"
|
#include "vkd3d_d3dcommon.h"
|
||||||
#include "vkd3d_d3d12.h"
|
#include "vkd3d_d3d12.h"
|
||||||
@ -89,4 +90,7 @@ struct shader_runner_ops
|
|||||||
|
|
||||||
void run_shader_tests(struct shader_context *context, int argc, char **argv, const struct shader_runner_ops *ops);
|
void run_shader_tests(struct shader_context *context, int argc, char **argv, const struct shader_runner_ops *ops);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
void run_shader_tests_d3d11(int argc, char **argv);
|
||||||
|
#endif
|
||||||
void run_shader_tests_d3d12(int argc, char **argv);
|
void run_shader_tests_d3d12(int argc, char **argv);
|
||||||
|
639
tests/shader_runner_d3d11.c
Normal file
639
tests/shader_runner_d3d11.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -19,9 +19,15 @@
|
|||||||
#ifndef __VKD3D_TEST_UTILS_H
|
#ifndef __VKD3D_TEST_UTILS_H
|
||||||
#define __VKD3D_TEST_UTILS_H
|
#define __VKD3D_TEST_UTILS_H
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct vec2
|
||||||
|
{
|
||||||
|
float x, y;
|
||||||
|
};
|
||||||
|
|
||||||
struct vec4
|
struct vec4
|
||||||
{
|
{
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
@ -55,4 +61,37 @@ static inline bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t
|
|||||||
return true;
|
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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user