Stefan Dösinger : d3d9: Do not expect consistent failures.

Alexandre Julliard julliard at winehq.org
Tue Feb 19 08:05:32 CST 2008


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Tue Feb 12 02:34:27 2008 +0100

d3d9: Do not expect consistent failures.

The drivers for some radeon cards are not prepared for the things the
fixed function type test does and fail inconsistently. Thus skip the
color comparison if one of the two draws fails, and do not write an
extra complaint about the inconsistency

---

 dlls/d3d9/tests/visual.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 56a67b6..2858ee6 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -5588,20 +5588,31 @@ static void fixed_function_decl_test(IDirect3DDevice9 *device)
        {  90,    300,     0.1,      2.0,        0x00ffff00},
        { 570,    300,     0.1,      2.0,        0x00ffff00}
     };
+    D3DCAPS9 caps;
+
+    memset(&caps, 0, sizeof(caps));
+    hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+    ok(hr == D3D_OK, "GetDeviceCaps failed, hr = %08x\n", hr);
 
     hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0);
     ok(hr == D3D_OK, "Clear failed, hr = %08x\n", hr);
 
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_d3dcolor, &dcl_color);
     ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
-    hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_ubyte4n, &dcl_ubyte);
-    ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_short4, &dcl_short);
     ok(SUCCEEDED(hr) || hr == E_FAIL, "CreateVertexDeclaration failed (%08x)\n", hr);
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_float, &dcl_float);
     ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
-    hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_ubyte4n_2streams, &dcl_ubyte_2);
-    ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
+    if(caps.DeclTypes & D3DDTCAPS_UBYTE4N) {
+        hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_ubyte4n_2streams, &dcl_ubyte_2);
+        ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
+        hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_ubyte4n, &dcl_ubyte);
+        ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
+    } else {
+        trace("D3DDTCAPS_UBYTE4N not supported\n");
+        dcl_ubyte_2 = NULL;
+        dcl_ubyte = NULL;
+    }
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_d3dcolor_2streams, &dcl_color_2);
     ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%08x)\n", hr);
     hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_positiont, &dcl_positiont);
@@ -5857,7 +5868,10 @@ static void fixed_function_decl_test(IDirect3DDevice9 *device)
        "pixel 572/302 has color %08x, expected 0x000000ff\n", color);
 
     /* This test is pointless without those two declarations: */
-    if(!dcl_color_2 || !dcl_ubyte_2) goto out;
+    if((!dcl_color_2) || (!dcl_ubyte_2)) {
+        skip("color-ubyte switching test declarations aren't supported\n");
+        goto out;
+    }
 
     hr = IDirect3DVertexBuffer9_Lock(vb, 0, sizeof(quads), (void **) &data, 0);
     ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Lock failed with %s\n", DXGetErrorString9(hr));
@@ -5907,7 +5921,7 @@ static void fixed_function_decl_test(IDirect3DDevice9 *device)
             hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, 8, 2);
             ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL,
                "IDirect3DDevice9_DrawPrimitive failed, hr = %#08x\n", hr);
-            ok(ub_ok == SUCCEEDED(hr), "dcl_ubyte_2 returned two different results\n");
+            ub_ok = (SUCCEEDED(hr) && ub_ok);
 
             hr = IDirect3DDevice9_EndScene(device);
             ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %s\n", DXGetErrorString9(hr));




More information about the wine-cvs mailing list