From: Alyssa Rosenzweig Date: Thu, 2 Jul 2020 15:17:37 +0000 (-0400) Subject: panfrost: Implement alpha-to-coverage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=490fbce239eff1df5ee27c4f41d4337779d82747;p=mesa.git panfrost: Implement alpha-to-coverage Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index 518005c9f68..57e70d82148 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -107,7 +107,6 @@ panfrost_create_blend_state(struct pipe_context *pipe, so->base = *blend; /* TODO: The following features are not yet implemented */ - assert(!blend->alpha_to_coverage); assert(!blend->alpha_to_one); for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c) { diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index f3a4633e69b..d50121afb44 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -672,6 +672,9 @@ panfrost_frag_meta_blend_update(struct panfrost_context *ctx, (dev->quirks & MIDGARD_SFBD) && ctx->blend && !ctx->blend->base.dither); + SET_BIT(fragmeta->unknown2_4, MALI_ALPHA_TO_COVERAGE, + ctx->blend->base.alpha_to_coverage); + /* Get blending setup */ unsigned rt_count = MAX2(ctx->pipe_framebuffer.nr_cbufs, 1); @@ -857,7 +860,8 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx, SET_BIT(fragmeta->midgard1.flags_lo, MALI_EARLY_Z, !fs->can_discard && !fs->writes_global && - !fs->writes_depth && !fs->writes_stencil); + !fs->writes_depth && !fs->writes_stencil && + !ctx->blend->base.alpha_to_coverage); /* Add the writes Z/S flags if needed. */ SET_BIT(fragmeta->midgard1.flags_lo, MALI_WRITES_Z, fs->writes_depth); diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index 0f5757ae979..cd725ec5544 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -110,8 +110,7 @@ enum mali_func { /* Next flags to unknown2_4 */ #define MALI_STENCIL_TEST (1 << 0) -/* What?! */ -#define MALI_SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER (1 << 1) +#define MALI_ALPHA_TO_COVERAGE (1 << 1) #define MALI_NO_DITHER (1 << 9) #define MALI_DEPTH_RANGE_A (1 << 12) diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index 263dce0eb90..928f5a77efb 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -237,7 +237,7 @@ static const struct pandecode_flag_info u4_flag_info[] = { FLAG_INFO(DEPTH_RANGE_A), FLAG_INFO(DEPTH_RANGE_B), FLAG_INFO(STENCIL_TEST), - FLAG_INFO(SAMPLE_ALPHA_TO_COVERAGE_NO_BLEND_SHADER), + FLAG_INFO(ALPHA_TO_COVERAGE), {} }; #undef FLAG_INFO