tests: Allow skipping shader tests if requirements are not met.

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:
Zebediah Figura 2022-04-07 18:58:14 -05:00 committed by Alexandre Julliard
parent c7a7cf498d
commit 83a3de8529
2 changed files with 9 additions and 1 deletions

View File

@ -595,11 +595,15 @@ void run_shader_tests(struct shader_runner *runner, int argc, char **argv, const
{ {
case STATE_INPUT_LAYOUT: case STATE_INPUT_LAYOUT:
case STATE_NONE: case STATE_NONE:
case STATE_REQUIRE:
case STATE_SAMPLER: case STATE_SAMPLER:
case STATE_TEST: case STATE_TEST:
break; break;
case STATE_REQUIRE:
if (runner->ops->check_requirements && !runner->ops->check_requirements(runner))
goto out;
break;
case STATE_TEXTURE: case STATE_TEXTURE:
case STATE_VERTEX_BUFFER: case STATE_VERTEX_BUFFER:
set_resource(runner, runner->ops->create_resource(runner, &current_resource)); set_resource(runner, runner->ops->create_resource(runner, &current_resource));
@ -832,6 +836,7 @@ void run_shader_tests(struct shader_runner *runner, int argc, char **argv, const
} }
} }
out:
for (i = 0; i < runner->input_element_count; ++i) for (i = 0; i < runner->input_element_count; ++i)
free(runner->input_elements[i].name); free(runner->input_elements[i].name);
free(runner->input_elements); free(runner->input_elements);

View File

@ -110,6 +110,9 @@ struct shader_runner
struct shader_runner_ops struct shader_runner_ops
{ {
/* Returns false if unable to run the given tests. If NULL, all tests are
* run. */
bool (*check_requirements)(struct shader_runner *runner);
struct resource *(*create_resource)(struct shader_runner *runner, const struct resource_params *params); struct resource *(*create_resource)(struct shader_runner *runner, const struct resource_params *params);
void (*destroy_resource)(struct shader_runner *runner, struct resource *resource); void (*destroy_resource)(struct shader_runner *runner, struct resource *resource);
void (*draw)(struct shader_runner *runner, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count); void (*draw)(struct shader_runner *runner, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count);