wined3d: Check the writemask for the correct render target in draw_primitive().

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 2020-03-15 23:42:07 -05:00 committed by Alexandre Julliard
parent 980a060949
commit 998d901f0d
1 changed files with 10 additions and 1 deletions

View File

@ -5105,6 +5105,15 @@ static GLenum gl_tfb_primitive_type_from_d3d(enum wined3d_primitive_type primiti
}
}
static unsigned int get_render_target_writemask(const struct wined3d_blend_state *state, unsigned int index)
{
if (!state)
return 0xf;
if (!state->desc.independent)
index = 0;
return state->desc.rt[index].writemask;
}
/* Routine common to the draw primitive and draw indexed primitive routines */
void draw_primitive(struct wined3d_device *device, const struct wined3d_state *state,
const struct wined3d_draw_parameters *parameters)
@ -5154,7 +5163,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (!(rtv = fb->render_targets[i]) || rtv->format->id == WINED3DFMT_NULL)
continue;
if (!state->blend_state || state->blend_state->desc.rt[0].writemask)
if (get_render_target_writemask(state->blend_state, i))
{
wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding);
wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding);