[Mesa-dev] [PATCH 1/2] gallium/u_blitter: add code to save/set/restore min_samples for msaa

Brian Paul brianp at vmware.com
Mon Dec 11 20:09:36 UTC 2017


Will be used by the next patch.
---
 src/gallium/auxiliary/util/u_blitter.c |  8 ++++++++
 src/gallium/auxiliary/util/u_blitter.h | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 476ef08..371daf1 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -646,6 +646,12 @@ void util_blitter_restore_fragment_states(struct blitter_context *blitter)
       ctx->base.is_sample_mask_saved = false;
    }
 
+   /* Min samples. */
+   if (ctx->base.is_min_samples_saved) {
+      pipe->set_min_samples(pipe, ctx->base.saved_min_samples);
+      ctx->base.is_min_samples_saved = false;
+   }
+
    /* Miscellaneous states. */
    /* XXX check whether these are saved and whether they need to be restored
     * (depending on the operation) */
@@ -1675,6 +1681,8 @@ static void do_blits(struct blitter_context_priv *ctx,
 
    blitter_set_dst_dimensions(ctx, fb_state.width, fb_state.height);
 
+   pipe->set_min_samples(pipe, 1);
+
    if ((src_target == PIPE_TEXTURE_1D ||
         src_target == PIPE_TEXTURE_2D ||
         src_target == PIPE_TEXTURE_RECT) &&
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index dba7739..251cd9b 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -117,6 +117,9 @@ struct blitter_context
    bool is_sample_mask_saved;
    unsigned saved_sample_mask;
 
+   bool is_min_samples_saved;
+   unsigned saved_min_samples;
+
    unsigned saved_num_sampler_states;
    void *saved_sampler_states[PIPE_MAX_SAMPLERS];
 
@@ -546,6 +549,14 @@ util_blitter_save_sample_mask(struct blitter_context *blitter,
 }
 
 static inline void
+util_blitter_save_min_samples(struct blitter_context *blitter,
+                              unsigned min_samples)
+{
+   blitter->is_min_samples_saved = true;
+   blitter->saved_min_samples = min_samples;
+}
+
+static inline void
 util_blitter_save_render_condition(struct blitter_context *blitter,
                                    struct pipe_query *query,
                                    bool condition,
-- 
1.9.1



More information about the mesa-dev mailing list