[PATCH v2 2/2] wined3d: Move the color masks to wined3d_blend_state.

Zebediah Figura z.figura12 at gmail.com
Thu Mar 12 23:25:02 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
v2: Fix copy-paste error; thanks Chip.

 dlls/d3d10core/tests/d3d10core.c |   3 +-
 dlls/d3d11/device.c              |  28 +-------
 dlls/d3d11/state.c               |   5 +-
 dlls/d3d11/tests/d3d11.c         |   6 +-
 dlls/wined3d/context.c           |   8 +--
 dlls/wined3d/device.c            |  29 ++++++--
 dlls/wined3d/state.c             | 111 ++++++++-----------------------
 dlls/wined3d/surface.c           |   5 +-
 include/wine/wined3d.h           |   1 +
 9 files changed, 63 insertions(+), 133 deletions(-)

diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c
index 0aa998c6a6..e84b4a47b5 100644
--- a/dlls/d3d10core/tests/d3d10core.c
+++ b/dlls/d3d10core/tests/d3d10core.c
@@ -18164,8 +18164,7 @@ static void test_color_mask(void)
     {
         get_texture_readback(rts[i], 0, &rb);
         color = get_readback_color(&rb, 320, 240);
-        todo_wine_if (i >= 4)
-            ok(color == expected_colors[i], "%u: Got unexpected color 0x%08x.\n", i, color);
+        ok(color == expected_colors[i], "%u: Got unexpected color 0x%08x.\n", i, color);
         release_resource_readback(&rb);
 
         ID3D10Texture2D_Release(rts[i]);
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index ab52fb1311..4683ce5f3b 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -707,7 +707,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
     struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
     static const float default_blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f};
     struct d3d_blend_state *blend_state_impl;
-    const D3D11_BLEND_DESC *desc;
 
     TRACE("iface %p, blend_state %p, blend_factor %s, sample_mask 0x%08x.\n",
             iface, blend_state, debug_float4(blend_factor), sample_mask);
@@ -718,32 +717,11 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11Devi
     wined3d_mutex_lock();
     wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK, sample_mask);
     if (!(blend_state_impl = unsafe_impl_from_ID3D11BlendState(blend_state)))
-    {
         wined3d_device_set_blend_state(device->wined3d_device, NULL,
                 (const struct wined3d_color *)blend_factor);
-        wined3d_device_set_render_state(device->wined3d_device,
-                WINED3D_RS_COLORWRITEENABLE, D3D11_COLOR_WRITE_ENABLE_ALL);
-        wined3d_device_set_render_state(device->wined3d_device,
-                WINED3D_RS_COLORWRITEENABLE1, D3D11_COLOR_WRITE_ENABLE_ALL);
-        wined3d_device_set_render_state(device->wined3d_device,
-                WINED3D_RS_COLORWRITEENABLE2, D3D11_COLOR_WRITE_ENABLE_ALL);
-        wined3d_device_set_render_state(device->wined3d_device,
-                WINED3D_RS_COLORWRITEENABLE3, D3D11_COLOR_WRITE_ENABLE_ALL);
-        wined3d_mutex_unlock();
-        return;
-    }
-
-    wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state,
-            (const struct wined3d_color *)blend_factor);
-    desc = &blend_state_impl->desc;
-    wined3d_device_set_render_state(device->wined3d_device,
-            WINED3D_RS_COLORWRITEENABLE, desc->RenderTarget[0].RenderTargetWriteMask);
-    wined3d_device_set_render_state(device->wined3d_device,
-            WINED3D_RS_COLORWRITEENABLE1, desc->RenderTarget[1].RenderTargetWriteMask);
-    wined3d_device_set_render_state(device->wined3d_device,
-            WINED3D_RS_COLORWRITEENABLE2, desc->RenderTarget[2].RenderTargetWriteMask);
-    wined3d_device_set_render_state(device->wined3d_device,
-            WINED3D_RS_COLORWRITEENABLE3, desc->RenderTarget[3].RenderTargetWriteMask);
+    else
+        wined3d_device_set_blend_state(device->wined3d_device, blend_state_impl->wined3d_state,
+                (const struct wined3d_color *)blend_factor);
     wined3d_mutex_unlock();
 }
 
diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c
index 85ee67e272..d48d62e0a8 100644
--- a/dlls/d3d11/state.c
+++ b/dlls/d3d11/state.c
@@ -344,10 +344,6 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
             tmp_desc.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD;
         }
         tmp_desc.RenderTarget[i].RenderTargetWriteMask = desc->RenderTarget[j].RenderTargetWriteMask;
