Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
Il 18/04/22 08:33, Giovanni Mascellani ha scritto:
From: Zebediah Figura zfigura@codeweavers.com
tests/conditional.shader_test | 4 +- tests/d3d12_test_utils.h | 8 ---- tests/hlsl-for.shader_test | 6 +-- tests/shader_runner.c | 69 +++++++++++----------------------- tests/texture-load.shader_test | 8 ++-- tests/trigonometry.shader_test | 32 ++++++++-------- tests/utils.h | 8 ++++ 7 files changed, 54 insertions(+), 81 deletions(-)
diff --git a/tests/conditional.shader_test b/tests/conditional.shader_test index e665ac1d..42307777 100644 --- a/tests/conditional.shader_test +++ b/tests/conditional.shader_test @@ -15,5 +15,5 @@ float4 main(float tex : texcoord) : SV_TARGET
[test] draw quad -probe rect rgba ( 0, 0, 319, 480) (0.9, 0.8, 0.7, 0.6) -probe rect rgba (321, 0, 640, 480) (0.1, 0.2, 0.3, 0.4) +probe ( 0, 0, 319, 480) rgba (0.9, 0.8, 0.7, 0.6) +probe (321, 0, 640, 480) rgba (0.1, 0.2, 0.3, 0.4) diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h index 7186a73e..bb298082 100644 --- a/tests/d3d12_test_utils.h +++ b/tests/d3d12_test_utils.h @@ -52,14 +52,6 @@ static inline void wait_queue_idle_no_event_(unsigned int line, ID3D12Device *de 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, unsigned int right, unsigned int bottom, unsigned int back) {
diff --git a/tests/hlsl-for.shader_test b/tests/hlsl-for.shader_test index 4e5048c3..e6329834 100644 --- a/tests/hlsl-for.shader_test +++ b/tests/hlsl-for.shader_test @@ -23,6 +23,6 @@ float4 main(float tex : texcoord) : sv_target
[test] todo draw quad -probe rect rgba ( 0, 0, 159, 480) (10.0, 35.0, 0.0, 0.0) -probe rect rgba (161, 0, 479, 480) (10.0, 38.0, 0.0, 0.0) -probe rect rgba (481, 0, 640, 480) ( 5.0, 10.0, 0.0, 0.0) +probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0) +probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0) +probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 8804164e..a820810a 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -409,67 +409,40 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
runner->last_render_failed = !runner->ops->draw(runner, topology, vertex_count); }
- else if (match_string(line, "probe all rgba", &line))
- {
static const RECT rect = {0, 0, RENDER_TARGET_WIDTH, RENDER_TARGET_HEIGHT};
unsigned int ulps;
struct vec4 v;
int ret;
if (runner->last_render_failed)
return;
ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 4)
fatal_error("Malformed probe arguments '%s'.\n", line);
if (ret < 5)
ulps = 0;
runner->ops->probe_vec4(runner, &rect, &v, ulps);
- }
- else if (match_string(line, "probe rect rgba", &line))
- else if (match_string(line, "probe", &line)) { unsigned int left, top, right, bottom, ulps; struct vec4 v;
int ret, len; 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 (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 (runner->last_render_failed)
return;
if (!match_string(line, "rgba", &line))
fatal_error("Malformed probe arguments '%s'.\n", line);
ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 6)
ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 4) fatal_error("Malformed probe arguments '%s'.\n", line);
if (ret < 7)
if (ret < 5) 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))
diff --git a/tests/texture-load.shader_test b/tests/texture-load.shader_test index 951ee3ea..81d06305 100644 --- a/tests/texture-load.shader_test +++ b/tests/texture-load.shader_test @@ -16,7 +16,7 @@ float4 main(float4 pos : sv_position) : sv_target
[test] draw quad -probe rgba (0, 0) (0.1, 0.2, 0.3, 0.4) -probe rgba (1, 0) (0.5, 0.7, 0.6, 0.8) -probe rgba (0, 1) (0.6, 0.5, 0.2, 0.1) -probe rgba (1, 1) (0.8, 0.0, 0.7, 1.0) +probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) +probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8) +probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1) +probe (1, 1) rgba (0.8, 0.0, 0.7, 1.0) diff --git a/tests/trigonometry.shader_test b/tests/trigonometry.shader_test index e9ac3682..b2e87f4a 100644 --- a/tests/trigonometry.shader_test +++ b/tests/trigonometry.shader_test @@ -13,19 +13,19 @@ float4 main(float tex : texcoord) : sv_target
[test] todo draw quad -probe rgba ( 0, 0) ( 0.00000000, 1.00000000, 0.0, 0.0) -probe rgba ( 1, 0) ( 0.84147098, 0.54030231, 0.0, 0.0) 1024 -probe rgba ( 2, 0) ( 0.90929743, -0.41614684, 0.0, 0.0) 1024 -probe rgba ( 3, 0) ( 0.14112001, -0.98999250, 0.0, 0.0) 1024 -probe rgba ( 4, 0) (-0.75680250, -0.65364362, 0.0, 0.0) 1024 -probe rgba ( 5, 0) (-0.95892427, 0.28366219, 0.0, 0.0) 1024 -probe rgba ( 6, 0) (-0.27941550, 0.96017029, 0.0, 0.0) 1024 -probe rgba ( 7, 0) ( 0.65698660, 0.75390225, 0.0, 0.0) 1024 -probe rgba ( 8, 0) ( 0.98935825, -0.14550003, 0.0, 0.0) 1024 -probe rgba ( 9, 0) ( 0.41211849, -0.91113026, 0.0, 0.0) 1024 -probe rgba (10, 0) (-0.54402111, -0.83907153, 0.0, 0.0) 1024 -probe rgba (11, 0) (-0.99999021, 0.00442570, 0.0, 0.0) 2048 -probe rgba (12, 0) (-0.53657292, 0.84385396, 0.0, 0.0) 1024 -probe rgba (13, 0) ( 0.42016704, 0.90744678, 0.0, 0.0) 1024 -probe rgba (14, 0) ( 0.99060736, 0.13673722, 0.0, 0.0) 1024 -probe rgba (15, 0) ( 0.65028784, -0.75968791, 0.0, 0.0) 1024 +probe ( 0, 0) rgba ( 0.00000000, 1.00000000, 0.0, 0.0) +probe ( 1, 0) rgba ( 0.84147098, 0.54030231, 0.0, 0.0) 1024 +probe ( 2, 0) rgba ( 0.90929743, -0.41614684, 0.0, 0.0) 1024 +probe ( 3, 0) rgba ( 0.14112001, -0.98999250, 0.0, 0.0) 1024 +probe ( 4, 0) rgba (-0.75680250, -0.65364362, 0.0, 0.0) 1024 +probe ( 5, 0) rgba (-0.95892427, 0.28366219, 0.0, 0.0) 1024 +probe ( 6, 0) rgba (-0.27941550, 0.96017029, 0.0, 0.0) 1024 +probe ( 7, 0) rgba ( 0.65698660, 0.75390225, 0.0, 0.0) 1024 +probe ( 8, 0) rgba ( 0.98935825, -0.14550003, 0.0, 0.0) 1024 +probe ( 9, 0) rgba ( 0.41211849, -0.91113026, 0.0, 0.0) 1024 +probe (10, 0) rgba (-0.54402111, -0.83907153, 0.0, 0.0) 1024 +probe (11, 0) rgba (-0.99999021, 0.00442570, 0.0, 0.0) 2048 +probe (12, 0) rgba (-0.53657292, 0.84385396, 0.0, 0.0) 1024 +probe (13, 0) rgba ( 0.42016704, 0.90744678, 0.0, 0.0) 1024 +probe (14, 0) rgba ( 0.99060736, 0.13673722, 0.0, 0.0) 1024 +probe (15, 0) rgba ( 0.65028784, -0.75968791, 0.0, 0.0) 1024 diff --git a/tests/utils.h b/tests/utils.h index 530a3cee..563f0b0f 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -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); }
+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