Zebediah Figura : wined3d: Implement OpenGL sample masks.

Alexandre Julliard julliard at winehq.org
Wed Sep 2 15:24:33 CDT 2020


Module: wine
Branch: master
Commit: d08ef1e2cacc0bbf4ee62dc3ed46638e059c2f97
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d08ef1e2cacc0bbf4ee62dc3ed46638e059c2f97

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Sep  2 00:27:43 2020 -0500

wined3d: Implement OpenGL sample masks.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d10core/tests/d3d10core.c |  2 +-
 dlls/d3d11/tests/d3d11.c         |  2 +-
 dlls/d3d9/tests/visual.c         |  2 +-
 dlls/wined3d/state.c             | 26 +++++++++++++++++++++++---
 4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c
index c3bb951ed8..deb6144a4b 100644
--- a/dlls/d3d10core/tests/d3d10core.c
+++ b/dlls/d3d10core/tests/d3d10core.c
@@ -17849,7 +17849,7 @@ static void test_sample_mask(void)
     draw_quad(&test_context);
     ID3D10Device_ResolveSubresource(device, (ID3D10Resource *)test_context.backbuffer, 0,
             (ID3D10Resource *)texture, 0, texture_desc.Format);
-    todo_wine check_texture_color(test_context.backbuffer, 0xbfbfbfbf, 1);
+    check_texture_color(test_context.backbuffer, 0xbfbfbfbf, 1);
 
     ID3D10RenderTargetView_Release(rtv);
     ID3D10Texture2D_Release(texture);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 4704dad1aa..5b9bb50a89 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -29017,7 +29017,7 @@ static void test_sample_mask(void)
     draw_quad(&test_context);
     ID3D11DeviceContext_ResolveSubresource(context, (ID3D11Resource *)test_context.backbuffer, 0,
             (ID3D11Resource *)texture, 0, texture_desc.Format);
-    todo_wine check_texture_color(test_context.backbuffer, 0x3f3f3f3f, 1);
+    check_texture_color(test_context.backbuffer, 0x3f3f3f3f, 1);
 
     ID3D11RenderTargetView_Release(rtv);
     ID3D11Texture2D_Release(texture);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index daf4a12b45..5218d8a202 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -26815,7 +26815,7 @@ static void test_sample_mask(void)
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
     get_rt_readback(rt, &rb);
     colour = get_readback_color(&rb, 64, 64);
-    todo_wine ok(color_match(colour, 0xffff8080, 1), "Got unexpected colour %08x.\n", colour);
+    ok(color_match(colour, 0xffff8080, 1), "Got unexpected colour %08x.\n", colour);
     release_surface_readback(&rb);
 
     hr = IDirect3DDevice9_EndScene(device);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 08b8aab546..51a24753c8 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1925,8 +1925,27 @@ static void state_antialias(struct wined3d_context *context, const struct wined3
 
 static void state_sample_mask(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
 {
-    if (state->sample_mask != 0xffffffff)
-        FIXME("Sample mask %#x not yet implemented.\n", state->sample_mask);
+    const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
+    unsigned int sample_mask = state->sample_mask;
+
+    TRACE("Setting sample mask to %#x.\n", sample_mask);
+    if (sample_mask != 0xffffffff)
+    {
+        gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_MASK);
+        checkGLcall("glEnable GL_SAMPLE_MASK");
+        GL_EXTCALL(glSampleMaski(0, sample_mask));
+        checkGLcall("glSampleMaski");
+    }
+    else
+    {
+        gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_MASK);
+        checkGLcall("glDisable GL_SAMPLE_MASK");
+    }
+}
+
+static void state_sample_mask_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
+{
+    WARN("Unsupported in local OpenGL implementation: glSampleMaski.\n");
 }
 
 static void state_patchedgestyle(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@@ -4603,7 +4622,8 @@ const struct wined3d_state_entry_template misc_state_template_gl[] =
     { STATE_BLEND,                                        { STATE_BLEND,                                        blend               }, WINED3D_GL_EXT_NONE             },
     { STATE_BLEND_FACTOR,                                 { STATE_BLEND_FACTOR,                                 state_blend_factor  }, EXT_BLEND_COLOR                 },
     { STATE_BLEND_FACTOR,                                 { STATE_BLEND_FACTOR,                                 state_blend_factor_w}, WINED3D_GL_EXT_NONE             },
-    { STATE_SAMPLE_MASK,                                  { STATE_SAMPLE_MASK,                                  state_sample_mask   }, WINED3D_GL_EXT_NONE             },
+    { STATE_SAMPLE_MASK,                                  { STATE_SAMPLE_MASK,                                  state_sample_mask   }, ARB_TEXTURE_MULTISAMPLE         },
+    { STATE_SAMPLE_MASK,                                  { STATE_SAMPLE_MASK,                                  state_sample_mask_w }, WINED3D_GL_EXT_NONE             },
     { STATE_STREAMSRC,                                    { STATE_STREAMSRC,                                    streamsrc           }, WINED3D_GL_EXT_NONE             },
     { STATE_VDECL,                                        { STATE_VDECL,                                        vdecl_miscpart      }, WINED3D_GL_EXT_NONE             },
     { STATE_RASTERIZER,                                   { STATE_RASTERIZER,                                   rasterizer_cc       }, ARB_CLIP_CONTROL                },




More information about the wine-cvs mailing list