panfrost: Add blend helper packing the equation

This is more convenient for the Gallium driver and easier to test.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>
This commit is contained in:
Alyssa Rosenzweig
2021-07-30 17:46:21 -04:00
committed by Marge Bot
parent 7eb2559198
commit b7af56f2ad
3 changed files with 18 additions and 2 deletions
+1 -2
View File
@@ -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);
}
}
+14
View File
@@ -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)
{
+3
View File
@@ -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,