2022-01-26 17:40:27 -08:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Zebediah Figura for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2022-01-26 17:40:33 -08:00
|
|
|
#include <stdint.h>
|
2022-01-26 17:40:27 -08:00
|
|
|
#include "vkd3d_windows.h"
|
|
|
|
#include "vkd3d_d3dcommon.h"
|
2022-01-26 17:40:28 -08:00
|
|
|
#include "vkd3d_d3d12.h"
|
|
|
|
#include "vkd3d_dxgiformat.h"
|
2022-03-12 13:02:15 -08:00
|
|
|
#include "vkd3d_common.h"
|
2022-01-26 17:40:28 -08:00
|
|
|
#include "utils.h"
|
2022-01-26 17:40:27 -08:00
|
|
|
|
|
|
|
enum shader_model
|
|
|
|
{
|
2022-03-07 17:55:44 -08:00
|
|
|
SHADER_MODEL_2_0,
|
|
|
|
SHADER_MODEL_4_0,
|
2022-01-26 17:40:27 -08:00
|
|
|
SHADER_MODEL_4_1,
|
|
|
|
SHADER_MODEL_5_0,
|
|
|
|
SHADER_MODEL_5_1,
|
|
|
|
};
|
|
|
|
|
2022-01-26 17:40:28 -08:00
|
|
|
enum texture_data_type
|
|
|
|
{
|
|
|
|
TEXTURE_DATA_FLOAT,
|
|
|
|
TEXTURE_DATA_SINT,
|
|
|
|
TEXTURE_DATA_UINT,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sampler
|
|
|
|
{
|
|
|
|
unsigned int slot;
|
|
|
|
|
|
|
|
D3D12_FILTER filter;
|
|
|
|
D3D12_TEXTURE_ADDRESS_MODE u_address, v_address, w_address;
|
|
|
|
};
|
|
|
|
|
2022-01-26 17:40:29 -08:00
|
|
|
struct texture_params
|
2022-01-26 17:40:28 -08:00
|
|
|
{
|
|
|
|
unsigned int slot;
|
|
|
|
|
|
|
|
DXGI_FORMAT format;
|
|
|
|
enum texture_data_type data_type;
|
|
|
|
unsigned int texel_size;
|
|
|
|
unsigned int width, height;
|
|
|
|
uint8_t *data;
|
|
|
|
size_t data_size, data_capacity;
|
2022-01-26 17:40:29 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct texture
|
|
|
|
{
|
|
|
|
unsigned int slot;
|
2022-01-26 17:40:28 -08:00
|
|
|
};
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
struct shader_runner
|
2022-01-26 17:40:28 -08:00
|
|
|
{
|
|
|
|
const struct shader_runner_ops *ops;
|
|
|
|
|
2022-01-26 17:40:31 -08:00
|
|
|
char *ps_source;
|
2022-01-26 17:40:28 -08:00
|
|
|
enum shader_model minimum_shader_model;
|
|
|
|
|
|
|
|
uint32_t *uniforms;
|
2022-01-26 17:40:32 -08:00
|
|
|
size_t uniform_count, uniform_capacity;
|
2022-01-26 17:40:28 -08:00
|
|
|
|
2022-01-26 17:40:29 -08:00
|
|
|
struct texture **textures;
|
2022-01-26 17:40:28 -08:00
|
|
|
size_t texture_count;
|
|
|
|
|
|
|
|
struct sampler *samplers;
|
|
|
|
size_t sampler_count;
|
|
|
|
};
|
|
|
|
|
2022-01-26 17:40:27 -08:00
|
|
|
struct shader_runner_ops
|
|
|
|
{
|
2022-03-19 10:35:31 -07:00
|
|
|
struct texture *(*create_texture)(struct shader_runner *runner, const struct texture_params *params);
|
|
|
|
void (*destroy_texture)(struct shader_runner *runner, struct texture *texture);
|
|
|
|
void (*draw_quad)(struct shader_runner *runner);
|
|
|
|
void (*probe_vec4)(struct shader_runner *runner, const RECT *rect, const struct vec4 *v, unsigned int ulps);
|
2022-01-26 17:40:27 -08:00
|
|
|
};
|
|
|
|
|
2022-03-12 13:02:15 -08:00
|
|
|
void fatal_error(const char *format, ...) VKD3D_NORETURN VKD3D_PRINTF_FUNC(1, 2);
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
void run_shader_tests(struct shader_runner *runner, int argc, char **argv, const struct shader_runner_ops *ops);
|
2022-01-26 17:40:27 -08:00
|
|
|
|
2022-01-26 17:40:33 -08:00
|
|
|
#ifdef _WIN32
|
|
|
|
void run_shader_tests_d3d11(int argc, char **argv);
|
|
|
|
#endif
|
2022-01-26 17:40:27 -08:00
|
|
|
void run_shader_tests_d3d12(int argc, char **argv);
|