mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/shader_runner: Introduce the "f32" probe format.
This commit is contained in:
Notes:
Henri Verbeet
2025-06-10 18:06:45 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1555
@@ -821,6 +821,21 @@ static void read_uint(const char **line, unsigned int *u, bool is_uniform)
|
||||
*line = rest;
|
||||
}
|
||||
|
||||
static void read_f32(const char **line, float *f)
|
||||
{
|
||||
char *rest;
|
||||
float val;
|
||||
|
||||
errno = 0;
|
||||
val = strtof(*line, &rest);
|
||||
|
||||
if (errno != 0 || rest == *line)
|
||||
fatal_error("Malformed f32 constant '%s'.\n", *line);
|
||||
|
||||
*f = val;
|
||||
*line = rest;
|
||||
}
|
||||
|
||||
static void read_int4(const char **line, struct ivec4 *v)
|
||||
{
|
||||
read_int(line, &v->x, true);
|
||||
@@ -1342,6 +1357,56 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
||||
check_readback_data_uint(rb, &box, v.x, 0);
|
||||
}
|
||||
}
|
||||
else if (match_string(line, "f32", &line))
|
||||
{
|
||||
struct vec4 v;
|
||||
|
||||
if (*line != '(')
|
||||
fatal_error("Malformed probe arguments '%s'.\n", line);
|
||||
++line;
|
||||
|
||||
read_f32(&line, &v.x);
|
||||
while (isspace(*line))
|
||||
++line;
|
||||
if (*line == ',')
|
||||
{
|
||||
++line;
|
||||
read_f32(&line, &v.y);
|
||||
while (isspace(*line))
|
||||
++line;
|
||||
if (*line == ',')
|
||||
{
|
||||
++line;
|
||||
read_f32(&line, &v.z);
|
||||
|
||||
while (isspace(*line))
|
||||
++line;
|
||||
if (*line != ',')
|
||||
fatal_error("Malformed probe arguments '%s'.\n", line);
|
||||
++line;
|
||||
read_f32(&line, &v.w);
|
||||
|
||||
if (sscanf(line, " ) %u", &ulps) < 1)
|
||||
ulps = 0;
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_vec4(rb, &rect, &v, ulps);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sscanf(line, " ) %u", &ulps) < 1)
|
||||
ulps = 0;
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_vec2(rb, &rect, &v, ulps);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sscanf(line, " ) %u", &ulps) < 1)
|
||||
ulps = 0;
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_float(rb, &rect, v.x, ulps);
|
||||
}
|
||||
}
|
||||
else if (match_string(line, "rgba", &line))
|
||||
{
|
||||
struct vec4 v;
|
||||
@@ -1354,30 +1419,6 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_vec4(rb, &rect, &v, ulps);
|
||||
}
|
||||
else if (match_string(line, "rg", &line))
|
||||
{
|
||||
struct vec4 v;
|
||||
|
||||
ret = sscanf(line, "( %f , %f ) %u", &v.x, &v.y, &ulps);
|
||||
if (ret < 2)
|
||||
fatal_error("Malformed probe arguments '%s'.\n", line);
|
||||
if (ret < 3)
|
||||
ulps = 0;
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_vec2(rb, &rect, &v, ulps);
|
||||
}
|
||||
else if (match_string(line, "r", &line))
|
||||
{
|
||||
float expect;
|
||||
|
||||
ret = sscanf(line, "( %f ) %u", &expect, &ulps);
|
||||
if (ret < 1)
|
||||
fatal_error("Malformed probe arguments '%s'.\n", line);
|
||||
if (ret < 2)
|
||||
ulps = 0;
|
||||
todo_if(runner->is_todo) bug_if(runner->is_bug)
|
||||
check_readback_data_float(rb, &rect, expect, ulps);
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_error("Malformed probe arguments '%s'.\n", line);
|
||||
|
Reference in New Issue
Block a user