-
-        if (i > 3 && tmp_desc.RenderTarget[i].RenderTargetWriteMask != D3D11_COLOR_WRITE_ENABLE_ALL)
-            FIXME("Color mask %#x not supported for render target %u.\n",
-                    tmp_desc.RenderTarget[i].RenderTargetWriteMask, i);
     }
 
     wined3d_mutex_lock();
@@ -395,6 +391,7 @@ HRESULT d3d_blend_state_create(struct d3d_device *device, const D3D11_BLEND_DESC
         wined3d_desc.rt[i].src_alpha = desc->RenderTarget[i].SrcBlendAlpha;
         wined3d_desc.rt[i].dst_alpha = desc->RenderTarget[i].DestBlendAlpha;
         wined3d_desc.rt[i].op_alpha = desc->RenderTarget[i].BlendOpAlpha;
+        wined3d_desc.rt[i].writemask = desc->RenderTarget[i].RenderTargetWriteMask;
     }
 
     /* We cannot fail after creating a wined3d_blend_state object. It
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 60c6e92cd9..0a076ef67d 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -29820,8 +29820,7 @@ static void test_color_mask(void)
     {
         get_texture_readback(rts[i], 0, &rb);
         color = get_readback_color(&rb, 320, 240, 0);
-        todo_wine_if (i >= 4)
-            ok(color == expected_colors[i], "%u: Got unexpected color 0x%08x.\n", i, color);
+        ok(color == expected_colors[i], "%u: Got unexpected color 0x%08x.\n", i, color);
         release_resource_readback(&rb);
     }
 
@@ -29839,8 +29838,7 @@ static void test_color_mask(void)
     {
         get_texture_readback(rts[i], 0, &rb);
         color = get_readback_color(&rb, 320, 240, 0);
-        todo_wine_if (i >= 4)
-            ok(color == expected_colors[0], "%u: Got unexpected color 0x%08x.\n", i, color);
+        ok(color == expected_colors[0], "%u: Got unexpected color 0x%08x.\n", i, color);
         release_resource_readback(&rb);
 
         ID3D11Texture2D_Release(rts[i]);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index eda09d95af..e4f174b9f1 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3148,6 +3148,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl,
     gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
     context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZENABLE));
     gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
+    gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
     context_invalidate_state(context, STATE_BLEND);
     gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE);
     gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
@@ -3164,11 +3165,6 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl,
         gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
         context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE));
     }
-    gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3));
 
     context->last_was_rhw = TRUE;
     context_invalidate_state(context, STATE_VDECL); /* because of last_was_rhw = TRUE */
@@ -5158,7 +5154,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->render_states[WINED3D_RS_COLORWRITEENABLE])
+        if (!state->blend_state || state->blend_state->desc.rt[0].writemask)
         {
             wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding);
             wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 889aac0506..927c9456ec 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -437,10 +437,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
         }
 
         gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-        context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE));
-        context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1));
-        context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2));
-        context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3));
+        context_invalidate_state(context, STATE_BLEND);
         gl_info->gl_ops.gl.p_glClearColor(color->r, color->g, color->b, color->a);
         checkGLcall("glClearColor");
         clear_mask = clear_mask | GL_COLOR_BUFFER_BIT;
@@ -3589,6 +3586,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
                 case WINED3D_RS_SRCBLENDALPHA:
                 case WINED3D_RS_DESTBLENDALPHA:
                 case WINED3D_RS_BLENDOPALPHA:
+                case WINED3D_RS_COLORWRITEENABLE:
+                case WINED3D_RS_COLORWRITEENABLE1:
+                case WINED3D_RS_COLORWRITEENABLE2:
+                case WINED3D_RS_COLORWRITEENABLE3:
                     set_blend_state = TRUE;
                     break;
 
@@ -3676,6 +3677,26 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
             desc.rt[0].dst_alpha = state->rs[WINED3D_RS_DESTBLEND];
             desc.rt[0].op_alpha = state->rs[WINED3D_RS_BLENDOP];
         }
