2020-09-30 19:01:18 -07:00
|
|
|
/*
|
2022-01-26 17:40:27 -08:00
|
|
|
* Copyright 2020-2021 Zebediah Figura for CodeWeavers
|
2020-09-30 19:01:18 -07:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This application contains code derived from piglit, the license for which
|
|
|
|
* follows:
|
|
|
|
*
|
|
|
|
* Copyright © 2010 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2022-01-26 17:40:28 -08:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
# define _HRESULT_DEFINED
|
|
|
|
typedef int HRESULT;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define CONST_VTABLE
|
|
|
|
#include "config.h"
|
|
|
|
#include <ctype.h>
|
2020-09-30 19:01:18 -07:00
|
|
|
#include <errno.h>
|
2022-01-26 17:40:28 -08:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
2022-03-21 18:42:16 -07:00
|
|
|
#include <string.h>
|
2022-01-26 17:40:28 -08:00
|
|
|
#include "vkd3d_windows.h"
|
|
|
|
#include "vkd3d_d3dcommon.h"
|
|
|
|
#include "vkd3d_d3dcompiler.h"
|
|
|
|
#include "vkd3d_common.h"
|
|
|
|
#include "vkd3d_test.h"
|
|
|
|
#include "shader_runner.h"
|
2020-09-30 19:01:18 -07:00
|
|
|
|
2022-03-12 13:02:15 -08:00
|
|
|
void fatal_error(const char *format, ...)
|
2021-11-05 11:35:50 -07:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, format);
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
va_end(args);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2020-09-30 19:01:18 -07:00
|
|
|
enum parse_state
|
|
|
|
{
|
|
|
|
STATE_NONE,
|
2022-03-21 18:42:16 -07:00
|
|
|
STATE_INPUT_LAYOUT,
|
2020-11-21 15:23:45 -08:00
|
|
|
STATE_PREPROC,
|
2020-11-23 22:29:57 -08:00
|
|
|
STATE_PREPROC_INVALID,
|
2022-01-26 06:35:33 -08:00
|
|
|
STATE_REQUIRE,
|
2021-11-05 11:35:49 -07:00
|
|
|
STATE_SAMPLER,
|
2020-10-03 14:24:26 -07:00
|
|
|
STATE_SHADER_INVALID_PIXEL,
|
2020-09-30 19:01:18 -07:00
|
|
|
STATE_SHADER_PIXEL,
|
2022-03-21 18:42:14 -07:00
|
|
|
STATE_SHADER_VERTEX,
|
2021-10-03 17:19:08 -07:00
|
|
|
STATE_TEXTURE,
|
2020-09-30 19:01:18 -07:00
|
|
|
STATE_TEST,
|
2022-03-21 18:42:18 -07:00
|
|
|
STATE_VERTEX_BUFFER,
|
2020-09-30 19:01:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static bool match_string(const char *line, const char *token, const char **const rest)
|
|
|
|
{
|
|
|
|
size_t len = strlen(token);
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
while (isspace(*line))
|
|
|
|
++line;
|
|
|
|
|
2020-09-30 19:01:18 -07:00
|
|
|
if (strncmp(line, token, len) || !isspace(line[len]))
|
|
|
|
return false;
|
|
|
|
if (rest)
|
|
|
|
{
|
|
|
|
*rest = line + len;
|
|
|
|
while (isspace(**rest))
|
|
|
|
++*rest;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
static void parse_require_directive(struct shader_runner *runner, const char *line)
|
2022-01-26 06:35:33 -08:00
|
|
|
{
|
|
|
|
if (match_string(line, "shader model >=", &line))
|
|
|
|
{
|
|
|
|
static const char *const model_strings[] =
|
|
|
|
{
|
2022-03-07 17:55:44 -08:00
|
|
|
[SHADER_MODEL_2_0] = "2.0",
|
2022-01-26 06:35:33 -08:00
|
|
|
[SHADER_MODEL_4_0] = "4.0",
|
|
|
|
[SHADER_MODEL_4_1] = "4.1",
|
|
|
|
[SHADER_MODEL_5_0] = "5.0",
|
|
|
|
[SHADER_MODEL_5_1] = "5.1",
|
|
|
|
};
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(model_strings); ++i)
|
|
|
|
{
|
|
|
|
if (match_string(line, model_strings[i], &line))
|
|
|
|
{
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->minimum_shader_model = i;
|
2022-01-26 06:35:33 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fatal_error("Unknown shader model '%s'.\n", line);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fatal_error("Unknown require directive '%s'.\n", line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
static DXGI_FORMAT parse_format(const char *line, enum texture_data_type *data_type, unsigned int *texel_size, const char **rest)
|
2021-10-03 17:19:09 -07:00
|
|
|
{
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const char *string;
|
|
|
|
enum texture_data_type data_type;
|
|
|
|
unsigned int texel_size;
|
|
|
|
DXGI_FORMAT format;
|
|
|
|
}
|
|
|
|
formats[] =
|
|
|
|
{
|
|
|
|
{"r32g32b32a32 float", TEXTURE_DATA_FLOAT, 16, DXGI_FORMAT_R32G32B32A32_FLOAT},
|
|
|
|
{"r32g32 uint", TEXTURE_DATA_UINT, 8, DXGI_FORMAT_R32G32_UINT},
|
|
|
|
{"r32 float", TEXTURE_DATA_FLOAT, 4, DXGI_FORMAT_R32_FLOAT},
|
|
|
|
{"r32 sint", TEXTURE_DATA_SINT, 4, DXGI_FORMAT_R32_SINT},
|
|
|
|
};
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
|
|
|
{
|
2022-03-21 18:42:16 -07:00
|
|
|
if (match_string(line, formats[i].string, rest))
|
2021-10-03 17:19:09 -07:00
|
|
|
{
|
2022-03-21 18:42:16 -07:00
|
|
|
if (data_type)
|
|
|
|
*data_type = formats[i].data_type;
|
|
|
|
*texel_size = formats[i].texel_size;
|
|
|
|
return formats[i].format;
|
2021-10-03 17:19:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Unknown format '%s'.\n", line);
|
2021-10-03 17:19:09 -07:00
|
|
|
}
|
|
|
|
|
2021-11-05 11:35:49 -07:00
|
|
|
static D3D12_TEXTURE_ADDRESS_MODE parse_sampler_address_mode(const char *line, const char **rest)
|
|
|
|
{
|
|
|
|
if (match_string(line, "border", rest))
|
|
|
|
return D3D12_TEXTURE_ADDRESS_MODE_BORDER;
|
|
|
|
if (match_string(line, "clamp", rest))
|
|
|
|
return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
|
|
if (match_string(line, "mirror_once", rest))
|
|
|
|
return D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE;
|
|
|
|
if (match_string(line, "mirror", rest))
|
|
|
|
return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
|
|
|
|
if (match_string(line, "wrap", rest))
|
|
|
|
return D3D12_TEXTURE_ADDRESS_MODE_WRAP;
|
2021-11-05 11:35:50 -07:00
|
|
|
|
|
|
|
fatal_error("Unknown sampler address mode '%s'.\n", line);
|
2021-11-05 11:35:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void parse_sampler_directive(struct sampler *sampler, const char *line)
|
|
|
|
{
|
|
|
|
if (match_string(line, "address", &line))
|
|
|
|
{
|
|
|
|
sampler->u_address = parse_sampler_address_mode(line, &line);
|
|
|
|
sampler->v_address = parse_sampler_address_mode(line, &line);
|
|
|
|
sampler->w_address = parse_sampler_address_mode(line, &line);
|
|
|
|
}
|
|
|
|
else if (match_string(line, "filter", &line))
|
|
|
|
{
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const char *string;
|
|
|
|
D3D12_FILTER filter;
|
|
|
|
}
|
|
|
|
filters[] =
|
|
|
|
{
|
|
|
|
{"point point point", D3D12_FILTER_MIN_MAG_MIP_POINT},
|
|
|
|
{"point point linear", D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR},
|
|
|
|
{"point linear point", D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT},
|
|
|
|
{"point linear linear", D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR},
|
|
|
|
{"linear point point", D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT},
|
|
|
|
{"linear point linear", D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR},
|
|
|
|
{"linear linear point", D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT},
|
|
|
|
{"linear linear linear", D3D12_FILTER_MIN_MAG_MIP_LINEAR},
|
|
|
|
};
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(filters); ++i)
|
|
|
|
{
|
|
|
|
if (match_string(line, filters[i].string, &line))
|
|
|
|
{
|
|
|
|
sampler->filter = filters[i].filter;
|
2021-11-05 11:35:50 -07:00
|
|
|
return;
|
2021-11-05 11:35:49 -07:00
|
|
|
}
|
|
|
|
}
|
2021-11-05 11:35:50 -07:00
|
|
|
|
|
|
|
fatal_error("Unknown sampler filter '%s'.\n", line);
|
2021-11-05 11:35:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Unknown sampler directive '%s'.\n", line);
|
2021-11-05 11:35:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
static void parse_resource_directive(struct resource_params *resource, const char *line)
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2021-10-03 17:19:09 -07:00
|
|
|
if (match_string(line, "format", &line))
|
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
resource->format = parse_format(line, &resource->data_type, &resource->texel_size, &line);
|
2021-10-03 17:19:09 -07:00
|
|
|
}
|
|
|
|
else if (match_string(line, "size", &line))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
ret = sscanf(line, "( %u , %u )", &resource->width, &resource->height);
|
2021-10-03 17:19:08 -07:00
|
|
|
if (ret < 2)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed texture size '%s'.\n", line);
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-03 17:19:09 -07:00
|
|
|
union
|
|
|
|
{
|
|
|
|
float f;
|
|
|
|
int32_t i;
|
|
|
|
uint32_t u;
|
|
|
|
} u;
|
2021-10-03 17:19:08 -07:00
|
|
|
char *rest;
|
|
|
|
|
2021-10-03 17:19:09 -07:00
|
|
|
u.u = 0;
|
|
|
|
|
|
|
|
for (;;)
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
switch (resource->data_type)
|
2021-10-03 17:19:09 -07:00
|
|
|
{
|
|
|
|
case TEXTURE_DATA_FLOAT:
|
|
|
|
u.f = strtof(line, &rest);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTURE_DATA_SINT:
|
|
|
|
u.i = strtol(line, &rest, 10);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTURE_DATA_UINT:
|
|
|
|
u.u = strtoul(line, &rest, 10);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rest == line)
|
|
|
|
break;
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
vkd3d_array_reserve((void **)&resource->data, &resource->data_capacity, resource->data_size + sizeof(u), 1);
|
|
|
|
memcpy(resource->data + resource->data_size, &u, sizeof(u));
|
|
|
|
resource->data_size += sizeof(u);
|
2021-10-03 17:19:08 -07:00
|
|
|
line = rest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
static void parse_input_layout_directive(struct shader_runner *runner, const char *line)
|
|
|
|
{
|
|
|
|
struct input_element *element;
|
|
|
|
const char *rest;
|
|
|
|
|
|
|
|
vkd3d_array_reserve((void **)&runner->input_elements, &runner->input_element_capacity,
|
|
|
|
runner->input_element_count + 1, sizeof(*runner->input_elements));
|
|
|
|
element = &runner->input_elements[runner->input_element_count++];
|
|
|
|
|
|
|
|
element->slot = strtoul(line, (char **)&rest, 10);
|
|
|
|
if (rest == line)
|
|
|
|
fatal_error("Malformed input layout directive '%s'.\n", line);
|
|
|
|
line = rest;
|
|
|
|
|
|
|
|
element->format = parse_format(line, NULL, &element->texel_size, &line);
|
|
|
|
|
|
|
|
if (!(rest = strpbrk(line, " \n")))
|
|
|
|
rest = line + strlen(line);
|
|
|
|
element->name = malloc(rest - line + 1);
|
|
|
|
memcpy(element->name, line, rest - line);
|
|
|
|
element->name[rest - line] = 0;
|
|
|
|
line = rest;
|
|
|
|
|
|
|
|
element->index = strtoul(line, (char **)&rest, 10);
|
|
|
|
if (rest == line)
|
|
|
|
element->index = 0;
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
static void set_uniforms(struct shader_runner *runner, size_t offset, size_t count, const void *uniforms)
|
2022-01-26 17:40:32 -08:00
|
|
|
{
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->uniform_count = align(max(runner->uniform_count, offset + count), 4);
|
|
|
|
vkd3d_array_reserve((void **)&runner->uniforms, &runner->uniform_capacity,
|
|
|
|
runner->uniform_count, sizeof(*runner->uniforms));
|
|
|
|
memcpy(runner->uniforms + offset, uniforms, count * sizeof(*runner->uniforms));
|
2022-01-26 17:40:32 -08:00
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
static void parse_test_directive(struct shader_runner *runner, const char *line)
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
|
|
|
if (match_string(line, "draw quad", &line))
|
|
|
|
{
|
2022-03-21 18:42:15 -07:00
|
|
|
static const char vs_source[] =
|
|
|
|
"void main(uint id : SV_VertexID, out float4 position : SV_Position)\n"
|
|
|
|
"{\n"
|
|
|
|
" float2 coords = float2((id << 1) & 2, id & 2);\n"
|
|
|
|
" position = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1);\n"
|
|
|
|
"}";
|
|
|
|
|
|
|
|
if (!runner->vs_source)
|
|
|
|
runner->vs_source = strdup(vs_source);
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->ops->draw_quad(runner);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
|
|
|
else if (match_string(line, "probe all rgba", &line))
|
|
|
|
{
|
2022-03-19 10:35:34 -07:00
|
|
|
static const RECT rect = {0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT};
|
2020-09-30 19:01:18 -07:00
|
|
|
unsigned int ulps;
|
|
|
|
struct vec4 v;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps);
|
|
|
|
if (ret < 4)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed probe arguments '%s'.\n", line);
|
2020-09-30 19:01:18 -07:00
|
|
|
if (ret < 5)
|
|
|
|
ulps = 0;
|
2022-01-26 17:40:28 -08:00
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->ops->probe_vec4(runner, &rect, &v, ulps);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
2020-09-30 19:01:21 -07:00
|
|
|
else if (match_string(line, "probe rect rgba", &line))
|
|
|
|
{
|
|
|
|
unsigned int x, y, w, h, ulps;
|
|
|
|
struct vec4 v;
|
|
|
|
RECT rect;
|
|
|
|
int ret;
|
|
|
|
|
2021-08-15 11:37:15 -07:00
|
|
|
ret = sscanf(line, "( %u , %u , %u , %u ) ( %f , %f , %f , %f ) %u",
|
|
|
|
&x, &y, &w, &h, &v.x, &v.y, &v.z, &v.w, &ulps);
|
2020-09-30 19:01:21 -07:00
|
|
|
if (ret < 8)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed probe arguments '%s'.\n", line);
|
2020-09-30 19:01:21 -07:00
|
|
|
if (ret < 9)
|
|
|
|
ulps = 0;
|
|
|
|
|
|
|
|
rect.left = x;
|
|
|
|
rect.right = x + w;
|
|
|
|
rect.top = y;
|
|
|
|
rect.bottom = y + h;
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->ops->probe_vec4(runner, &rect, &v, ulps);
|
2020-10-01 21:09:44 -07:00
|
|
|
}
|
|
|
|
else if (match_string(line, "probe rgba", &line))
|
|
|
|
{
|
|
|
|
unsigned int x, y, ulps;
|
|
|
|
struct vec4 v;
|
|
|
|
RECT rect;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps);
|
|
|
|
if (ret < 6)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed probe arguments '%s'.\n", line);
|
2020-10-01 21:09:44 -07:00
|
|
|
if (ret < 7)
|
|
|
|
ulps = 0;
|
|
|
|
|
|
|
|
rect.left = x;
|
|
|
|
rect.right = x + 1;
|
|
|
|
rect.top = y;
|
|
|
|
rect.bottom = y + 1;
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->ops->probe_vec4(runner, &rect, &v, ulps);
|
2020-09-30 19:01:21 -07:00
|
|
|
}
|
2020-09-30 19:01:18 -07:00
|
|
|
else if (match_string(line, "uniform", &line))
|
|
|
|
{
|
|
|
|
unsigned int offset;
|
|
|
|
|
|
|
|
if (!sscanf(line, "%u", &offset))
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Unknown uniform type '%s'.\n", line);
|
2020-09-30 19:01:18 -07:00
|
|
|
line = strchr(line, ' ') + 1;
|
|
|
|
|
|
|
|
if (match_string(line, "float4", &line))
|
|
|
|
{
|
|
|
|
struct vec4 v;
|
|
|
|
|
|
|
|
if (sscanf(line, "%f %f %f %f", &v.x, &v.y, &v.z, &v.w) < 4)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed float4 constant '%s'.\n", line);
|
2022-03-19 10:35:31 -07:00
|
|
|
set_uniforms(runner, offset, 4, &v);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
2021-09-09 19:11:32 -07:00
|
|
|
else if (match_string(line, "float", &line))
|
|
|
|
{
|
|
|
|
float f;
|
|
|
|
|
|
|
|
if (sscanf(line, "%f", &f) < 1)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed float constant '%s'.\n", line);
|
2022-03-19 10:35:31 -07:00
|
|
|
set_uniforms(runner, offset, 1, &f);
|
2021-09-09 19:11:32 -07:00
|
|
|
}
|
2022-02-02 04:46:13 -08:00
|
|
|
else if (match_string(line, "int4", &line))
|
|
|
|
{
|
|
|
|
int v[4];
|
|
|
|
|
|
|
|
if (sscanf(line, "%d %d %d %d", &v[0], &v[1], &v[2], &v[3]) < 4)
|
|
|
|
fatal_error("Malformed int4 constant '%s'.\n", line);
|
2022-03-19 10:35:31 -07:00
|
|
|
set_uniforms(runner, offset, 4, v);
|
2022-02-02 04:46:13 -08:00
|
|
|
}
|
2021-09-09 19:11:32 -07:00
|
|
|
else if (match_string(line, "int", &line))
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (sscanf(line, "%i", &i) < 1)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed int constant '%s'.\n", line);
|
2022-03-19 10:35:31 -07:00
|
|
|
set_uniforms(runner, offset, 1, &i);
|
2021-09-09 19:11:32 -07:00
|
|
|
}
|
2020-09-30 19:01:22 -07:00
|
|
|
else if (match_string(line, "uint", &line))
|
|
|
|
{
|
|
|
|
unsigned int u;
|
|
|
|
|
2021-09-09 19:11:32 -07:00
|
|
|
if (sscanf(line, "%u", &u) < 1)
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed uint constant '%s'.\n", line);
|
2022-03-19 10:35:31 -07:00
|
|
|
set_uniforms(runner, offset, 1, &u);
|
2020-09-30 19:01:22 -07:00
|
|
|
}
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Unknown test directive '%s'.\n", line);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
static struct sampler *get_sampler(struct shader_runner *runner, unsigned int slot)
|
2021-11-05 11:35:49 -07:00
|
|
|
{
|
|
|
|
struct sampler *sampler;
|
|
|
|
size_t i;
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
for (i = 0; i < runner->sampler_count; ++i)
|
2021-11-05 11:35:49 -07:00
|
|
|
{
|
2022-03-19 10:35:31 -07:00
|
|
|
sampler = &runner->samplers[i];
|
2021-11-05 11:35:49 -07:00
|
|
|
|
|
|
|
if (sampler->slot == slot)
|
|
|
|
return sampler;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
static void set_resource(struct shader_runner *runner, struct resource *resource)
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
for (i = 0; i < runner->resource_count; ++i)
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
if (runner->resources[i]->slot == resource->slot && runner->resources[i]->type == resource->type)
|
2022-01-26 17:40:29 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
runner->ops->destroy_resource(runner, runner->resources[i]);
|
|
|
|
runner->resources[i] = resource;
|
2022-01-26 17:40:29 -08:00
|
|
|
return;
|
|
|
|
}
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
runner->resources = realloc(runner->resources, (runner->resource_count + 1) * sizeof(*runner->resources));
|
|
|
|
runner->resources[runner->resource_count++] = resource;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:18 -07:00
|
|
|
unsigned int get_vb_stride(const struct shader_runner *runner, unsigned int slot)
|
|
|
|
{
|
|
|
|
unsigned int stride = 0;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
/* We currently don't deal with vertex formats less than 32 bits, so don't
|
|
|
|
* bother with alignment. */
|
|
|
|
for (i = 0; i < runner->input_element_count; ++i)
|
|
|
|
{
|
|
|
|
const struct input_element *element = &runner->input_elements[i];
|
|
|
|
|
|
|
|
if (element->slot == slot)
|
|
|
|
stride += element->texel_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
return stride;
|
|
|
|
}
|
|
|
|
|
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)
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
|
|
|
size_t shader_source_size = 0, shader_source_len = 0;
|
2022-03-21 18:42:17 -07:00
|
|
|
struct resource_params current_resource;
|
2021-11-05 11:35:49 -07:00
|
|
|
struct sampler *current_sampler = NULL;
|
2020-09-30 19:01:18 -07:00
|
|
|
enum parse_state state = STATE_NONE;
|
2020-10-03 14:24:26 -07:00
|
|
|
unsigned int i, line_number = 0;
|
2020-09-30 19:01:18 -07:00
|
|
|
const char *filename = NULL;
|
|
|
|
char *shader_source = NULL;
|
|
|
|
char line[256];
|
|
|
|
FILE *f;
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->minimum_shader_model = SHADER_MODEL_2_0;
|
2022-03-07 17:55:44 -08:00
|
|
|
|
2020-09-30 19:01:18 -07:00
|
|
|
for (i = 1; i < argc; ++i)
|
|
|
|
{
|
|
|
|
if (argv[i][0] != '-')
|
|
|
|
{
|
|
|
|
filename = argv[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!filename)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Usage: %s [file]\n", argv[0]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(f = fopen(filename, "r")))
|
|
|
|
{
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Unable to open '%s' for reading: %s\n", argv[1], strerror(errno));
|
2020-09-30 19:01:18 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
memset(runner, 0, sizeof(*runner));
|
|
|
|
runner->ops = ops;
|
2020-09-30 19:01:18 -07:00
|
|
|
|
2020-10-03 14:24:26 -07:00
|
|
|
for (;;)
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
2020-10-03 14:24:26 -07:00
|
|
|
char *ret = fgets(line, sizeof(line), f);
|
2020-09-30 19:01:22 -07:00
|
|
|
|
2020-10-03 14:24:26 -07:00
|
|
|
++line_number;
|
|
|
|
|
|
|
|
if (!ret || line[0] == '[')
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
2022-03-21 18:42:16 -07:00
|
|
|
case STATE_INPUT_LAYOUT:
|
2020-09-30 19:01:18 -07:00
|
|
|
case STATE_NONE:
|
2022-01-26 06:35:33 -08:00
|
|
|
case STATE_REQUIRE:
|
2021-11-05 11:35:49 -07:00
|
|
|
case STATE_SAMPLER:
|
2020-09-30 19:01:18 -07:00
|
|
|
case STATE_TEST:
|
2022-01-26 17:40:29 -08:00
|
|
|
break;
|
|
|
|
|
2021-10-03 17:19:08 -07:00
|
|
|
case STATE_TEXTURE:
|
2022-03-21 18:42:18 -07:00
|
|
|
case STATE_VERTEX_BUFFER:
|
2022-03-21 18:42:17 -07:00
|
|
|
set_resource(runner, runner->ops->create_resource(runner, ¤t_resource));
|
|
|
|
free(current_resource.data);
|
2020-09-30 19:01:18 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STATE_SHADER_PIXEL:
|
2022-03-19 10:35:31 -07:00
|
|
|
free(runner->ps_source);
|
|
|
|
runner->ps_source = shader_source;
|
2022-01-26 17:40:31 -08:00
|
|
|
shader_source = NULL;
|
2020-09-30 19:01:18 -07:00
|
|
|
shader_source_len = 0;
|
2022-01-26 17:40:31 -08:00
|
|
|
shader_source_size = 0;
|
2020-09-30 19:01:18 -07:00
|
|
|
break;
|
2020-10-03 14:24:26 -07:00
|
|
|
|
2022-03-21 18:42:14 -07:00
|
|
|
case STATE_SHADER_VERTEX:
|
|
|
|
free(runner->vs_source);
|
|
|
|
runner->vs_source = shader_source;
|
|
|
|
shader_source = NULL;
|
|
|
|
shader_source_len = 0;
|
|
|
|
shader_source_size = 0;
|
|
|
|
break;
|
|
|
|
|
2020-10-03 14:24:26 -07:00
|
|
|
case STATE_SHADER_INVALID_PIXEL:
|
|
|
|
{
|
|
|
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = D3DCompile(shader_source, strlen(shader_source), NULL,
|
|
|
|
NULL, NULL, "main", "ps_4_0", 0, 0, &blob, &errors);
|
|
|
|
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
|
|
|
ok(!blob, "Expected no compiled shader blob.\n");
|
|
|
|
ok(!!errors, "Expected non-NULL error blob.\n");
|
2020-10-08 23:14:02 -07:00
|
|
|
if (!errors)
|
|
|
|
return;
|
2020-10-03 14:24:26 -07:00
|
|
|
|
|
|
|
if (vkd3d_test_state.debug_level)
|
|
|
|
trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
|
|
|
|
ID3D10Blob_Release(errors);
|
|
|
|
|
|
|
|
shader_source_len = 0;
|
|
|
|
break;
|
|
|
|
}
|
2020-11-21 15:23:45 -08:00
|
|
|
|
2020-11-23 22:29:57 -08:00
|
|
|
case STATE_PREPROC_INVALID:
|
|
|
|
{
|
|
|
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors);
|
|
|
|
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
|
|
|
ok(!blob, "Expected no compiled shader blob.\n");
|
|
|
|
ok(!!errors, "Expected non-NULL error blob.\n");
|
|
|
|
|
|
|
|
if (errors)
|
|
|
|
{
|
|
|
|
if (vkd3d_test_state.debug_level)
|
|
|
|
trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
|
|
|
|
ID3D10Blob_Release(errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_source_len = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-11-21 15:23:45 -08:00
|
|
|
case STATE_PREPROC:
|
|
|
|
{
|
|
|
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
2020-12-01 18:51:08 -08:00
|
|
|
SIZE_T size;
|
2020-11-21 15:23:45 -08:00
|
|
|
HRESULT hr;
|
|
|
|
char *text;
|
|
|
|
|
|
|
|
hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors);
|
|
|
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
if (errors)
|
|
|
|
{
|
|
|
|
if (vkd3d_test_state.debug_level)
|
|
|
|
trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
|
|
|
|
ID3D10Blob_Release(errors);
|
|
|
|
}
|
|
|
|
|
|
|
|
text = ID3D10Blob_GetBufferPointer(blob);
|
2020-12-01 18:51:08 -08:00
|
|
|
size = ID3D10Blob_GetBufferSize(blob);
|
|
|
|
ok(vkd3d_memmem(text, size, "pass", strlen("pass")),
|
|
|
|
"'pass' not found in preprocessed shader.\n");
|
|
|
|
ok(!vkd3d_memmem(text, size, "fail", strlen("fail")),
|
|
|
|
"'fail' found in preprocessed shader.\n");
|
2020-11-21 15:23:45 -08:00
|
|
|
ID3D10Blob_Release(blob);
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_source_len = 0;
|
|
|
|
break;
|
|
|
|
}
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
2020-10-03 14:24:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
break;
|
2020-09-30 19:01:18 -07:00
|
|
|
|
2020-10-03 14:24:26 -07:00
|
|
|
if (line[0] == '[')
|
|
|
|
{
|
2021-10-03 17:19:08 -07:00
|
|
|
unsigned int index;
|
|
|
|
|
2022-01-26 06:35:33 -08:00
|
|
|
if (!strcmp(line, "[require]\n"))
|
|
|
|
{
|
|
|
|
state = STATE_REQUIRE;
|
|
|
|
}
|
|
|
|
else if (!strcmp(line, "[pixel shader]\n"))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2020-09-30 19:01:18 -07:00
|
|
|
state = STATE_SHADER_PIXEL;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2020-10-03 14:24:26 -07:00
|
|
|
else if (!strcmp(line, "[pixel shader fail]\n"))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2020-10-03 14:24:26 -07:00
|
|
|
state = STATE_SHADER_INVALID_PIXEL;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2021-11-05 11:35:49 -07:00
|
|
|
else if (sscanf(line, "[sampler %u]\n", &index))
|
|
|
|
{
|
|
|
|
state = STATE_SAMPLER;
|
|
|
|
|
2022-03-19 10:35:31 -07:00
|
|
|
if ((current_sampler = get_sampler(runner, index)))
|
2021-11-05 11:35:49 -07:00
|
|
|
{
|
|
|
|
memset(current_sampler, 0, sizeof(*current_sampler));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-19 10:35:31 -07:00
|
|
|
runner->samplers = realloc(runner->samplers,
|
|
|
|
++runner->sampler_count * sizeof(*runner->samplers));
|
|
|
|
current_sampler = &runner->samplers[runner->sampler_count - 1];
|
2021-11-05 11:35:49 -07:00
|
|
|
memset(current_sampler, 0, sizeof(*current_sampler));
|
|
|
|
}
|
|
|
|
current_sampler->slot = index;
|
|
|
|
current_sampler->filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
|
|
|
|
current_sampler->u_address = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
|
|
current_sampler->v_address = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
|
|
current_sampler->w_address = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
|
|
|
|
}
|
2021-10-03 17:19:08 -07:00
|
|
|
else if (sscanf(line, "[texture %u]\n", &index))
|
|
|
|
{
|
|
|
|
state = STATE_TEXTURE;
|
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
memset(¤t_resource, 0, sizeof(current_resource));
|
2022-01-26 17:40:29 -08:00
|
|
|
|
2022-03-21 18:42:17 -07:00
|
|
|
current_resource.slot = index;
|
|
|
|
current_resource.type = RESOURCE_TYPE_TEXTURE;
|
|
|
|
current_resource.format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
|
|
|
current_resource.data_type = TEXTURE_DATA_FLOAT;
|
|
|
|
current_resource.texel_size = 16;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2022-03-21 18:42:18 -07:00
|
|
|
else if (sscanf(line, "[vertex buffer %u]\n", &index))
|
|
|
|
{
|
|
|
|
state = STATE_VERTEX_BUFFER;
|
|
|
|
|
|
|
|
memset(¤t_resource, 0, sizeof(current_resource));
|
|
|
|
|
|
|
|
current_resource.slot = index;
|
|
|
|
current_resource.type = RESOURCE_TYPE_VERTEX_BUFFER;
|
|
|
|
current_resource.data_type = TEXTURE_DATA_FLOAT;
|
|
|
|
}
|
2020-09-30 19:01:18 -07:00
|
|
|
else if (!strcmp(line, "[test]\n"))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2020-09-30 19:01:18 -07:00
|
|
|
state = STATE_TEST;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2020-11-21 15:23:45 -08:00
|
|
|
else if (!strcmp(line, "[preproc]\n"))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2020-11-21 15:23:45 -08:00
|
|
|
state = STATE_PREPROC;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2020-11-23 22:29:57 -08:00
|
|
|
else if (!strcmp(line, "[preproc fail]\n"))
|
2021-10-03 17:19:08 -07:00
|
|
|
{
|
2020-11-23 22:29:57 -08:00
|
|
|
state = STATE_PREPROC_INVALID;
|
2021-10-03 17:19:08 -07:00
|
|
|
}
|
2022-03-21 18:42:14 -07:00
|
|
|
else if (!strcmp(line, "[vertex shader]\n"))
|
|
|
|
{
|
|
|
|
state = STATE_SHADER_VERTEX;
|
|
|
|
}
|
2022-03-21 18:42:16 -07:00
|
|
|
else if (!strcmp(line, "[input layout]\n"))
|
|
|
|
{
|
|
|
|
state = STATE_INPUT_LAYOUT;
|
|
|
|
|
|
|
|
for (i = 0; i < runner->input_element_count; ++i)
|
|
|
|
free(runner->input_elements[i].name);
|
|
|
|
runner->input_element_count = 0;
|
|
|
|
}
|
2020-10-03 14:24:26 -07:00
|
|
|
|
|
|
|
vkd3d_test_set_context("Section %.*s, line %u", strlen(line) - 1, line, line_number);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
2021-10-03 17:19:07 -07:00
|
|
|
else if (line[0] != '%' && line[0] != '\n')
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case STATE_NONE:
|
2021-11-05 11:35:50 -07:00
|
|
|
fatal_error("Malformed line '%s'.\n", line);
|
2020-09-30 19:01:18 -07:00
|
|
|
break;
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
case STATE_INPUT_LAYOUT:
|
|
|
|
parse_input_layout_directive(runner, line);
|
|
|
|
break;
|
|
|
|
|
2020-11-21 15:23:45 -08:00
|
|
|
case STATE_PREPROC:
|
2020-11-23 22:29:57 -08:00
|
|
|
case STATE_PREPROC_INVALID:
|
2020-10-03 14:24:26 -07:00
|
|
|
case STATE_SHADER_INVALID_PIXEL:
|
2020-09-30 19:01:18 -07:00
|
|
|
case STATE_SHADER_PIXEL:
|
2022-03-21 18:42:14 -07:00
|
|
|
case STATE_SHADER_VERTEX:
|
2020-09-30 19:01:18 -07:00
|
|
|
{
|
|
|
|
size_t len = strlen(line);
|
|
|
|
|
|
|
|
vkd3d_array_reserve((void **)&shader_source, &shader_source_size, shader_source_len + len + 1, 1);
|
|
|
|
memcpy(shader_source + shader_source_len, line, len + 1);
|
|
|
|
shader_source_len += len;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2022-01-26 06:35:33 -08:00
|
|
|
case STATE_REQUIRE:
|
2022-03-19 10:35:31 -07:00
|
|
|
parse_require_directive(runner, line);
|
2022-01-26 06:35:33 -08:00
|
|
|
break;
|
|
|
|
|
2021-11-05 11:35:49 -07:00
|
|
|
case STATE_SAMPLER:
|
|
|
|
parse_sampler_directive(current_sampler, line);
|
|
|
|
break;
|
|
|
|
|
2021-10-03 17:19:08 -07:00
|
|
|
case STATE_TEXTURE:
|
2022-03-21 18:42:18 -07:00
|
|
|
case STATE_VERTEX_BUFFER:
|
2022-03-21 18:42:17 -07:00
|
|
|
parse_resource_directive(¤t_resource, line);
|
2021-10-03 17:19:08 -07:00
|
|
|
break;
|
|
|
|
|
2020-09-30 19:01:18 -07:00
|
|
|
case STATE_TEST:
|
2022-03-19 10:35:31 -07:00
|
|
|
parse_test_directive(runner, line);
|
2020-09-30 19:01:18 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-21 18:42:16 -07:00
|
|
|
for (i = 0; i < runner->input_element_count; ++i)
|
|
|
|
free(runner->input_elements[i].name);
|
|
|
|
free(runner->input_elements);
|
2022-03-21 18:42:14 -07:00
|
|
|
free(runner->vs_source);
|
2022-03-19 10:35:31 -07:00
|
|
|
free(runner->ps_source);
|
2022-03-21 18:42:17 -07:00
|
|
|
for (i = 0; i < runner->resource_count; ++i)
|
2022-01-26 17:40:29 -08:00
|
|
|
{
|
2022-03-21 18:42:17 -07:00
|
|
|
if (runner->resources[i])
|
|
|
|
runner->ops->destroy_resource(runner, runner->resources[i]);
|
2022-01-26 17:40:29 -08:00
|
|
|
}
|
2022-03-21 18:42:17 -07:00
|
|
|
free(runner->resources);
|
2020-09-30 19:01:18 -07:00
|
|
|
|
|
|
|
fclose(f);
|
2022-01-26 17:40:33 -08:00
|
|
|
|
|
|
|
vkd3d_test_set_context(NULL);
|
2020-09-30 19:01:18 -07:00
|
|
|
}
|
2022-01-26 17:40:27 -08:00
|
|
|
|
|
|
|
START_TEST(shader_runner)
|
|
|
|
{
|
2022-01-26 17:40:33 -08:00
|
|
|
#ifdef _WIN32
|
|
|
|
run_shader_tests_d3d11(argc, argv);
|
|
|
|
#endif
|
2022-01-26 17:40:27 -08:00
|
|
|
run_shader_tests_d3d12(argc, argv);
|
|
|
|
}
|