Henri Verbeet : wined3d: Prune invalid states from the state table.

Alexandre Julliard julliard at winehq.org
Fri Jan 29 10:56:32 CST 2010


Module: wine
Branch: master
Commit: d66f5345e6857ae586117ef4d404c23c7f90272f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d66f5345e6857ae586117ef4d404c23c7f90272f

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jan 28 23:40:25 2010 +0100

wined3d: Prune invalid states from the state table.

---

 dlls/wined3d/state.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 17a6704..5384f3e 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5685,6 +5685,27 @@ static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock,
     stateblock->device->multistate_funcs[state][2](state, stateblock, context);
 }
 
+static void prune_invalid_states(struct StateEntry *state_table, const struct wined3d_gl_info *gl_info)
+{
+    unsigned int start, last, i;
+
+    start = STATE_TEXTURESTAGE(gl_info->limits.texture_stages, 0);
+    last = STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE);
+    for (i = start; i <= last; ++i)
+    {
+        state_table[i].representative = 0;
+        state_table[i].apply = state_undefined;
+    }
+
+    start = STATE_TRANSFORM(WINED3DTS_TEXTURE0 + gl_info->limits.texture_stages);
+    last = STATE_TRANSFORM(WINED3DTS_TEXTURE0 + MAX_TEXTURES - 1);
+    for (i = start; i <= last; ++i)
+    {
+        state_table[i].representative = 0;
+        state_table[i].apply = state_undefined;
+    }
+}
+
 static void validate_state_table(struct StateEntry *state_table)
 {
     unsigned int i;
@@ -5800,6 +5821,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
         }
     }
 
+    prune_invalid_states(StateTable, gl_info);
     validate_state_table(StateTable);
 
     return WINED3D_OK;




More information about the wine-cvs mailing list