diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index ffda1196d04..1d0b2bad5c9 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -110,25 +110,23 @@ panfrost_create_blend_state(struct pipe_context *pipe, assert(!blend->alpha_to_one); for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c) { + unsigned g = blend->independent_blend_enable ? c : 0; + struct pipe_rt_blend_state pipe = blend->rt[g]; + struct panfrost_blend_rt *rt = &so->rt[c]; + rt->shaders = _mesa_hash_table_u64_create(so); - /* There are two paths. First, we would like to try a - * fixed-function if we can */ - - /* Without indep blending, the first RT settings replicate */ - - if (!blend->logicop_enable) { - unsigned g = - blend->independent_blend_enable ? c : 0; - - rt->has_fixed_function = - panfrost_make_fixed_blend_mode( - &blend->rt[g], - &rt->equation, - &rt->constant_mask, - blend->rt[g].colormask); + /* Logic ops are always shader */ + if (blend->logicop_enable) { + continue; } + rt->has_fixed_function = + panfrost_make_fixed_blend_mode( + pipe, + &rt->equation, + &rt->constant_mask); + /* Regardless if that works, we also need to initialize * the blend shaders */ diff --git a/src/gallium/drivers/panfrost/pan_blending.c b/src/gallium/drivers/panfrost/pan_blending.c index 458ab51a4e9..e1122880594 100644 --- a/src/gallium/drivers/panfrost/pan_blending.c +++ b/src/gallium/drivers/panfrost/pan_blending.c @@ -341,19 +341,18 @@ panfrost_constant_mask(unsigned *factors, unsigned num_factors) bool panfrost_make_fixed_blend_mode( - const struct pipe_rt_blend_state *blend, + struct pipe_rt_blend_state blend, struct mali_blend_equation *out, - unsigned *constant_mask, - unsigned colormask) + unsigned *constant_mask) { /* Gallium and Mali represent colour masks identically. XXX: Static * assert for future proof */ - out->color_mask = colormask; + out->color_mask = blend.colormask; /* If no blending is enabled, default back on `replace` mode */ - if (!blend->blend_enable) { + if (!blend.blend_enable) { out->rgb_mode = 0x122; out->alpha_mode = 0x122; return true; @@ -364,8 +363,8 @@ panfrost_make_fixed_blend_mode( * fixed-function blending */ unsigned factors[] = { - blend->rgb_src_factor, blend->rgb_dst_factor, - blend->alpha_src_factor, blend->alpha_dst_factor, + blend.rgb_src_factor, blend.rgb_dst_factor, + blend.alpha_src_factor, blend.alpha_dst_factor, }; *constant_mask = panfrost_constant_mask(factors, ARRAY_SIZE(factors)); @@ -376,12 +375,12 @@ panfrost_make_fixed_blend_mode( unsigned alpha_mode = 0; if (!panfrost_make_fixed_blend_part( - blend->rgb_func, blend->rgb_src_factor, blend->rgb_dst_factor, + blend.rgb_func, blend.rgb_src_factor, blend.rgb_dst_factor, &rgb_mode)) return false; if (!panfrost_make_fixed_blend_part( - blend->alpha_func, blend->alpha_src_factor, blend->alpha_dst_factor, + blend.alpha_func, blend.alpha_src_factor, blend.alpha_dst_factor, &alpha_mode)) return false; diff --git a/src/gallium/drivers/panfrost/pan_blending.h b/src/gallium/drivers/panfrost/pan_blending.h index 4ceaf16f1de..123b1d13bf4 100644 --- a/src/gallium/drivers/panfrost/pan_blending.h +++ b/src/gallium/drivers/panfrost/pan_blending.h @@ -33,10 +33,9 @@ struct panfrost_blend_state; bool panfrost_make_fixed_blend_mode( - const struct pipe_rt_blend_state *blend, + const struct pipe_rt_blend_state blend, struct mali_blend_equation *out, - unsigned *constant_mask, - unsigned colormask); + unsigned *constant_mask); bool panfrost_can_fixed_blend(enum pipe_format format);