Signed-off-by: Paul Gofman gofmanp@gmail.com --- v2: - combine state_blend_object() and state_alpha_to_coverage() to avoid conflicts.
dlls/d3d9/tests/visual.c | 2 +- dlls/wined3d/glsl_shader.c | 2 ++ dlls/wined3d/state.c | 25 ++++++++++++++++++++++--- dlls/wined3d/wined3d_private.h | 8 +++++++- 4 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 859f3e5f1f..b4991d4e5e 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -27100,7 +27100,7 @@ static void test_alpha_to_coverage(void) colour = get_readback_color(&rb, 64, 64);
/* Nvidia is probably using some proprietary algorithm for averaging sample colour values. */ - todo_wine ok(color_match(colour, 0x9f404080, 1) || color_match(colour, 0x9f485cbc, 1) /* Nvidia */, + ok(color_match(colour, 0x9f404080, 1) || color_match(colour, 0x9f485cbc, 1) /* Nvidia */, "Got unexpected colour %08x.\n", colour); release_surface_readback(&rb);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index cc7afe5165..4ec882d112 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -12173,6 +12173,8 @@ static void glsl_vertex_pipe_pointsize(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE; + + state_atoc(context, state, state_id); }
static void glsl_vertex_pipe_pointscale(struct wined3d_context *context, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 87e1ca4bac..856a4c9867 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -613,10 +613,10 @@ static void state_blend_factor(struct wined3d_context *context, const struct win checkGLcall("glBlendColor"); }
-static void state_blend_object(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +void state_atoc(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; - BOOL alpha_to_coverage = FALSE; + BOOL alpha_to_coverage;
if (!gl_info->supported[ARB_MULTISAMPLE]) return; @@ -626,6 +626,23 @@ static void state_blend_object(struct wined3d_context *context, const struct win struct wined3d_blend_state_desc *desc = &state->blend_state->desc; alpha_to_coverage = desc->alpha_to_coverage; } + else + { + if (context->amd_atoc_enabled + && state->render_states[WINED3D_RS_POINTSIZE] != WINED3D_ALPHA_TO_COVERAGE_DISABLE) + return; + + if (state->render_states[WINED3D_RS_POINTSIZE] == WINED3D_ALPHA_TO_COVERAGE_ENABLE) + { + alpha_to_coverage = TRUE; + context->amd_atoc_enabled = 1; + } + else + { + alpha_to_coverage = FALSE; + context->amd_atoc_enabled = 0; + } + }
if (alpha_to_coverage) gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); @@ -1532,6 +1549,8 @@ static void state_pscale(struct wined3d_context *context, const struct wined3d_s
gl_info->gl_ops.gl.p_glPointSize(max(pointsize, FLT_MIN)); checkGLcall("glPointSize(...);"); + + state_atoc(context, state, state_id); }
static void state_debug_monitor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -4520,7 +4539,7 @@ const struct wined3d_state_entry_template misc_state_template[] = { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_BLENDOPALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, - { STATE_BLEND, { STATE_BLEND, state_blend_object }, WINED3D_GL_EXT_NONE }, + { STATE_BLEND, { STATE_BLEND, state_atoc }, 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_STREAMSRC, { STATE_STREAMSRC, streamsrc }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3b9b342441..dddf3e120a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -76,6 +76,9 @@
#define WINED3D_MAX_DIRTY_REGION_COUNT 7
+#define WINED3D_ALPHA_TO_COVERAGE_ENABLE MAKEFOURCC('A','2','M','1') +#define WINED3D_ALPHA_TO_COVERAGE_DISABLE MAKEFOURCC('A','2','M','0') + struct wined3d_fragment_pipe_ops; struct wined3d_adapter; struct wined3d_context; @@ -1974,7 +1977,8 @@ struct wined3d_context DWORD destroyed : 1; DWORD destroy_delayed : 1; DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ - DWORD padding : 14; + DWORD amd_atoc_enabled : 1; + DWORD padding : 13;
DWORD constant_update_mask; DWORD numbered_array_mask; @@ -4608,6 +4612,8 @@ void state_pointsprite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; void state_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; +void state_atoc(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) DECLSPEC_HIDDEN; enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_type) DECLSPEC_HIDDEN;