Mesa (main): panfrost: Evaluate blend shaders per-sample
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 20:29:21 UTC 2021
Module: Mesa
Branch: main
Commit: 4a51366144a9c70b14f28669a6b1c995e3595014
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a51366144a9c70b14f28669a6b1c995e3595014
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Wed Aug 18 22:10:49 2021 +0000
panfrost: Evaluate blend shaders per-sample
This varies the sample ID value, which will be used in the next commit.
This is less complicated than keying blend shaders to the content of
this flag and trying to make mega blend shaders covering all samples at
once ... complexity I'd rather not think about right now. The DDK does
it this way.
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12478>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 2721729bdbc..d7c028b5caa 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -388,7 +388,13 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
bool alpha_to_coverage = ctx->blend->base.alpha_to_coverage;
bool msaa = rast->multisample;
- UNUSED unsigned rt_count = ctx->pipe_framebuffer.nr_cbufs;
+ unsigned rt_count = ctx->pipe_framebuffer.nr_cbufs;
+
+ bool has_blend_shader = false;
+
+ for (unsigned c = 0; c < rt_count; ++c)
+ has_blend_shader |= (blend_shaders[c] != 0);
+
pan_pack(rsd, RENDERER_STATE, cfg) {
if (panfrost_fs_required(fs, so, &ctx->pipe_framebuffer, zsa)) {
#if PAN_ARCH >= 6
@@ -408,11 +414,6 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
fs->info.fs.can_early_z && !alpha_to_coverage &&
((enum mali_func) zsa->base.alpha_func == MALI_FUNC_ALWAYS);
- bool has_blend_shader = false;
-
- for (unsigned c = 0; c < rt_count; ++c)
- has_blend_shader |= (blend_shaders[c] != 0);
-
/* TODO: Reduce this limit? */
if (has_blend_shader)
cfg.properties.midgard.work_register_count = MAX2(fs->info.work_reg_count, 8);
@@ -468,6 +469,18 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
cfg.multisample_misc.evaluate_per_sample =
msaa && (ctx->min_samples > 1);
+#if PAN_ARCH >= 6
+ /* MSAA blend shaders need to pass their sample ID to
+ * LD_TILE/ST_TILE, so we must preload it. Additionally, we
+ * need per-sample shading for the blend shader, accomplished
+ * by forcing per-sample shading for the whole program. */
+
+ if (msaa && has_blend_shader) {
+ cfg.multisample_misc.evaluate_per_sample = true;
+ cfg.preload.fragment.sample_mask_id = true;
+ }
+#endif
+
cfg.stencil_mask_misc.alpha_to_coverage = alpha_to_coverage;
cfg.depth_units = rast->offset_units * 2.0f;
cfg.depth_factor = rast->offset_scale;
More information about the mesa-commit
mailing list