tests: Simplify "probe" directive syntax and parsing a bit.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
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-18 08:33:58 +02:00 committed by Alexandre Julliard
parent f187b48792
commit 367bd15ec5
7 changed files with 55 additions and 82 deletions

View File

@ -15,5 +15,5 @@ float4 main(float tex : texcoord) : SV_TARGET
[test] [test]
draw quad draw quad
probe rect rgba ( 0, 0, 319, 480) (0.9, 0.8, 0.7, 0.6) probe ( 0, 0, 319, 480) rgba (0.9, 0.8, 0.7, 0.6)
probe rect rgba (321, 0, 640, 480) (0.1, 0.2, 0.3, 0.4) probe (321, 0, 640, 480) rgba (0.1, 0.2, 0.3, 0.4)

View File

@ -52,14 +52,6 @@ static inline void wait_queue_idle_no_event_(unsigned int line, ID3D12Device *de
ID3D12Fence_Release(fence); ID3D12Fence_Release(fence);
} }
static void set_rect(RECT *rect, int left, int top, int right, int bottom)
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
}
static inline void set_box(D3D12_BOX *box, unsigned int left, unsigned int top, unsigned int front, static inline void set_box(D3D12_BOX *box, unsigned int left, unsigned int top, unsigned int front,
unsigned int right, unsigned int bottom, unsigned int back) unsigned int right, unsigned int bottom, unsigned int back)
{ {

View File

@ -23,6 +23,6 @@ float4 main(float tex : texcoord) : sv_target
[test] [test]
todo draw quad todo draw quad
probe rect rgba ( 0, 0, 159, 480) (10.0, 35.0, 0.0, 0.0) probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0)
probe rect rgba (161, 0, 479, 480) (10.0, 38.0, 0.0, 0.0) probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0)
probe rect rgba (481, 0, 640, 480) ( 5.0, 10.0, 0.0, 0.0) probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0)

View File

@ -409,16 +409,34 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
runner->last_render_failed = !runner->ops->draw(runner, topology, vertex_count); runner->last_render_failed = !runner->ops->draw(runner, topology, vertex_count);
} }
else if (match_string(line, "probe all rgba", &line)) else if (match_string(line, "probe", &line))
{ {
static const RECT rect = {0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT}; unsigned int left, top, right, bottom, ulps;
unsigned int ulps;
struct vec4 v; struct vec4 v;
int ret; int ret, len;
RECT rect;
if (runner->last_render_failed) if (runner->last_render_failed)
return; return;
if (match_string(line, "all", &line))
{
set_rect(&rect, 0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT);
}
else if (sscanf(line, "( %d , %d , %d , %d )%n", &left, &top, &right, &bottom, &len) == 4)
{
set_rect(&rect, left, top, right, bottom);
line += len;
}
else if (sscanf(line, "( %u , %u )%n", &left, &top, &len) == 2)
{
set_rect(&rect, left, top, left + 1, top + 1);
line += len;
}
if (!match_string(line, "rgba", &line))
fatal_error("Malformed probe arguments '%s'.\n", line);
ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps); ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 4) if (ret < 4)
fatal_error("Malformed probe arguments '%s'.\n", line); fatal_error("Malformed probe arguments '%s'.\n", line);
@ -427,51 +445,6 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
runner->ops->probe_vec4(runner, &rect, &v, ulps); runner->ops->probe_vec4(runner, &rect, &v, ulps);
} }
else if (match_string(line, "probe rect rgba", &line))
{
unsigned int left, top, right, bottom, ulps;
struct vec4 v;
RECT rect;
int ret;
if (runner->last_render_failed)
return;
ret = sscanf(line, "( %d , %d , %d , %d ) ( %f , %f , %f , %f ) %u",
&left, &top, &right, &bottom, &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 8)
fatal_error("Malformed probe arguments '%s'.\n", line);
if (ret < 9)
ulps = 0;
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
runner->ops->probe_vec4(runner, &rect, &v, ulps);
}
else if (match_string(line, "probe rgba", &line))
{
unsigned int x, y, ulps;
struct vec4 v;
RECT rect;
int ret;
if (runner->last_render_failed)
return;
ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 6)
fatal_error("Malformed probe arguments '%s'.\n", line);
if (ret < 7)
ulps = 0;
rect.left = x;
rect.right = x + 1;
rect.top = y;
rect.bottom = y + 1;
runner->ops->probe_vec4(runner, &rect, &v, ulps);
}
else if (match_string(line, "uniform", &line)) else if (match_string(line, "uniform", &line))
{ {
unsigned int offset; unsigned int offset;

View File

@ -16,7 +16,7 @@ float4 main(float4 pos : sv_position) : sv_target
[test] [test]
draw quad draw quad
probe rgba (0, 0) (0.1, 0.2, 0.3, 0.4) probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe rgba (1, 0) (0.5, 0.7, 0.6, 0.8) probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8)
probe rgba (0, 1) (0.6, 0.5, 0.2, 0.1) probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1)
probe rgba (1, 1) (0.8, 0.0, 0.7, 1.0) probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0)

