diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 450dcaf7aaf..cfc1413fa53 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3461,8 +3461,7 @@ panfrost_create_blend_state(struct pipe_context *pipe, /* Converting equations to Mali style is expensive, do it at * CSO create time instead of draw-time */ if (so->info[c].fixed_function) { - pan_pack(&so->equation[c], BLEND_EQUATION, cfg) - pan_blend_to_fixed_function_equation(equation, &cfg); + so->equation[c] = pan_pack_blend(equation); } } diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c index 1f55d09177e..4dd5fc00956 100644 --- a/src/panfrost/lib/pan_blend.c +++ b/src/panfrost/lib/pan_blend.c @@ -312,6 +312,20 @@ pan_blend_to_fixed_function_equation(const struct pan_blend_equation equation, out->color_mask = equation.color_mask; } +uint32_t +pan_pack_blend(const struct pan_blend_equation equation) +{ + STATIC_ASSERT(sizeof(uint32_t) == MALI_BLEND_EQUATION_LENGTH); + + uint32_t out = 0; + + pan_pack(&out, BLEND_EQUATION, cfg) { + pan_blend_to_fixed_function_equation(equation, &cfg); + } + + return out; +} + static const char * logicop_str(enum pipe_logicop logicop) { diff --git a/src/panfrost/lib/pan_blend.h b/src/panfrost/lib/pan_blend.h index 2a95503262a..397022c7c6d 100644 --- a/src/panfrost/lib/pan_blend.h +++ b/src/panfrost/lib/pan_blend.h @@ -134,6 +134,9 @@ void pan_blend_to_fixed_function_equation(const struct pan_blend_equation eq, struct MALI_BLEND_EQUATION *equation); +uint32_t +pan_pack_blend(const struct pan_blend_equation equation); + nir_shader * pan_blend_create_shader(const struct panfrost_device *dev, const struct pan_blend_state *state,