panfrost: Handle per-sample shading
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 15 Jul 2020 15:38:39 +0000 (11:38 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Jul 2020 22:19:37 +0000 (22:19 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_screen.c

index 9806f74a1e76c4ea295a3783128977c7fcf93fc0..8fecdde0066da314a475291140787d4bdf38f88d 100644 (file)
@@ -567,6 +567,10 @@ panfrost_frag_meta_rasterizer_update(struct panfrost_context *ctx,
         /* TODO: Sample size */
         SET_BIT(fragmeta->unknown2_3, MALI_HAS_MSAA, msaa);
         SET_BIT(fragmeta->unknown2_4, MALI_NO_MSAA, !msaa);
+
+        SET_BIT(fragmeta->unknown2_3, MALI_PER_SAMPLE,
+                        msaa && ctx->min_samples > 1);
+
         fragmeta->depth_units = rast->offset_units * 2.0f;
         fragmeta->depth_factor = rast->offset_scale;
 
index 6a0280ec53333a711b2d731417af6608e37990bf..4ae8ee3122923f71fdecb5a5afbfbc014ec79526 100644 (file)
@@ -1202,6 +1202,15 @@ panfrost_set_sample_mask(struct pipe_context *pipe,
         ctx->sample_mask = sample_mask;
 }
 
+static void
+panfrost_set_min_samples(struct pipe_context *pipe,
+                         unsigned min_samples)
+{
+        struct panfrost_context *ctx = pan_context(pipe);
+        ctx->min_samples = min_samples;
+}
+
+
 static void
 panfrost_set_clip_state(struct pipe_context *pipe,
                         const struct pipe_clip_state *clip)
@@ -1509,6 +1518,7 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
         gallium->delete_depth_stencil_alpha_state = panfrost_delete_depth_stencil_state;
 
         gallium->set_sample_mask = panfrost_set_sample_mask;
+        gallium->set_min_samples = panfrost_set_min_samples;
 
         gallium->set_clip_state = panfrost_set_clip_state;
         gallium->set_viewport_states = panfrost_set_viewport_states;
index 3e5c6d614ed93687f31045c382997274c796d381..8e247091c40303a0a981797ac8d2bd9e3dc2707b 100644 (file)
@@ -164,6 +164,7 @@ struct panfrost_context {
         struct pipe_depth_stencil_alpha_state *depth_stencil;
         struct pipe_stencil_ref stencil_ref;
         unsigned sample_mask;
+        unsigned min_samples;
 };
 
 /* Corresponds to the CSO */
index e22363ff533c7ff9dda0e74d531f4a4cd4583f43..b705c3625945b8f6ed3f9f084cafa4c34691d85e 100644 (file)
@@ -122,6 +122,10 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
         case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
                 return 1;
 
+        case PIPE_CAP_SAMPLE_SHADING:
+                /* WIP */
+                return is_gl3 ? 1 : 0;
+
         /* Throttling frames breaks pipelining */
         case PIPE_CAP_THROTTLE:
                 return 0;