Commit dfc7807c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Store texture states in the wined3d_stateblock_state structure.

parent ba4dfabe
...@@ -3431,7 +3431,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, ...@@ -3431,7 +3431,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
UINT stage, enum wined3d_texture_stage_state state, DWORD value) UINT stage, enum wined3d_texture_stage_state state, DWORD value)
{ {
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info; const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
DWORD old_value;
TRACE("device %p, stage %u, state %s, value %#x.\n", TRACE("device %p, stage %u, state %s, value %#x.\n",
device, stage, debug_d3dtexturestate(state), value); device, stage, debug_d3dtexturestate(state), value);
...@@ -3449,8 +3448,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, ...@@ -3449,8 +3448,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
return; return;
} }
old_value = device->update_state->texture_states[stage][state]; device->update_stateblock_state->texture_states[stage][state] = value;
device->update_state->texture_states[stage][state] = value;
if (device->recording) if (device->recording)
{ {
...@@ -3459,13 +3457,14 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, ...@@ -3459,13 +3457,14 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
return; return;
} }
/* Checked after the assignments to allow proper stateblock recording. */ if (value == device->state.texture_states[stage][state])
if (old_value == value)
{ {
TRACE("Application is setting the old value over, nothing to do.\n"); TRACE("Application is setting the old value over, nothing to do.\n");
return; return;
} }
device->state.texture_states[stage][state] = value;
wined3d_cs_emit_set_texture_state(device->cs, stage, state, value); wined3d_cs_emit_set_texture_state(device->cs, stage, state, value);
} }
......
...@@ -925,12 +925,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) ...@@ -925,12 +925,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_tss_states; ++i) for (i = 0; i < stateblock->num_contained_tss_states; ++i)
{ {
DWORD stage = stateblock->contained_tss_states[i].stage; DWORD stage = stateblock->contained_tss_states[i].stage;
DWORD state = stateblock->contained_tss_states[i].state; DWORD texture_state = stateblock->contained_tss_states[i].state;
TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, state, TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, texture_state,
src_state->texture_states[stage][state], stateblock->state.texture_states[stage][state]); state->texture_states[stage][texture_state],
stateblock->stateblock_state.texture_states[stage][texture_state]);
stateblock->state.texture_states[stage][state] = src_state->texture_states[stage][state]; stateblock->stateblock_state.texture_states[stage][texture_state] = state->texture_states[stage][texture_state];
} }
/* Samplers */ /* Samplers */
...@@ -1075,9 +1076,11 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) ...@@ -1075,9 +1076,11 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_tss_states; ++i) for (i = 0; i < stateblock->num_contained_tss_states; ++i)
{ {
DWORD stage = stateblock->contained_tss_states[i].stage; DWORD stage = stateblock->contained_tss_states[i].stage;
DWORD state = stateblock->contained_tss_states[i].state; DWORD texture_state = stateblock->contained_tss_states[i].state;
wined3d_device_set_texture_stage_state(device, stage, state, stateblock->state.texture_states[stage][state]); state->texture_states[stage][texture_state] = stateblock->stateblock_state.texture_states[stage][texture_state];
wined3d_device_set_texture_stage_state(device, stage, texture_state,
stateblock->stateblock_state.texture_states[stage][texture_state]);
} }
/* Sampler states. */ /* Sampler states. */
...@@ -1396,7 +1399,14 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, ...@@ -1396,7 +1399,14 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
static void stateblock_state_init_default(struct wined3d_stateblock_state *state, static void stateblock_state_init_default(struct wined3d_stateblock_state *state,
const struct wined3d_d3d_info *d3d_info) const struct wined3d_d3d_info *d3d_info)
{ {
unsigned int i;
init_default_render_states(state->rs, d3d_info); init_default_render_states(state->rs, d3d_info);
for (i = 0; i < MAX_TEXTURES; ++i)
{
init_default_texture_state(i, state->texture_states[i]);
}
} }
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
......
...@@ -2981,6 +2981,8 @@ struct wined3d_stateblock_state ...@@ -2981,6 +2981,8 @@ struct wined3d_stateblock_state
BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; BOOL ps_consts_b[WINED3D_MAX_CONSTS_B];
DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; DWORD rs[WINEHIGHEST_RENDER_STATE + 1];
DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
}; };
struct wined3d_device struct wined3d_device
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment