[PATCH 8/9] d3dx9: Add test for 'cmp' preshader opcode.

Paul Gofman gofmanp at gmail.com
Mon May 8 10:39:42 CDT 2017


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/tests/effect.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 015b505..dfc3f5b 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -4490,7 +4490,8 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
     {
         {0, 0, 0},
         {5549, 0, 4},
-        {5400, 2, 1}
+        {5400, 2, 1},
+        {4121, 0, 1}
     };
     DWORD *test_effect_blob;
     HRESULT hr;
@@ -4506,8 +4507,30 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
 
     test_effect_blob = HeapAlloc(GetProcessHeap(), 0, sample_effect_blob_size);
     memcpy(test_effect_blob, sample_effect_blob, sample_effect_blob_size);
-    for (i = 0; i < blob_position[test->args_count].ins_count; ++i)
-        test_effect_blob[op_pos + i * op_step] = test->opcode;
+
+    if (test->args_count == 3)
+    {
+        DWORD *pos;
+
+        pos = &test_effect_blob[op_pos - 1];
+        *pos++ = 1;
+        *pos++ = test->opcode;
+        *pos++ = test->args_count;
+        for (i = 0; i < 3; ++i)
+        {
+            *pos++ = 0;
+            *pos++ = 2;
+            *pos++ = i == 2 ? 4 : 0;
+        }
+        *pos++ = 0;
+        *pos++ = 4;
+        *pos++ = 0;
+    }
+    else
+    {
+        for (i = 0; i < blob_position[test->args_count].ins_count; ++i)
+            test_effect_blob[op_pos + i * op_step] = test->opcode;
+    }
 
     hr = D3DXCreateEffect(device, test_effect_blob, sample_effect_blob_size,
             NULL, NULL, 0, NULL, &effect, NULL);
@@ -4533,7 +4556,7 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
 
     hr = IDirect3DDevice9_GetLight(device, blob_position[test->args_count].result_index, &light);
     ok(hr == D3D_OK, "Got result %#x.\n", hr);
-    v = &light.Diffuse.r;
+    v = test->args_count == 3 ? &light.Specular.r : &light.Diffuse.r;
     for (i = 0; i < 4; ++i)
         todo_wine_if(test->todo[i])
         ok(compare_float(v[i], ((float *)test->expected_result)[i], test->ulps),
@@ -4568,6 +4591,8 @@ static void test_effect_preshader_ops(IDirect3DDevice9 *device)
                 {-0.3f, 0.0f, -0.0f, -0.0f}, {-0.0f, 0.0f, -0.0f, 1.0f}},
         {"div", 0x20800004, 2, {0, 0, 0, 0},
                 {-0.3f, 0.0f, -2.2f, NAN}, {0.0f, -0.0f, -3.0f, 1.0f}},
+        {"cmp", 0x30000004, 3, {0x3f800000, 0, 0x400ccccd, 0x40800000},
+                {-0.3f, 0.0f, 2.2f, NAN}, {1.0f, 2.0f, 3.0f, 4.0f}, 0, {FALSE, FALSE, FALSE, TRUE}},
         {"0 * INF", 0x20500004, 2, {0xffc00000, 0xffc00000, 0xc0d33334, 0x7f800000},
                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {INFINITY, INFINITY, 3.0f, 4.0f}},
     };
-- 
2.9.3




More information about the wine-patches mailing list