WineD3D: Move WINED3DRS_ZWRITEENABLE to the state table
Stefan Dösinger
stefan at codeweavers.com
Thu Dec 7 18:43:25 CST 2006
-------------- next part --------------
From 3f0e3e44d3f0fb7cf01cfa17dc9fdd39c65716de Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Fri, 8 Dec 2006 00:45:46 +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 91acffd..291f795 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3442,17 +3442,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
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 0d104e0..3f9aeec 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -182,6 +182,19 @@ static void state_ditherenable(DWORD sta
}
}
+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 },
--
1.4.2.4
More information about the wine-patches
mailing list