wined3d: Store blend factor 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:
parent
61cc88675f
commit
44441feb3e
|
@ -1991,13 +1991,17 @@ static void resolve_depth_buffer(struct wined3d_device *device)
|
||||||
void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
|
void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
|
||||||
struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor)
|
struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor)
|
||||||
{
|
{
|
||||||
struct wined3d_state *state = device->update_state;
|
struct wined3d_state *state = &device->state;
|
||||||
struct wined3d_blend_state *prev;
|
struct wined3d_blend_state *prev;
|
||||||
|
|
||||||
TRACE("device %p, blend_state %p, blend_factor %s.\n", device, blend_state, debug_color(blend_factor));
|
TRACE("device %p, blend_state %p, blend_factor %s.\n", device, blend_state, debug_color(blend_factor));
|
||||||
|
|
||||||
|
device->update_stateblock_state->blend_factor = *blend_factor;
|
||||||
if (device->recording)
|
if (device->recording)
|
||||||
|
{
|
||||||
device->recording->changed.blend_state = TRUE;
|
device->recording->changed.blend_state = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
prev = state->blend_state;
|
prev = state->blend_state;
|
||||||
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor)))
|
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor)))
|
||||||
|
@ -2007,8 +2011,7 @@ void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
|
||||||
wined3d_blend_state_incref(blend_state);
|
wined3d_blend_state_incref(blend_state);
|
||||||
state->blend_state = blend_state;
|
state->blend_state = blend_state;
|
||||||
state->blend_factor = *blend_factor;
|
state->blend_factor = *blend_factor;
|
||||||
if (!device->recording)
|
wined3d_cs_emit_set_blend_state(device->cs, blend_state, blend_factor);
|
||||||
wined3d_cs_emit_set_blend_state(device->cs, blend_state, blend_factor);
|
|
||||||
if (prev)
|
if (prev)
|
||||||
wined3d_blend_state_decref(prev);
|
wined3d_blend_state_decref(prev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -859,18 +859,12 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateblock->changed.blend_state
|
if (stateblock->changed.blend_state
|
||||||
&& (src_state->blend_state != stateblock->state.blend_state
|
&& memcmp(&state->blend_factor, &stateblock->stateblock_state.blend_factor,
|
||||||
|| memcmp(&src_state->blend_factor, &stateblock->state.blend_factor,
|
sizeof(stateblock->stateblock_state.blend_factor)))
|
||||||
sizeof(stateblock->state.blend_factor))))
|
|
||||||
{
|
{
|
||||||
TRACE("Updating blend state.\n");
|
TRACE("Updating blend factor.\n");
|
||||||
|
|
||||||
if (src_state->blend_state)
|
stateblock->stateblock_state.blend_factor = state->blend_factor;
|
||||||
wined3d_blend_state_incref(src_state->blend_state);
|
|
||||||
if (stateblock->state.blend_state)
|
|
||||||
wined3d_blend_state_decref(stateblock->state.blend_state);
|
|
||||||
stateblock->state.blend_state = src_state->blend_state;
|
|
||||||
stateblock->state.blend_factor = src_state->blend_factor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
map = stateblock->changed.streamSource;
|
map = stateblock->changed.streamSource;
|
||||||
|
@ -1162,7 +1156,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateblock->changed.blend_state)
|
if (stateblock->changed.blend_state)
|
||||||
wined3d_device_set_blend_state(device, stateblock->state.blend_state, &stateblock->state.blend_factor);
|
{
|
||||||
|
state->blend_factor = stateblock->stateblock_state.blend_factor;
|
||||||
|
wined3d_device_set_blend_state(device, NULL, &stateblock->stateblock_state.blend_factor);
|
||||||
|
}
|
||||||
|
|
||||||
map = stateblock->changed.streamSource;
|
map = stateblock->changed.streamSource;
|
||||||
for (i = 0; map; map >>= 1, ++i)
|
for (i = 0; map; map >>= 1, ++i)
|
||||||
|
@ -1473,6 +1470,11 @@ static void stateblock_state_init_default(struct wined3d_stateblock_state *state
|
||||||
}
|
}
|
||||||
|
|
||||||
init_default_sampler_states(state->sampler_states);
|
init_default_sampler_states(state->sampler_states);
|
||||||
|
|
||||||
|
state->blend_factor.r = 1.0f;
|
||||||
|
state->blend_factor.g = 1.0f;
|
||||||
|
state->blend_factor.b = 1.0f;
|
||||||
|
state->blend_factor.a = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
|
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
|
||||||
|
|
|
@ -2986,6 +2986,7 @@ 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];
|
||||||
|
struct wined3d_color blend_factor;
|
||||||
|
|
||||||
struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS];
|
struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS];
|
||||||
DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
|
DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
|
||||||
|
|
Loading…
Reference in New Issue