[Mesa-dev] [PATCH 01/24] st/mesa: check correctly if multisampling is enabled

Marek Olšák maraeo at gmail.com
Mon Jun 12 18:18:32 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/state_tracker/st_atom_blend.c | 4 ++--
 src/mesa/state_tracker/st_atom_msaa.c  | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 85edf05..c0876b8 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -32,20 +32,21 @@
   */
  
 
 #include "st_context.h"
 #include "st_atom.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "cso_cache/cso_context.h"
 
+#include "framebuffer.h"
 #include "main/macros.h"
 
 /**
  * Convert GLenum blend tokens to pipe tokens.
  * Both blend factors and blend funcs are accepted.
  */
 static GLuint
 translate_blend(GLenum blend)
 {
    switch (blend) {
@@ -258,22 +259,21 @@ st_update_blend( struct st_context *st )
       if (ctx->Color.ColorMask[i][1])
          blend->rt[i].colormask |= PIPE_MASK_G;
       if (ctx->Color.ColorMask[i][2])
          blend->rt[i].colormask |= PIPE_MASK_B;
       if (ctx->Color.ColorMask[i][3])
          blend->rt[i].colormask |= PIPE_MASK_A;
    }
 
    blend->dither = ctx->Color.DitherFlag;
 
-   if (ctx->Multisample.Enabled &&
-       ctx->DrawBuffer->Visual.sampleBuffers > 0 &&
+   if (_mesa_is_multisample_enabled(ctx) &&
        !(ctx->DrawBuffer->_IntegerBuffers & 0x1)) {
       /* Unlike in gallium/d3d10 these operations are only performed
        * if both msaa is enabled and we have a multisample buffer.
        */
       blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage;
       blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne;
    }
 
    if (st->has_srgb_enable && ctx->Color.sRGBEnabled)
       blend->srgb_enable = st->state.fb_srgb_buffers;
diff --git a/src/mesa/state_tracker/st_atom_msaa.c b/src/mesa/state_tracker/st_atom_msaa.c
index dd06517..0bdb9b2 100644
--- a/src/mesa/state_tracker/st_atom_msaa.c
+++ b/src/mesa/state_tracker/st_atom_msaa.c
@@ -26,30 +26,31 @@
  **************************************************************************/
 
 
 #include "st_context.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 #include "st_atom.h"
 #include "st_program.h"
 
 #include "cso_cache/cso_context.h"
+#include "main/framebuffer.h"
 
 
 /* Update the sample mask for MSAA.
  */
 void st_update_sample_mask( struct st_context *st )
 {
    unsigned sample_mask = 0xffffffff;
    unsigned sample_count = st->state.fb_num_samples;
 
-   if (st->ctx->Multisample.Enabled && sample_count > 1) {
+   if (_mesa_is_multisample_enabled(st->ctx) && sample_count > 1) {
       /* unlike in gallium/d3d10 the mask is only active if msaa is enabled */
       if (st->ctx->Multisample.SampleCoverage) {
          unsigned nr_bits;
          nr_bits = (unsigned)
             (st->ctx->Multisample.SampleCoverageValue * (float)sample_count);
          /* there's lot of ways how to do this. We just use first few bits,
             since we have no knowledge of sample positions here. When
             app-supplied mask though is used too might need to be smarter.
             Also, there's an interface restriction here in theory it is
             encouraged this mask not be the same at each pixel. */
-- 
2.7.4



More information about the mesa-dev mailing list