[PATCH v2 3/3] d3dcompiler/tests: Add a test for the comma operator.

Zebediah Figura z.figura12 at gmail.com
Tue Feb 18 14:31:27 CST 2020


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/d3dcompiler_43/tests/hlsl.c | 39 ++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/dlls/d3dcompiler_43/tests/hlsl.c b/dlls/d3dcompiler_43/tests/hlsl.c
index 5cb64253e88..97789d14297 100644
--- a/dlls/d3dcompiler_43/tests/hlsl.c
+++ b/dlls/d3dcompiler_43/tests/hlsl.c
@@ -569,6 +569,44 @@ static void test_trig(void)
     DestroyWindow(window);
 }
 
+static void test_comma(void)
+{
+    IDirect3DDevice9 *device;
+    ID3D10Blob *ps_code;
+    struct vec4 v;
+    HWND window;
+
+    static const char ps_source[] =
+        "float4 main(float x: TEXCOORD0): COLOR\n"
+        "{\n"
+        "    float4 ret;\n"
+        "    return (ret = float4(0.1, 0.2, 0.3, 0.4)), ret + 0.5;\n"
+        "}";
+
+    window = create_window();
+    ok(!!window, "Failed to create a window.\n");
+
+    if (!(device = create_d3d9_device(window)))
+    {
+        DestroyWindow(window);
+        return;
+    }
+
+    todo_wine ps_code = compile_shader(ps_source, "ps_2_0");
+    if (ps_code)
+    {
+        draw_quad(device, ps_code);
+
+        v = get_readback_vec4_d3d9(device, 0, 0);
+        ok(compare_vec4(&v, 0.6f, 0.7f, 0.8f, 0.9f, 0),
+                "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+
+        ID3D10Blob_Release(ps_code);
+    }
+    IDirect3DDevice9_Release(device);
+    DestroyWindow(window);
+}
+
 static void test_fail(void)
 {
     static const char *tests[] =
@@ -1104,6 +1142,7 @@ START_TEST(hlsl)
     test_conditionals();
     test_float_vectors();
     test_trig();
+    test_comma();
     test_fail();
 
     if (!(mod = LoadLibraryA("d3d11.dll")))
-- 
2.25.0




More information about the wine-devel mailing list