WineD3D: Move WINED3DRS_FILLMODE to the state table
Stefan Dösinger
stefan at codeweavers.com
Tue Dec 5 16:45:35 CST 2006
This patch moves the code applying WINED3DRS_FILLMODE into the state table. It
does not change the time when it is applied yet, this will follow later. I
will wait until the 3 patches are applied, and then send patches to move the
render states. Those will be pretty much NOP code moves, except for minor
fixes regarding state dependencies. After that I will create the dirty list
and move applying to drawprim.
Nothing really argueable about this patch I think. Its mainly to give the
first 2 patches some run-time meaning :-)
In the end SetRenderState will look like this:
{
if(same value written again) return WINED3D_OK;
record new value in the stateblock;
if(recording) return WINED3D_OK;
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(state));
return WINED3D_OK;
}
Later on protection against race conditions if the app set the multithreading
flag, but no opengl calls :-) This means we don't have to care for the gl
context in multithreaded direct3d apps in those setters.
-------------- next part --------------
From ee621949a0ffe7863ed1144e4c0a7e6b20e5b721 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Tue, 5 Dec 2006 21:54:44 +0100
Subject: [PATCH] WineD3D: Move WINED3DRS_FILLMODE to the state table
---
dlls/wined3d/device.c | 9 +--------
dlls/wined3d/state.c | 23 ++++++++++++++++++++++-
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a12af38..e759526 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3440,14 +3440,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
switch (State) {
case WINED3DRS_FILLMODE :
- switch ((WINED3DFILLMODE) Value) {
- case WINED3DFILL_POINT : glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); break;
- case WINED3DFILL_WIREFRAME : glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); break;
- case WINED3DFILL_SOLID : glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); break;
- default:
- FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
- }
- checkGLcall("glPolygonMode (fillmode)");
+ StateTable[STATE_RENDER(WINED3DRS_FILLMODE)].apply(STATE_RENDER(WINED3DRS_FILLMODE), This->stateBlock);
break;
case WINED3DRS_LIGHTING :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index f70cbd6..0c02195 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -55,6 +55,27 @@ static void state_undefined(DWORD state,
WARN("undefined state %d\n", state);
}
+static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+ D3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
+
+ switch(Value) {
+ case D3DFILL_POINT:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
+ checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
+ break;
+ case D3DFILL_WIREFRAME:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
+ break;
+ case D3DFILL_SOLID:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
+ break;
+ default:
+ FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
+ }
+}
+
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@@ -66,7 +87,7 @@ const struct StateEntry StateTable[] =
{ /* 5, WINED3DRS_WRAPU */ STATE_RENDER(WINED3DRS_WRAPU), state_unknown },
{ /* 6, WINED3DRS_WRAPV */ STATE_RENDER(WINED3DRS_WRAPV), state_unknown },
{ /* 7, WINED3DRS_ZENABLE */ STATE_RENDER(WINED3DRS_ZENABLE), state_unknown },
- { /* 8, WINED3DRS_FILLMODE */ STATE_RENDER(WINED3DRS_FILLMODE), state_unknown },
+ { /* 8, WINED3DRS_FILLMODE */ STATE_RENDER(WINED3DRS_FILLMODE), state_fillmode },
{ /* 9, WINED3DRS_SHADEMODE */ STATE_RENDER(WINED3DRS_SHADEMODE), state_unknown },
{ /* 10, WINED3DRS_LINEPATTERN */ STATE_RENDER(WINED3DRS_LINEPATTERN), state_unknown },
{ /* 11, WINED3DRS_MONOENABLE */ STATE_RENDER(WINED3DRS_MONOENABLE), state_unknown },
--
1.4.2.4
More information about the wine-patches
mailing list