msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.

The meta-ops _mesa_meta_Clear() and _mesa_meta_glsl_Clear() need to
ignore the state of GL_SAMPLE_ALPHA_TO_COVERAGE,
GL_SAMPLE_ALPHA_TO_ONE, GL_SAMPLE_COVERAGE, GL_SAMPLE_COVERAGE_VALUE,
and GL_SAMPLE_COVERAGE_INVERT when clearing multisampled buffers.  The
easiest way to accomplish this is to disable GL_MULTISAMPLE during the
clear meta-ops.

Note: this patch also causes GL_MULTISAMPLE to be disabled during
_mesa_meta_GenerateMipmap() and _mesa_meta_GetTexImage() (since those
two meta-ops use MESA_META_ALL).  Arguably this isn't strictly
necessary, since those meta-ops use their own non-MSAA fbo's, but it
shouldn't do any harm.

Fixes Piglit tests "EXT_framebuffer_multisample/clear {2,4}
{color,stencil}" on i965.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
This commit is contained in:
Paul Berry 2012-06-27 16:16:26 -07:00
parent 8313f44409
commit f34764ea53
2 changed files with 17 additions and 1 deletions

View file

@ -181,6 +181,9 @@ struct save_state
struct gl_feedback Feedback;
#endif
/** MESA_META_MULTISAMPLE */
GLboolean MultisampleEnabled;
/** Miscellaneous (always disabled) */
GLboolean Lighting;
GLboolean RasterDiscard;
@ -733,6 +736,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
}
#endif
if (state & MESA_META_MULTISAMPLE) {
save->MultisampleEnabled = ctx->Multisample.Enabled;
if (ctx->Multisample.Enabled)
_mesa_set_enable(ctx, GL_MULTISAMPLE, GL_FALSE);
}
/* misc */
{
save->Lighting = ctx->Light.Enabled;
@ -1018,6 +1027,11 @@ _mesa_meta_end(struct gl_context *ctx)
}
#endif
if (state & MESA_META_MULTISAMPLE) {
if (ctx->Multisample.Enabled != save->MultisampleEnabled)
_mesa_set_enable(ctx, GL_MULTISAMPLE, save->MultisampleEnabled);
}
/* misc */
if (save->Lighting) {
_mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
@ -1902,7 +1916,8 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
MESA_META_VERTEX |
MESA_META_VIEWPORT |
MESA_META_CLIP |
MESA_META_CLAMP_FRAGMENT_COLOR);
MESA_META_CLAMP_FRAGMENT_COLOR |
MESA_META_MULTISAMPLE);
if (!(buffers & BUFFER_BITS_COLOR)) {
/* We'll use colormask to disable color writes. Otherwise,

View file

@ -55,6 +55,7 @@
#define MESA_META_CONDITIONAL_RENDER 0x20000
#define MESA_META_CLIP 0x40000
#define MESA_META_SELECT_FEEDBACK 0x80000
#define MESA_META_MULTISAMPLE 0x100000
/**\}*/
extern void