Stefan Dösinger : d3d9: Be less picky in the D3DFMT_X8L8V8U8 test.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 07:07:36 CST 2007


Module: wine
Branch: master
Commit: 4454096db27e7560cce99367b45be3b24dd0894a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4454096db27e7560cce99367b45be3b24dd0894a

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Nov  6 00:11:19 2007 +0100

d3d9: Be less picky in the D3DFMT_X8L8V8U8 test.

---

 dlls/d3d9/tests/visual.c |  103 ++++++++++++++++------------------------------
 1 files changed, 35 insertions(+), 68 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 6362b5c..2214783 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -323,13 +323,13 @@ typedef struct {
 } test_data_t;
 
 /*
- *  c7      mova    ARGB            mov     ARGB
- * -2.4     -2      0x00ffff00      -3      0x00ff0000
- * -1.6     -2      0x00ffff00      -2      0x00ffff00
- * -0.4      0      0x0000ffff      -1      0x0000ff00
- *  0.4      0      0x0000ffff       0      0x0000ffff
- *  1.6      2      0x00ff00ff       1      0x000000ff
- *  2.4      2      0x00ff00ff       2      0x00ff00ff
+ *  c7      rounded     ARGB
+ * -2.4     -2          0x00ffff00
+ * -1.6     -2          0x00ffff00
+ * -0.4      0          0x0000ffff
+ *  0.4      0          0x0000ffff
+ *  1.6      2          0x00ff00ff
+ *  2.4      2          0x00ff00ff
  */
 static void test_mova(IDirect3DDevice9 *device)
 {
@@ -348,39 +348,14 @@ static void test_mova(IDirect3DDevice9 *device)
         0x02000001, 0xc00f0000, 0x90e40000,                                     /* mov oPos, v0                 */
         0x0000ffff                                                              /* END                          */
     };
-    static const DWORD mov_test[] = {
-        0xfffe0101,                                                             /* vs_1_1                       */
-        0x0000001f, 0x80000000, 0x900f0000,                                     /* dcl_position v0              */
-        0x00000051, 0xa00f0000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, /* def c0, 1.0, 0.0, 0.0, 1.0   */
-        0x00000051, 0xa00f0001, 0x3f800000, 0x3f800000, 0x00000000, 0x3f800000, /* def c1, 1.0, 1.0, 0.0, 1.0   */
-        0x00000051, 0xa00f0002, 0x00000000, 0x3f800000, 0x00000000, 0x3f800000, /* def c2, 0.0, 1.0, 0.0, 1.0   */
-        0x00000051, 0xa00f0003, 0x00000000, 0x3f800000, 0x3f800000, 0x3f800000, /* def c3, 0.0, 1.0, 1.0, 1.0   */
-        0x00000051, 0xa00f0004, 0x00000000, 0x00000000, 0x3f800000, 0x3f800000, /* def c4, 0.0, 0.0, 1.0, 1.0   */
-        0x00000051, 0xa00f0005, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, /* def c5, 1.0, 0.0, 1.0, 1.0   */
-        0x00000051, 0xa00f0006, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, /* def c6, 1.0, 1.0, 1.0, 1.0   */
-        0x00000001, 0xb0010000, 0xa0000007,                                     /* mov a0.x, c7.x               */
-        0x00000001, 0xd00f0000, 0xa0e42003,                                     /* mov oD0, c[a0.x + 3]         */
-        0x00000001, 0xc00f0000, 0x90e40000,                                     /* mov oPos, v0                 */
-        0x0000ffff                                                              /* END                          */
-    };
 
