wined3d: Introduce wined3d_device_context_set_blend_state().

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 2021-03-09 20:09:00 -06:00 committed by Alexandre Julliard
parent 906568e093
commit cd17163265
3 changed files with 28 additions and 16 deletions

View File

@ -1740,25 +1740,10 @@ static void resolve_depth_buffer(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, unsigned int sample_mask)
{
struct wined3d_state *state = device->cs->c.state;
struct wined3d_blend_state *prev;
TRACE("device %p, blend_state %p, blend_factor %s, sample_mask %#x.\n",
device, blend_state, debug_color(blend_factor), sample_mask);
prev = state->blend_state;
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
&& sample_mask == state->sample_mask)
return;
if (blend_state)
wined3d_blend_state_incref(blend_state);
state->blend_state = blend_state;
state->blend_factor = *blend_factor;
state->sample_mask = sample_mask;
wined3d_device_context_emit_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask);
if (prev)
wined3d_blend_state_decref(prev);
wined3d_device_context_set_blend_state(&device->cs->c, blend_state, blend_factor, sample_mask);
}
struct wined3d_blend_state * CDECL wined3d_device_get_blend_state(const struct wined3d_device *device,
@ -2133,6 +2118,30 @@ void CDECL wined3d_device_context_set_constant_buffer(struct wined3d_device_cont
wined3d_buffer_decref(prev);
}
void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *blend_state, const struct wined3d_color *blend_factor, unsigned int sample_mask)
{
struct wined3d_state *state = context->state;
struct wined3d_blend_state *prev;
TRACE("context %p, blend_state %p, blend_factor %p, sample_mask %#x.\n",
context, blend_state, blend_factor, sample_mask);
prev = state->blend_state;
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
&& sample_mask == state->sample_mask)
return;
if (blend_state)
wined3d_blend_state_incref(blend_state);
state->blend_state = blend_state;
state->blend_factor = *blend_factor;
state->sample_mask = sample_mask;
wined3d_device_context_emit_set_blend_state(context, blend_state, blend_factor, sample_mask);
if (prev)
wined3d_blend_state_decref(prev);
}
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
TRACE("device %p, shader %p.\n", device, shader);

View File

@ -167,6 +167,7 @@
@ cdecl wined3d_device_update_texture(ptr ptr ptr)
@ cdecl wined3d_device_validate_device(ptr ptr)
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
@ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
@ cdecl wined3d_device_context_set_shader(ptr long ptr)

View File

@ -2549,6 +2549,8 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture);
HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask);
void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer);
void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *context,