rendered paste bodyFrom ccb831bc78e533434023dc84bb9536aac9230e6c Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan@codeweavers.com>
Date: Sun, 10 Dec 2006 22:15:28 +0100
Subject: [PATCH] WineD3D: WINED3DRS_ZVISIBLE is not supposed to return an error
---
dlls/d3d8/tests/device.c | 38 ++++++++++++++++++++++++++++++++++++++
dlls/ddraw/tests/d3d.c | 12 ++++++++++++
dlls/wined3d/device.c | 8 +-------
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index b22759d..477eb58 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -645,6 +645,43 @@ 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;
+
+ 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" );
@@ -656,5 +693,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 84f56ef..df7436a 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