[PATCH 1/5] wined3d: Only invalidate valid state IDs in wined3d_cs_exec_reset_state().

Henri Verbeet hverbeet at codeweavers.com
Fri Jun 25 08:01:28 CDT 2021


Not every state ID between 0 and STATE_HIGHEST is valid; for example, there
are holes in the renderstate IDs. While invalidating these works fine,
attempting to subsequently apply them in e.g. context_apply_draw_state() ends
up calling state_undefined() and printing an ERR. This is especially visible
when running the d2d1 tests.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/cs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 544b76534d0..492644e1f30 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2214,15 +2214,21 @@ static void wined3d_cs_mt_push_constants(struct wined3d_device_context *context,
 
 static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
 {
+    const struct wined3d_device *device = cs->c.device;
     const struct wined3d_cs_reset_state *op = data;
+    const struct wined3d_state_entry *state_table;
     unsigned int state;
 
     state_cleanup(&cs->state);
-    wined3d_state_reset(&cs->state, &cs->c.device->adapter->d3d_info);
+    wined3d_state_reset(&cs->state, &device->adapter->d3d_info);
     if (op->invalidate)
     {
+        state_table = device->state_table;
         for (state = 0; state <= STATE_HIGHEST; ++state)
-            device_invalidate_state(cs->c.device, state);
+        {
+            if (state_table[state].representative)
+                device_invalidate_state(device, state);
+        }
     }
 }
 
-- 
2.20.1




More information about the wine-devel mailing list