assert(!blend->alpha_to_one);
for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c) {
- struct panfrost_blend_rt *rt = &so->rt[c];
-
- /* There are two paths. First, we would like to try a
- * fixed-function if we can */
+ unsigned g = blend->independent_blend_enable ? c : 0;
+ struct pipe_rt_blend_state pipe = blend->rt[g];
- /* Without indep blending, the first RT settings replicate */
+ struct panfrost_blend_rt *rt = &so->rt[c];
+ rt->shaders = _mesa_hash_table_u64_create(so);
- if (!blend->logicop_enable) {
- unsigned g =
- blend->independent_blend_enable ? c : 0;
+ /* Logic ops are always shader */
+ if (blend->logicop_enable) {
+ continue;
+ }
- rt->has_fixed_function =
+ rt->has_fixed_function =
panfrost_make_fixed_blend_mode(
- &blend->rt[g],
+ pipe,
&rt->equation,
- &rt->constant_mask,
- blend->rt[g].colormask);
- }
+ &rt->constant_mask);
/* Regardless if that works, we also need to initialize
* the blend shaders */
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;
* 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));
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;
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);