From: Alyssa Rosenzweig Date: Mon, 17 Jun 2019 17:22:37 +0000 (-0700) Subject: panfrost: Cleanup default blend mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aef01dd2e54c293b5dfe7236e586e61ce2a18225;p=mesa.git panfrost: Cleanup default blend mode Just encode the Mali magic number for `replace` rather than awkwardly forcing Gallium structures through. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_blending.c b/src/gallium/drivers/panfrost/pan_blending.c index f38868afec2..14f99f64edd 100644 --- a/src/gallium/drivers/panfrost/pan_blending.c +++ b/src/gallium/drivers/panfrost/pan_blending.c @@ -344,29 +344,21 @@ panfrost_make_constant(unsigned *factors, unsigned num_factors, const struct pip * representating, return false to handle degenerate cases with a blend shader */ -static const struct pipe_rt_blend_state default_blend = { - .blend_enable = 1, - - .rgb_func = PIPE_BLEND_ADD, - .rgb_src_factor = PIPE_BLENDFACTOR_ONE, - .rgb_dst_factor = PIPE_BLENDFACTOR_ZERO, - - .alpha_func = PIPE_BLEND_ADD, - .alpha_src_factor = PIPE_BLENDFACTOR_ONE, - .alpha_dst_factor = PIPE_BLENDFACTOR_ZERO, - - .colormask = PIPE_MASK_RGBA -}; - bool panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct panfrost_blend_state *so, unsigned colormask, const struct pipe_blend_color *blend_color) { struct mali_blend_equation *out = &so->equation; + /* Gallium and Mali represent colour masks identically. XXX: Static assert for future proof */ + out->color_mask = colormask; + /* If no blending is enabled, default back on `replace` mode */ - if (!blend->blend_enable) - return panfrost_make_fixed_blend_mode(&default_blend, so, colormask, blend_color); + if (!blend->blend_enable) { + out->rgb_mode = 0x122; + out->alpha_mode = 0x122; + return true; + } /* We have room only for a single float32 constant between the four * components. If we need more, spill to the programmable pipeline. */ @@ -395,8 +387,5 @@ panfrost_make_fixed_blend_mode(const struct pipe_rt_blend_state *blend, struct p out->rgb_mode = rgb_mode; out->alpha_mode = alpha_mode; - /* Gallium and Mali represent colour masks identically. XXX: Static assert for future proof */ - out->color_mask = colormask; - return true; }