From 3e251328fad5cc123cb40233faa51e0e7cbcf2be Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 2 Jul 2020 10:06:33 -0400 Subject: [PATCH] panfrost: Identify coverage_mask The driver specifies the mask directly. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +- src/panfrost/include/panfrost-job.h | 13 +++++-------- src/panfrost/pandecode/decode.c | 10 ++-------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index c1267b43f02..d431afa45ae 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -835,7 +835,7 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx, fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT); - fragmeta->alpha_coverage = ~MALI_ALPHA_COVERAGE(0.000000); + fragmeta->coverage_mask = 0xFFFF; fragmeta->unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x10; fragmeta->unknown2_4 = 0x4e0; diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 50159c3eb10..0f5757ae979 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -384,13 +384,6 @@ enum mali_format { }; -/* Alpha coverage is encoded as 4-bits (from a clampf), with inversion - * literally performing a bitwise invert. This function produces slightly wrong - * results and I'm not sure why; some rounding issue I suppose... */ - -#define MALI_ALPHA_COVERAGE(clampf) ((uint16_t) (int) (clampf * 15.0f)) -#define MALI_GET_ALPHA_COVERAGE(nibble) ((float) nibble / 15.0f) - /* Applies to midgard1.flags_lo */ /* Should be set when the fragment shader updates the depth value. */ @@ -610,7 +603,11 @@ struct mali_shader_meta { u32 unknown2_2; - u16 alpha_coverage; + /* Generated from SAMPLE_COVERAGE_VALUE and SAMPLE_COVERAGE_INVERT. See + * 13.8.3 ("Multisample Fragment Operations") in the OpenGL ES 3.2 + * specification. Only matters when multisampling is enabled. */ + u16 coverage_mask; + u16 unknown2_3; u8 stencil_mask_front; diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 37f384eff58..263dce0eb90 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -2642,14 +2642,8 @@ pandecode_vertex_tiler_postfix_pre( pandecode_prop("depth_units = %f", s->depth_units); } - if (s->alpha_coverage) { - bool invert_alpha_coverage = s->alpha_coverage & 0xFFF0; - uint16_t inverted_coverage = invert_alpha_coverage ? ~s->alpha_coverage : s->alpha_coverage; - - pandecode_prop("alpha_coverage = %sMALI_ALPHA_COVERAGE(%f)", - invert_alpha_coverage ? "~" : "", - MALI_GET_ALPHA_COVERAGE(inverted_coverage)); - } + if (s->coverage_mask) + pandecode_prop("coverage_mask = 0x%X", s->coverage_mask); if (s->unknown2_2) pandecode_prop(".unknown2_2 = %X", s->unknown2_2); -- 2.30.2