panfrost: Preset evaluate_per_sample
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 14 May 2021 22:27:02 +0000 (18:27 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 18 May 2021 22:51:56 +0000 (22:51 +0000)
Even though this isn't totally known at compile-time, at least one case
is, so let's handle that one ahead-of-time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/panfrost/lib/pan_shader.h

index 63ff8bd..406471e 100644 (file)
@@ -589,7 +589,6 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
                           struct MALI_RENDERER_STATE *state)
 {
         const struct panfrost_device *dev = pan_device(ctx->base.screen);
-        struct panfrost_shader_state *fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
         struct pipe_rasterizer_state *rast = &ctx->rasterizer->base;
         const struct panfrost_zsa_state *zsa = ctx->depth_stencil;
         bool alpha_to_coverage = ctx->blend->base.alpha_to_coverage;
@@ -604,7 +603,7 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
         state->multisample_misc.sample_mask = (msaa ? ctx->sample_mask : ~0) & 0xFFFF;
 
         state->multisample_misc.evaluate_per_sample =
-                msaa && (ctx->min_samples > 1 || fs->info.fs.sample_shading);
+                msaa && (ctx->min_samples > 1);
 
         state->multisample_misc.fixed_function_near_discard = rast->depth_clip_near;
         state->multisample_misc.fixed_function_far_discard = rast->depth_clip_far;
index 33f331a..dbaaebb 100644 (file)
@@ -185,6 +185,11 @@ pan_shader_prepare_rsd(const struct panfrost_device *dev,
                         shader_info->fs.writes_depth ?
                         MALI_DEPTH_SOURCE_SHADER :
                         MALI_DEPTH_SOURCE_FIXED_FUNCTION;
+
+                /* This also needs to be set if the API forces per-sample
+                 * shading, but that'll just got ORed in */
+                rsd->multisample_misc.evaluate_per_sample =
+                        shader_info->fs.sample_shading;
         } else {
                 rsd->properties.depth_source =
                         MALI_DEPTH_SOURCE_FIXED_FUNCTION;