+        desc.rt[0].writemask = state->rs[WINED3D_RS_COLORWRITEENABLE];
+        desc.rt[1].writemask = state->rs[WINED3D_RS_COLORWRITEENABLE1];
+        desc.rt[2].writemask = state->rs[WINED3D_RS_COLORWRITEENABLE2];
+        desc.rt[3].writemask = state->rs[WINED3D_RS_COLORWRITEENABLE3];
+        if (desc.rt[1].writemask != desc.rt[0].writemask
+                || desc.rt[2].writemask != desc.rt[0].writemask
+                || desc.rt[3].writemask != desc.rt[0].writemask)
+        {
+            desc.independent = TRUE;
+            for (i = 1; i < 4; ++i)
+            {
+                desc.rt[i].enable = desc.rt[0].enable;
+                desc.rt[i].src = desc.rt[0].src;
+                desc.rt[i].dst = desc.rt[0].dst;
+                desc.rt[i].op = desc.rt[0].op;
+                desc.rt[i].src_alpha = desc.rt[0].src_alpha;
+                desc.rt[i].dst_alpha = desc.rt[0].dst_alpha;
+                desc.rt[i].op_alpha = desc.rt[0].op_alpha;
+            }
+        }
 
         if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_BLENDFACTOR))
             wined3d_color_from_d3dcolor(&colour, state->rs[WINED3D_RS_BLENDFACTOR]);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index ad3ce37501..6289317936 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -567,6 +567,7 @@ static void blend(struct wined3d_context *context, const struct wined3d_state *s
     const struct wined3d_blend_state *b = state->blend_state;
     const struct wined3d_format *rt_format;
     GLenum src_blend, dst_blend;
+    unsigned int mask;
 
     if (gl_info->supported[ARB_MULTISAMPLE])
     {
@@ -580,6 +581,14 @@ static void blend(struct wined3d_context *context, const struct wined3d_state *s
     if (b && b->desc.independent)
         WARN("Independent blend is not supported by this GL implementation.\n");
 
+    mask = b ? b->desc.rt[0].writemask : 0xf;
+
+    gl_info->gl_ops.gl.p_glColorMask(mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
+    checkGLcall("glColorMask");
+
     if (!b || !is_blend_enabled(context, state, 0))
     {
         gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
@@ -625,6 +634,16 @@ static void blend(struct wined3d_context *context, const struct wined3d_state *s
         context_apply_state(context, state, STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP));
 }
 
+static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DWORD mask)
+{
+    GL_EXTCALL(glColorMaski(index,
+            mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
+            mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE));
+    checkGLcall("glColorMaski");
+}
+
 static void blend_db2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
     const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
@@ -639,14 +658,7 @@ static void blend_db2(struct wined3d_context *context, const struct wined3d_stat
         gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
     checkGLcall("glEnable GL_SAMPLE_ALPHA_TO_COVERAGE");
 
-    if (!b)
-    {
-        gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
-        checkGLcall("glDisable GL_BLEND");
-        return;
-    }
-
-    if (!b->desc.independent)
+    if (!b || !b->desc.independent)
     {
         blend(context, state, state_id);
         return;
@@ -665,6 +677,8 @@ static void blend_db2(struct wined3d_context *context, const struct wined3d_stat
 
     for (i = 0; i < WINED3D_MAX_RENDER_TARGETS; ++i)
     {
+        set_color_mask(gl_info, i, b->desc.rt[i].writemask);
+
         if (!is_blend_enabled(context, state, i))
         {
             GL_EXTCALL(glDisablei(GL_BLEND, i));
@@ -702,14 +716,7 @@ static void blend_dbb(struct wined3d_context *context, const struct wined3d_stat
         gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
     checkGLcall("glEnable GL_SAMPLE_ALPHA_TO_COVERAGE");
 
-    if (!b)
-    {
-        gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
-        checkGLcall("glDisable GL_BLEND");
-        return;
-    }
-
-    if (!b->desc.independent)
+    if (!b || !b->desc.independent)
     {
         blend(context, state, state_id);
         return;
@@ -720,6 +727,8 @@ static void blend_dbb(struct wined3d_context *context, const struct wined3d_stat
         GLenum src_blend, dst_blend, src_blend_alpha, dst_blend_alpha;
         const struct wined3d_format *rt_format;
 
+        set_color_mask(gl_info, i, b->desc.rt[i].writemask);
+
         if (!is_blend_enabled(context, state, i))
         {
             GL_EXTCALL(glDisablei(GL_BLEND, i));
@@ -1653,64 +1662,6 @@ static void state_debug_monitor(struct wined3d_context *context, const struct wi
     WARN("token: %#x.\n", state->render_states[WINED3D_RS_DEBUGMONITORTOKEN]);
 }
 
-static void state_colorwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
-{
-    const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
-    DWORD mask0 = state->render_states[WINED3D_RS_COLORWRITEENABLE];
-    DWORD mask1 = state->render_states[WINED3D_RS_COLORWRITEENABLE1];
-    DWORD mask2 = state->render_states[WINED3D_RS_COLORWRITEENABLE2];
-    DWORD mask3 = state->render_states[WINED3D_RS_COLORWRITEENABLE3];
-
-    TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
-            mask0 & WINED3DCOLORWRITEENABLE_RED ? 1 : 0,
-            mask0 & WINED3DCOLORWRITEENABLE_GREEN ? 1 : 0,
-            mask0 & WINED3DCOLORWRITEENABLE_BLUE ? 1 : 0,
-            mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
-    gl_info->gl_ops.gl.p_glColorMask(mask0 & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
-            mask0 & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
-            mask0 & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
-            mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
-    checkGLcall("glColorMask(...)");
-
-    if (!((mask1 == mask0 && mask2 == mask0 && mask3 == mask0)
-        || (mask1 == 0xf && mask2 == 0xf && mask3 == 0xf)))
-    {
-        FIXME("WINED3D_RS_COLORWRITEENABLE/1/2/3, %#x/%#x/%#x/%#x not yet implemented.\n",
-            mask0, mask1, mask2, mask3);
-        FIXME("Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n");
-    }
-}
-
-static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DWORD mask)
-{
-    GL_EXTCALL(glColorMaski(index,
-            mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
-            mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
-            mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
-            mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE));
-    checkGLcall("glColorMaski");
-}
-
-static void state_colorwrite0(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
-{
-    set_color_mask(wined3d_context_gl(context)->gl_info, 0, state->render_states[WINED3D_RS_COLORWRITEENABLE]);
-}
-
-static void state_colorwrite1(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
-{
-    set_color_mask(wined3d_context_gl(context)->gl_info, 1, state->render_states[WINED3D_RS_COLORWRITEENABLE1]);
-}
-
-static void state_colorwrite2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
-{
-    set_color_mask(wined3d_context_gl(context)->gl_info, 2, state->render_states[WINED3D_RS_COLORWRITEENABLE2]);
-}
-
-static void state_colorwrite3(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
-{
-    set_color_mask(wined3d_context_gl(context)->gl_info, 3, state->render_states[WINED3D_RS_COLORWRITEENABLE3]);
-}
-
 static void state_localviewer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
     const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
@@ -4766,14 +4717,6 @@ const struct wined3d_state_entry_template misc_state_template[] =
     { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS),      { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS),      state_msaa_w        }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK),           { STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK),           state_multisampmask }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN),         { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN),         state_debug_monitor }, WINED3D_GL_EXT_NONE             },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          state_colorwrite0   }, EXT_DRAW_BUFFERS2               },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          state_colorwrite    }, WINED3D_GL_EXT_NONE             },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1),         state_colorwrite1   }, EXT_DRAW_BUFFERS2               },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          NULL                }, WINED3D_GL_EXT_NONE             },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2),         state_colorwrite2   }, EXT_DRAW_BUFFERS2               },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          NULL                }, WINED3D_GL_EXT_NONE             },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3),         state_colorwrite3   }, EXT_DRAW_BUFFERS2               },
