WineD3D: D3DRS_ZVISIBLE is not supposed to return an error
Stefan Dösinger
stefan at codeweavers.com
Thu Dec 14 13:48:09 CST 2006
This time with a working test :-)
-------------- next part --------------
From db495ed57ebbccf6bb9941a6f60f50a005e86b2f Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Thu, 14 Dec 2006 18:07:28 +0100
Subject: [PATCH] WineD3D: WINED3DRS_ZVISIBLE is not supposed to return an error
---
dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++++++++++++++++++++
dlls/ddraw/tests/d3d.c | 12 ++++++++++++
dlls/wined3d/device.c | 8 +-------
3 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 3ec0dbd..1ad56b7 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -648,6 +648,44 @@ cleanup:
if(pDevice) IDirect3D8_Release(pDevice);
}
+static void test_states(void)
+{
+ HRESULT hr;
+ HWND hwnd = NULL;
+ IDirect3D8 *pD3d = NULL;
+ IDirect3DDevice8 *pDevice = NULL;
+ D3DPRESENT_PARAMETERS d3dpp;
+ D3DDISPLAYMODE d3ddm;
+
+ pD3d = pDirect3DCreate8( D3D_SDK_VERSION );
+ ok(pD3d != NULL, "Failed to create IDirect3D8 object\n");
+ hwnd = CreateWindow( "static", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL );
+ ok(hwnd != NULL, "Failed to create window\n");
+ if (!pD3d || !hwnd) goto cleanup;
+
+ IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm );
+ ZeroMemory( &d3dpp, sizeof(d3dpp) );
+ d3dpp.Windowed = TRUE;
+ d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ d3dpp.BackBufferWidth = 640;
+ d3dpp.BackBufferHeight = 480;
+ d3dpp.BackBufferFormat = d3ddm.Format;
+
+ hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice );
+ ok(SUCCEEDED(hr), "Failed to create IDirect3D8Device (%s)\n", DXGetErrorString8(hr));
+ if (FAILED(hr)) goto cleanup;
+
+ hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, TRUE);
+ ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, TRUE) returned %s\n", DXGetErrorString8(hr));
+ hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, FALSE);
+ ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, FALSE) returned %s\n", DXGetErrorString8(hr));
+
+cleanup:
+ if(pD3d) IDirect3D8_Release(pD3d);
+ if(pDevice) IDirect3D8_Release(pDevice);
+}
+
START_TEST(device)
{
HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" );
@@ -659,5 +697,6 @@ START_TEST(device)
test_refcount();
test_mipmap_levels();
test_cursor();
+ test_states();
}
}
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 3f800c5..661efb3 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -475,6 +475,17 @@ out:
IDirect3DVertexBuffer7_Release(lpVBufDest2);
}
+static void StateTest( void )
+{
+ HRESULT rc;
+
+ /* The msdn says its undocumented, does it return an error too? */
+ rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, TRUE);
+ ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, TRUE) returned %08x\n", rc);
+ rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, FALSE);
+ ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, FALSE) returned %08x\n", rc);
+}
+
START_TEST(d3d)
{
init_function_pointers();
@@ -489,5 +500,6 @@ START_TEST(d3d)
}
LightTest();
ProcessVerticesTest();
+ StateTest();
ReleaseDirect3D();
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 58d379f..939af52 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3442,16 +3442,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl
case WINED3DRS_SRCBLENDALPHA :
case WINED3DRS_DESTBLENDALPHA :
case WINED3DRS_BLENDOPALPHA :
+ case WINED3DRS_ZVISIBLE :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
- /** not supported */
- case WINED3DRS_ZVISIBLE :
- {
- LEAVE_GL();
- return WINED3DERR_INVALIDCALL;
- }
-
default:
FIXME("(%p)->(%s,%d) unknown state\n", This, debug_d3drenderstate(State), Value);
}
--
1.4.2.4
More information about the wine-patches
mailing list