Module: wine Branch: master Commit: 0170bb0e548d33e4fa014b73cd2c75ce7ea0dc82 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0170bb0e548d33e4fa014b73c...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Jun 25 15:01:28 2021 +0200
wined3d: Only invalidate valid state IDs in wined3d_cs_exec_reset_state().
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@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 ad393c203c4..4adfa18f5f7 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); + } } }