-    { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3),         { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE),          NULL                }, WINED3D_GL_EXT_NONE             },
     { STATE_RENDER(WINED3D_RS_ZVISIBLE),                  { STATE_RENDER(WINED3D_RS_ZVISIBLE),                  state_zvisible      }, WINED3D_GL_EXT_NONE             },
     /* Samplers */
     { STATE_SAMPLER(0),                                   { STATE_SAMPLER(0),                                   sampler             }, WINED3D_GL_EXT_NONE             },
@@ -5538,10 +5481,10 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
         { 47,  47},
         { 61, 127},
         {149, 150},
-        {169, 169},
+        {168, 169},
         {171, 171},
         {174, 177},
-        {193, 193},
+        {190, 193},
         {195, 197},
         {206, 209},
         {  0,   0},
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b7dd54cb61..3745d8dde7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -259,10 +259,7 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
     context_invalidate_state(context, STATE_FRAMEBUFFER);
 
     gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2));
-    context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3));
+    context_invalidate_state(context, STATE_BLEND);
 
     gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
     context_invalidate_state(context, STATE_RASTERIZER);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 16800a8e40..0dd09f4a3f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2040,6 +2040,7 @@ struct wined3d_blend_state_desc
         enum wined3d_blend src_alpha;
         enum wined3d_blend dst_alpha;
         enum wined3d_blend_op op_alpha;
+        unsigned int writemask;
     } rt[WINED3D_MAX_RENDER_TARGETS];
 };
 
-- 
2.25.1




More information about the wine-devel mailing list