Re: [Mesa-dev] [PATCH] msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.

2012-06-28 Thread Brian Paul

On 06/27/2012 05:51 PM, Paul Berry wrote:

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.
---
  src/mesa/drivers/common/meta.c |   17 -
  src/mesa/drivers/common/meta.h |1 +
  2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index be7141a..5e9d795 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -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,
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 7a80b1d..d8dfb56 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -55,6 +55,7 @@
  #define MESA_META_CONDITIONAL_RENDER0x2
  #define MESA_META_CLIP  0x4
  #define MESA_META_SELECT_FEEDBACK   0x8
+#define MESA_META_MULTISAMPLE  0x10
  /**\}*/

  extern void


Looks good.

Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.

2012-06-28 Thread Anuj Phogat
On Wed, Jun 27, 2012 at 4:51 PM, Paul Berry stereotype...@gmail.com wrote:
 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.
 ---
  src/mesa/drivers/common/meta.c |   17 -
  src/mesa/drivers/common/meta.h |    1 +
  2 files changed, 17 insertions(+), 1 deletions(-)

 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
 index be7141a..5e9d795 100644
 --- a/src/mesa/drivers/common/meta.c
 +++ b/src/mesa/drivers/common/meta.c
 @@ -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,
 diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
 index 7a80b1d..d8dfb56 100644
 --- a/src/mesa/drivers/common/meta.h
 +++ b/src/mesa/drivers/common/meta.h
 @@ -55,6 +55,7 @@
  #define MESA_META_CONDITIONAL_RENDER    0x2
  #define MESA_META_CLIP                  0x4
  #define MESA_META_SELECT_FEEDBACK       0x8
 +#define MESA_META_MULTISAMPLE          0x10
  /**\}*/

  extern void
 --
 1.7.7.6

Reviewed-by: Anuj Phogat anuj.pho...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] msaa: Make meta-ops save and restore state of GL_MULTISAMPLE.

2012-06-28 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/27/2012 04:51 PM, Paul Berry wrote:
 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. --- src/mesa/drivers/common/meta.c |   17
 - src/mesa/drivers/common/meta.h |1 + 2 files changed,
 17 insertions(+), 1 deletions(-)


Looks good.
Reviewed-by: Chad Versace chad.vers...@linux.intel.com




-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJP7NQXAAoJEAIvNt057x8iaO0QAJZafXu2AB2XCOVK+IHbWnxu
GqSHPGfMR1aWeX0RWd/QroVlI5udPyGLe7loZhHrZfyWiuoBashyQuZoJJP78Sfv
saiKZE6lpAKIweWOQCEvwQCHSuOpjPVjDYPEZdEoZAzB975ZUTc2Y6AE322+9v6k
0UglD/2fI++pAjq/YHaIHf0N6oB4tfWajSYq8jzkwy5lxGvFuJ+JOFHmgts1x7fl
fU7KX8zvK+97Trrg2enzsL1+PgducXAPmLjmWtGqoLIe44t1TNeKR8NDnl0mS0hD
sdxAFduIrK3etpo2WbGFu3Esll/jY3jTvP21lGiRopGXE10H49/g24oPg2HtlDMI
vXh9Xoj5QGbWCcaecaPEQBq9L1xsKfpteLXf/R5O6sSC+tISFcIGVstglxWKffiz
WhDueOs5KqVLu4vOWVA5dyjsVmpsSoi0Y9+YGFXQVTc9Fx9g+tUNwTMvL/kS0r+l
2vPhvDIo1egQWg3LomuvNKm5zhfZlmPWZ5I7T5JldSjgGqyMrfR6qDx7yzl9Ti2v
Li+g5eTsHm27aiecFPJoHZs45frlLnZY54kvbHmm1L+7J6vwgFbD5mzvftlPMC0P
2gkcKfD4Hd7EYFmTmSoq9aJUjP28rvQj+6fFLeRdw3i9WyRm/JgJYFzB/0GwWcki
BgbNahxhiQb4vFK4vEtk
=7mtJ
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev