[PATCH 1/6] d3dcompiler/tests: Add a test for struct field semantics.

Zebediah Figura z.figura12 at gmail.com
Thu Jun 11 16:44:17 CDT 2020


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

diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
index 24829235a5b..edff59b6337 100644
--- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
+++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
@@ -900,6 +900,54 @@ static void test_struct_assignment(void)
     release_test_context(&test_context);
 }
 
+static void test_struct_semantics(void)
+{
+    struct test_context test_context;
+    ID3D10Blob *ps_code = NULL;
+    struct vec4 v;
+
+    static const char ps_source[] =
+        "struct input\n"
+        "{\n"
+        "    struct\n"
+        "    {\n"
+        "        float4 texcoord : TEXCOORD0;\n"
+        "    } m;\n"
+        "};\n"
+        "struct output\n"
+        "{\n"
+        "    struct\n"
+        "    {\n"
+        "        float4 color : COLOR;\n"
+        "    } m;\n"
+        "};\n"
+        "struct output main(struct input i)\n"
+        "{\n"
+        "    struct output o;\n"
+        "    o.m.color = i.m.texcoord;\n"
+        "    return o;\n"
+        "}";
+
+    if (!init_test_context(&test_context))
+        return;
+
+    todo_wine ps_code = compile_shader(ps_source, "ps_2_0");
+    if (ps_code)
+    {
+        draw_quad(test_context.device, ps_code);
+
+        v = get_color_vec4(test_context.device, 64, 48);
+        todo_wine ok(compare_vec4(&v, 0.1f, 0.1f, 0.0f, 0.0f, 4096),
+                "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+        v = get_color_vec4(test_context.device, 320, 240);
+        todo_wine ok(compare_vec4(&v, 0.5f, 0.5f, 0.0f, 0.0f, 4096),
+                "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
+
+        ID3D10Blob_Release(ps_code);
+    }
+    release_test_context(&test_context);
+}
+
 static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc,
         const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue)
 {
@@ -1208,6 +1256,7 @@ START_TEST(hlsl_d3d9)
     test_array_dimensions();
     test_majority();
     test_struct_assignment();
+    test_struct_semantics();
 
     test_constant_table();
     test_fail();
-- 
2.27.0




More information about the wine-devel mailing list