Skip to content
Snippets Groups Projects
Commit 22e6581f authored by Elizabeth Figura's avatar Elizabeth Figura Committed by Alexandre Julliard
Browse files

tests: Add a D3D11 shader runner backend.

parent ecbdd8f9
No related branches found
No related tags found
No related merge requests found
......@@ -395,6 +395,7 @@ EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def)
shader_runner_cross_sources = \
$(srcdir)/tests/shader_runner.c \
$(srcdir)/tests/shader_runner_d3d11.c \
$(srcdir)/tests/shader_runner_d3d12.c
if HAVE_CROSSTARGET32
......
......@@ -26,11 +26,6 @@
static PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER pfn_D3D12CreateVersionedRootSignatureDeserializer;
static PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSignature;
 
struct vec2
{
float x, y;
};
struct uvec4
{
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;
}
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)
{
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);
}
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)
{
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)
{
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,
context->uniform_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);
fclose(f);
vkd3d_test_set_context(NULL);
}
START_TEST(shader_runner)
{
#ifdef _WIN32
run_shader_tests_d3d11(argc, argv);
#endif
run_shader_tests_d3d12(argc, argv);
}
......@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdint.h>
#include "vkd3d_windows.h"
#include "vkd3d_d3dcommon.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);
#ifdef _WIN32
void run_shader_tests_d3d11(int argc, char **argv);
#endif
void run_shader_tests_d3d12(int argc, char **argv);
This diff is collapsed.
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment