[PATCH 3/5] wined3d: Don't check for a "representative" in the MarkStateDirty() functions.

Henri Verbeet hverbeet at codeweavers.com
Fri Aug 21 02:12:28 CDT 2009


States without representative should never be called. Arguably they shouldn't
exist in the first place, but allowing them simplifies the state table.
---
 dlls/wined3d/context.c |    5 +++--
 dlls/wined3d/device.c  |    1 -
 dlls/wined3d/state.c   |    6 +-----
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index be40f04..c4cd436 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -794,7 +794,7 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state,
     DWORD idx;
     BYTE shift;
 
-    if(!rep || isStateDirty(context, rep)) return;
+    if (isStateDirty(context, rep)) return;
 
     context->dirtyArray[context->numDirtyEntries++] = rep;
     idx = rep >> 5;
@@ -851,7 +851,8 @@ static struct wined3d_context *AddContextToArray(IWineD3DDeviceImpl *This,
     /* Mark all states dirty to force a proper initialization of the states on the first use of the context
      */
     for(state = 0; state <= STATE_HIGHEST; state++) {
-        Context_MarkStateDirty(This->contexts[This->numContexts], state, This->StateTable);
+        if (This->StateTable[state].representative)
+            Context_MarkStateDirty(This->contexts[This->numContexts], state, This->StateTable);
     }
 
     This->numContexts++;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5d77931..75904ed 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -7686,7 +7686,6 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) {
     BYTE shift;
     UINT i;
 
-    if(!rep) return;
     for(i = 0; i < This->numContexts; i++) {
         context = This->contexts[i];
         if(isStateDirty(context, rep)) continue;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index a8394c1..97f1f79 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -56,11 +56,7 @@ static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w
 
 static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
 {
-    /* Print a WARN, this allows the stateblock code to loop over all states to generate a display
-     * list without causing confusing terminal output. Deliberately no special debug name here
-     * because its undefined.
-     */
-    WARN("undefined state %d\n", state);
+    ERR("Undefined state.\n");
 }
 
 static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
-- 
1.6.0.6




More information about the wine-patches mailing list