wined3d: Implement OpenGL sample masks.

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-09-02 00:27:43 -05:00 committed by Alexandre Julliard
parent 21017243b8
commit d08ef1e2ca
4 changed files with 26 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 },