wined3d: Store sampler states in the wined3d_stateblock_state structure.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-02-05 11:08:56 -06:00 committed by Alexandre Julliard
parent ac021bd39f
commit a07960b941
3 changed files with 15 additions and 12 deletions

View File

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

View File

@ -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];
state->sampler_states[stage][sampler_state] = value;
if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS;
wined3d_device_set_sampler_state(device, stage, 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,

View File

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