tests/shader-runner: Introduce "if" qualifier.

When the "if" qualifier is added to a directive, the directive is
skipped if the shader->minimum_shader_model is not included in the
range.

This can be used on the "probe" directives for tests that have different
expected results on different shader models, without having to resort to
[require] blocks.
This commit is contained in:
Francisco Casas
2024-01-29 20:07:39 -03:00
committed by Alexandre Julliard
parent faec42e8a1
commit 22c47e57f5
Notes: Alexandre Julliard 2024-02-13 23:11:43 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/616
6 changed files with 47 additions and 55 deletions

View File

@@ -657,14 +657,46 @@ static void read_uint64_t2(const char **line, struct u64vec2 *v)
static void parse_test_directive(struct shader_runner *runner, const char *line)
{
bool skip_directive = false;
const char *line_ini;
bool match = true;
char *rest;
int ret;
runner->is_todo = false;
if (match_string_with_args(line, "todo", &line, runner->minimum_shader_model))
while (match)
{
runner->is_todo = true;
match = false;
if (match_string_with_args(line, "todo", &line, runner->minimum_shader_model))
{
runner->is_todo = true;
match = true;
}
line_ini = line;
if (match_string_with_args(line, "if", &line, runner->minimum_shader_model))
{
match = true;
}
else if (line != line_ini)
{
/* Matched "if" but for other shader models. */
skip_directive = true;
match = true;
}
}
if (skip_directive)
{
const char *new_line;
if ((new_line = strchr(line, '\n')))
line = new_line + 1;
else
line += strlen(line);
return;
}
if (match_string(line, "dispatch", &line))