PIPE_BLEND_* matches 1:1 the hardware defines.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4187>
struct etna_blend_state *co = CALLOC_STRUCT(etna_blend_state);
bool alpha_enable, logicop_enable;
struct etna_blend_state *co = CALLOC_STRUCT(etna_blend_state);
bool alpha_enable, logicop_enable;
+ /* pipe_blend_func happens to match the hardware. */
+ STATIC_ASSERT(PIPE_BLEND_ADD == BLEND_EQ_ADD);
+ STATIC_ASSERT(PIPE_BLEND_SUBTRACT == BLEND_EQ_SUBTRACT);
+ STATIC_ASSERT(PIPE_BLEND_REVERSE_SUBTRACT == BLEND_EQ_REVERSE_SUBTRACT);
+ STATIC_ASSERT(PIPE_BLEND_MIN == BLEND_EQ_MIN);
+ STATIC_ASSERT(PIPE_BLEND_MAX == BLEND_EQ_MAX);
+
VIVS_PE_ALPHA_CONFIG_SRC_FUNC_ALPHA(translate_blend_factor(rt0->alpha_src_factor)) |
VIVS_PE_ALPHA_CONFIG_DST_FUNC_COLOR(translate_blend_factor(rt0->rgb_dst_factor)) |
VIVS_PE_ALPHA_CONFIG_DST_FUNC_ALPHA(translate_blend_factor(rt0->alpha_dst_factor)) |
VIVS_PE_ALPHA_CONFIG_SRC_FUNC_ALPHA(translate_blend_factor(rt0->alpha_src_factor)) |
VIVS_PE_ALPHA_CONFIG_DST_FUNC_COLOR(translate_blend_factor(rt0->rgb_dst_factor)) |
VIVS_PE_ALPHA_CONFIG_DST_FUNC_ALPHA(translate_blend_factor(rt0->alpha_dst_factor)) |
- VIVS_PE_ALPHA_CONFIG_EQ_COLOR(translate_blend(rt0->rgb_func)) |
- VIVS_PE_ALPHA_CONFIG_EQ_ALPHA(translate_blend(rt0->alpha_func));
+ VIVS_PE_ALPHA_CONFIG_EQ_COLOR(rt0->rgb_func) |
+ VIVS_PE_ALPHA_CONFIG_EQ_ALPHA(rt0->alpha_func);
} else {
co->PE_ALPHA_CONFIG = 0;
}
} else {
co->PE_ALPHA_CONFIG = 0;
}
-static inline uint32_t
-translate_blend(unsigned blend)
-{
- switch (blend) {
- case PIPE_BLEND_ADD:
- return BLEND_EQ_ADD;
- case PIPE_BLEND_SUBTRACT:
- return BLEND_EQ_SUBTRACT;
- case PIPE_BLEND_REVERSE_SUBTRACT:
- return BLEND_EQ_REVERSE_SUBTRACT;
- case PIPE_BLEND_MIN:
- return BLEND_EQ_MIN;
- case PIPE_BLEND_MAX:
- return BLEND_EQ_MAX;
- default:
- DBG("Unhandled blend: %i", blend);
- return ETNA_NO_MATCH;
- }
-}
-
static inline uint32_t
translate_blend_factor(unsigned blend_factor)
{
static inline uint32_t
translate_blend_factor(unsigned blend_factor)
{