[PATCH vkd3d 8/8] tests: Add a test for the "nointerpolation" modifier.

Zebediah Figura zfigura at codeweavers.com
Mon Mar 21 20:42:21 CDT 2022


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 Makefile.am                       |  2 ++
 tests/nointerpolation.shader_test | 27 +++++++++++++++++++++++++++
 tests/shader_runner.c             | 17 +++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100644 tests/nointerpolation.shader_test

diff --git a/Makefile.am b/Makefile.am
index f2c8440c7..64cfe5342 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -103,6 +103,7 @@ vkd3d_shader_tests = \
 	tests/hlsl-vector-indexing-uniform.shader_test \
 	tests/logic-operations.shader_test \
 	tests/math.shader_test \
+	tests/nointerpolation.shader_test \
 	tests/pow.shader_test \
 	tests/preproc-if.shader_test \
 	tests/preproc-ifdef.shader_test \
@@ -351,6 +352,7 @@ XFAIL_TESTS = \
 	tests/hlsl-vector-indexing-uniform.shader_test \
 	tests/logic-operations.shader_test \
 	tests/max.shader_test \
+	tests/nointerpolation.shader_test \
 	tests/sampler-offset.shader_test \
 	tests/trigonometry.shader_test
 endif
diff --git a/tests/nointerpolation.shader_test b/tests/nointerpolation.shader_test
new file mode 100644
index 000000000..8f15be6ed
--- /dev/null
+++ b/tests/nointerpolation.shader_test
@@ -0,0 +1,27 @@
+[require]
+shader model >= 4.0
+
+[input layout]
+0 r32g32b32a32 float texcoord
+
+[vertex buffer 0]
+0.0 1.0 0.0 1.0
+1.0 0.0 0.0 1.0
+0.0 0.0 1.0 1.0
+
+[vertex shader]
+void main(uint id : sv_vertexid, nointerpolation inout float4 t : texcoord, out float4 pos : sv_position)
+{
+    float2 coords = float2((id << 1) & 2, id & 2);
+    pos = float4(coords * float2(2, -2) + float2(-1, 1), 0, 1);
+}
+
+[pixel shader]
+float4 main(nointerpolation float4 t : texcoord) : sv_target
+{
+    return t;
+}
+
+[test]
+draw triangle list 3
+probe all rgba (0.0, 1.0, 0.0, 1.0)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c
index c3f967a2e..99f2a22f8 100644
--- a/tests/shader_runner.c
+++ b/tests/shader_runner.c
@@ -336,6 +336,23 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
 
         runner->ops->draw(runner, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, 3);
     }
+    else if (match_string(line, "draw", &line))
+    {
+        D3D_PRIMITIVE_TOPOLOGY topology;
+        unsigned int vertex_count;
+        char *rest;
+
+        if (match_string(line, "triangle list", &line))
+            topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+        else
+            fatal_error("Unknown primitive topology '%s'.\n", line);
+
+        vertex_count = strtoul(line, &rest, 10);
+        if (line == rest)
+            fatal_error("Malformed vertex count '%s'.\n", line);
+
+        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};
-- 
2.35.1




More information about the wine-devel mailing list