-    static const test_data_t test_data[2][6] = {
-        {
-            {{-2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff0000},
-            {{-1.6f, 0.0f, 0.0f, 0.0f}, 0x00ffff00},
-            {{-0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ff00},
-            {{ 0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ffff},
-            {{ 1.6f, 0.0f, 0.0f, 0.0f}, 0x000000ff},
-            {{ 2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff}
-        },
-        {
-            {{-2.4f, 0.0f, 0.0f, 0.0f}, 0x00ffff00},
-            {{-1.6f, 0.0f, 0.0f, 0.0f}, 0x00ffff00},
-            {{-0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ffff},
-            {{ 0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ffff},
-            {{ 1.6f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff},
-            {{ 2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff}
-        }
+    static const test_data_t test_data[] = {
+        {{-2.4f, 0.0f, 0.0f, 0.0f}, 0x00ffff00},
+        {{-1.6f, 0.0f, 0.0f, 0.0f}, 0x00ffff00},
+        {{-0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ffff},
+        {{ 0.4f, 0.0f, 0.0f, 0.0f}, 0x0000ffff},
+        {{ 1.6f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff},
+        {{ 2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff}
     };
 
     static const float quad[][3] = {
@@ -397,51 +372,43 @@ static void test_mova(IDirect3DDevice9 *device)
 
     IDirect3DVertexDeclaration9 *vertex_declaration = NULL;
     IDirect3DVertexShader9 *mova_shader = NULL;
-    IDirect3DVertexShader9 *mov_shader = NULL;
     HRESULT hr;
-    int i, j;
+    int i;
 
     hr = IDirect3DDevice9_CreateVertexShader(device, mova_test, &mova_shader);
     ok(SUCCEEDED(hr), "CreateVertexShader failed (%08x)\n", hr);
-    hr = IDirect3DDevice9_CreateVertexShader(device, mov_test, &mov_shader);
-    ok(SUCCEEDED(hr), "CreateVertexShader failed (%08x)\n", hr);
+    hr = IDirect3DDevice9_SetVertexShader(device, mova_shader);
+    ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr);
+
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration);
     ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
     hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration);
     ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%08x)\n", hr);
 
-    hr = IDirect3DDevice9_SetVertexShader(device, mov_shader);
-    ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr);
-    for(j = 0; j < 2; ++j)
+    for (i = 0; i < (sizeof(test_data) / sizeof(test_data_t)); ++i)
     {
-        for (i = 0; i < (sizeof(test_data[0]) / sizeof(test_data_t)); ++i)
-        {
-            DWORD color;
+        DWORD color;
 
-            hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 7, test_data[j][i].in, 1);
-            ok(SUCCEEDED(hr), "SetVertexShaderConstantF failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 7, test_data[i].in, 1);
+        ok(SUCCEEDED(hr), "SetVertexShaderConstantF failed (%08x)\n", hr);
 
-            hr = IDirect3DDevice9_BeginScene(device);
-            ok(SUCCEEDED(hr), "BeginScene failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_BeginScene(device);
+        ok(SUCCEEDED(hr), "BeginScene failed (%08x)\n", hr);
 
-            hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float));
-            ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float));
+        ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
 
-            hr = IDirect3DDevice9_EndScene(device);
-            ok(SUCCEEDED(hr), "EndScene failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_EndScene(device);
+        ok(SUCCEEDED(hr), "EndScene failed (%08x)\n", hr);
 
-            hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
-            ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+        ok(SUCCEEDED(hr), "Present failed (%08x)\n", hr);
 
-            color = getPixelColor(device, 320, 240);
-            ok(color == test_data[j][i].out, "Expected color %08x, got %08x (for input %f, instruction %s)\n",
-               test_data[j][i].out, color, test_data[j][i].in[0], j == 0 ? "mov" : "mova");
+        color = getPixelColor(device, 320, 240);
+        ok(color == test_data[i].out, "Expected color %08x, got %08x (for input %f)\n", test_data[i].out, color, test_data[i].in[0]);
 
-            hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0, 0.0f, 0);
-            ok(SUCCEEDED(hr), "Clear failed (%08x)\n", hr);
-        }
-        hr = IDirect3DDevice9_SetVertexShader(device, mova_shader);
-        ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0, 0.0f, 0);
+        ok(SUCCEEDED(hr), "Clear failed (%08x)\n", hr);
     }
 
     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
@@ -2839,7 +2806,7 @@ static void x8l8v8u8_test(IDirect3DDevice9 *device)
     hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
     ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %s\n", DXGetErrorString9(hr));
     color = getPixelColor(device, 578, 430);
-    ok(color == 0x008262ca, "D3DFMT_X8L8V8U8 = 0x112131ca returns color %08x, expected 0x008262ca\n", color);
+    ok(color == 0x008262ca || color == 0x008363ca, "D3DFMT_X8L8V8U8 = 0x112131ca returns color %08x, expected 0x008262ca\n", color);
 
     hr = IDirect3DDevice9_SetPixelShader(device, shader2);
     ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed (%08x)\n", hr);




More information about the wine-cvs mailing list