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>
This commit is contained in:
Henri Verbeet 2021-06-25 15:01:28 +02:00 committed by Alexandre Julliard
parent 556121b1ca
commit 0170bb0e54
1 changed files with 8 additions and 2 deletions

View File

@ -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);
}
}
}