View File

@ -13,19 +13,19 @@ float4 main(float tex : texcoord) : sv_target
[test] [test]
todo draw quad todo draw quad
probe rgba ( 0, 0) ( 0.00000000, 1.00000000, 0.0, 0.0) probe ( 0, 0) rgba ( 0.00000000, 1.00000000, 0.0, 0.0)
probe rgba ( 1, 0) ( 0.84147098, 0.54030231, 0.0, 0.0) 1024 probe ( 1, 0) rgba ( 0.84147098, 0.54030231, 0.0, 0.0) 1024
probe rgba ( 2, 0) ( 0.90929743, -0.41614684, 0.0, 0.0) 1024 probe ( 2, 0) rgba ( 0.90929743, -0.41614684, 0.0, 0.0) 1024
probe rgba ( 3, 0) ( 0.14112001, -0.98999250, 0.0, 0.0) 1024 probe ( 3, 0) rgba ( 0.14112001, -0.98999250, 0.0, 0.0) 1024
probe rgba ( 4, 0) (-0.75680250, -0.65364362, 0.0, 0.0) 1024 probe ( 4, 0) rgba (-0.75680250, -0.65364362, 0.0, 0.0) 1024
probe rgba ( 5, 0) (-0.95892427, 0.28366219, 0.0, 0.0) 1024 probe ( 5, 0) rgba (-0.95892427, 0.28366219, 0.0, 0.0) 1024
probe rgba ( 6, 0) (-0.27941550, 0.96017029, 0.0, 0.0) 1024 probe ( 6, 0) rgba (-0.27941550, 0.96017029, 0.0, 0.0) 1024
probe rgba ( 7, 0) ( 0.65698660, 0.75390225, 0.0, 0.0) 1024 probe ( 7, 0) rgba ( 0.65698660, 0.75390225, 0.0, 0.0) 1024
probe rgba ( 8, 0) ( 0.98935825, -0.14550003, 0.0, 0.0) 1024 probe ( 8, 0) rgba ( 0.98935825, -0.14550003, 0.0, 0.0) 1024
probe rgba ( 9, 0) ( 0.41211849, -0.91113026, 0.0, 0.0) 1024 probe ( 9, 0) rgba ( 0.41211849, -0.91113026, 0.0, 0.0) 1024
probe rgba (10, 0) (-0.54402111, -0.83907153, 0.0, 0.0) 1024 probe (10, 0) rgba (-0.54402111, -0.83907153, 0.0, 0.0) 1024
probe rgba (11, 0) (-0.99999021, 0.00442570, 0.0, 0.0) 2048 probe (11, 0) rgba (-0.99999021, 0.00442570, 0.0, 0.0) 2048
probe rgba (12, 0) (-0.53657292, 0.84385396, 0.0, 0.0) 1024 probe (12, 0) rgba (-0.53657292, 0.84385396, 0.0, 0.0) 1024
probe rgba (13, 0) ( 0.42016704, 0.90744678, 0.0, 0.0) 1024 probe (13, 0) rgba ( 0.42016704, 0.90744678, 0.0, 0.0) 1024
probe rgba (14, 0) ( 0.99060736, 0.13673722, 0.0, 0.0) 1024 probe (14, 0) rgba ( 0.99060736, 0.13673722, 0.0, 0.0) 1024
probe rgba (15, 0) ( 0.65028784, -0.75968791, 0.0, 0.0) 1024 probe (15, 0) rgba ( 0.65028784, -0.75968791, 0.0, 0.0) 1024

View File

@ -94,4 +94,12 @@ static inline bool compare_vec4(const struct vec4 *v1, const struct vec4 *v2, un
&& compare_float(v1->w, v2->w, ulps); && compare_float(v1->w, v2->w, ulps);
} }
static inline void set_rect(RECT *rect, int left, int top, int right, int bottom)
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
}
#endif #endif