Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 8 +++----- dlls/wined3d/stateblock.c | 18 +++++++++++------- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 043c89e129..72e328f630 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2076,8 +2076,6 @@ DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value) { - DWORD old_value; - TRACE("device %p, sampler_idx %u, state %s, value %#x.\n", device, sampler_idx, debug_d3dsamplerstate(state), value);
@@ -2090,8 +2088,7 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, return; /* Windows accepts overflowing this array ... we do not. */ }
- old_value = device->state.sampler_states[sampler_idx][state]; - device->update_state->sampler_states[sampler_idx][state] = value; + device->update_stateblock_state->sampler_states[sampler_idx][state] = value;
/* Handle recording of state blocks. */ if (device->recording) @@ -2101,12 +2098,13 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, return; }
- if (old_value == value) + if (value == device->state.sampler_states[sampler_idx][state]) { TRACE("Application is setting the old value over, nothing to do.\n"); return; }
+ device->state.sampler_states[sampler_idx][state] = value; wined3d_cs_emit_set_sampler_state(device->cs, sampler_idx, state, value); }
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 458e8b35d3..e6e68b428b 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -964,12 +964,13 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_sampler_states; ++i) { DWORD stage = stateblock->contained_sampler_states[i].stage; - DWORD state = stateblock->contained_sampler_states[i].state; + DWORD sampler_state = stateblock->contained_sampler_states[i].state;
- TRACE("Updating sampler state %u, %u to %#x (was %#x).\n", stage, state, - src_state->sampler_states[stage][state], stateblock->state.sampler_states[stage][state]); + TRACE("Updating sampler state %u, %u to %#x (was %#x).\n", stage, sampler_state, + state->sampler_states[stage][sampler_state], + stateblock->stateblock_state.sampler_states[stage][sampler_state]);
- stateblock->state.sampler_states[stage][state] = src_state->sampler_states[stage][state]; + stateblock->stateblock_state.sampler_states[stage][sampler_state] = state->sampler_states[stage][sampler_state]; }
if (stateblock->changed.pixelShader && stateblock->stateblock_state.ps != state->ps) @@ -1098,11 +1099,12 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) for (i = 0; i < stateblock->num_contained_sampler_states; ++i) { DWORD stage = stateblock->contained_sampler_states[i].stage; - DWORD state = stateblock->contained_sampler_states[i].state; - DWORD value = stateblock->state.sampler_states[stage][state]; + DWORD sampler_state = stateblock->contained_sampler_states[i].state; + DWORD value = stateblock->stateblock_state.sampler_states[stage][sampler_state];
if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS; - wined3d_device_set_sampler_state(device, stage, state, value); + state->sampler_states[stage][sampler_state] = value; + wined3d_device_set_sampler_state(device, stage, sampler_state, value); }
/* Transform states. */ @@ -1430,6 +1432,8 @@ static void stateblock_state_init_default(struct wined3d_stateblock_state *state { init_default_texture_state(i, state->texture_states[i]); } + + init_default_sampler_states(state->sampler_states); }
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 269c095ab4..1a461c0dec 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2983,6 +2983,7 @@ struct wined3d_stateblock_state DWORD rs[WINEHIGHEST_RENDER_STATE + 1];
struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS]; + DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; };