From 8879c7d8ddf74ae6fc8ba047c9627a84ab88efeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Fri, 8 Dec 2006 01:43:25 +0100 Subject: [PATCH] wined3d: Move WINED3DRS_ZWRITEENABLE to the state table. --- dlls/wined3d/device.c | 11 +---------- dlls/wined3d/state.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 91acffdb870..291f795da68 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3442,17 +3442,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W case WINED3DRS_CULLMODE : case WINED3DRS_SHADEMODE : case WINED3DRS_DITHERENABLE : - StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock); - break; - case WINED3DRS_ZWRITEENABLE : - if (Value) { - glDepthMask(1); - checkGLcall("glDepthMask"); - } else { - glDepthMask(0); - checkGLcall("glDepthMask"); - } + StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock); break; case WINED3DRS_ZFUNC : diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 0d104e0bbfa..3f9aeecad11 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -182,6 +182,19 @@ static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock) } } +static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock) { + /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes, + * this has to be merged with ZENABLE and ZFUNC + */ + if (stateblock->renderState[WINED3DRS_ZWRITEENABLE]) { + glDepthMask(1); + checkGLcall("glDepthMask(1)"); + } else { + glDepthMask(0); + checkGLcall("glDepthMask(0)"); + } +} + const struct StateEntry StateTable[] = { /* State name representative, apply function */ @@ -199,7 +212,7 @@ const struct StateEntry StateTable[] = { /* 11, WINED3DRS_MONOENABLE */ STATE_RENDER(WINED3DRS_MONOENABLE), state_unknown }, { /* 12, WINED3DRS_ROP2 */ STATE_RENDER(WINED3DRS_ROP2), state_unknown }, { /* 13, WINED3DRS_PLANEMASK */ STATE_RENDER(WINED3DRS_PLANEMASK), state_unknown }, - { /* 14, WINED3DRS_ZWRITEENABLE */ STATE_RENDER(WINED3DRS_ZWRITEENABLE), state_unknown }, + { /* 14, WINED3DRS_ZWRITEENABLE */ STATE_RENDER(WINED3DRS_ZWRITEENABLE), state_zwritenable }, { /* 15, WINED3DRS_ALPHATESTENABLE */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_unknown }, { /* 16, WINED3DRS_LASTPIXEL */ STATE_RENDER(WINED3DRS_LASTPIXEL), state_unknown }, { /* 17, WINED3DRS_TEXTUREMAG */ 0 /* Handled in ddraw */, state_undefined },