};
so->pan.rts[c].equation = equation;
+
+ /* Converting equations to Mali style is expensive, do it at
+ * CSO create time instead of draw-time */
+ if (so->info[c].fixed_function) {
+ pan_blend_to_fixed_function_equation(equation,
+ &so->equation[c]);
+ }
}
return so;
sizeof(pan_blend.constants));
/* First, we'll try fixed function, matching equation and constant */
- const struct pan_blend_equation eq = pan_blend.rts[rti].equation;
bool ff = blend->info[rti].fixed_function;
/* Not all formats are blendable, check if this one is */
ctx->blend_color.color),
};
- pan_blend_to_fixed_function_equation(eq, &final.equation.equation);
return final;
}
};
struct panfrost_blend_equation_final {
- struct MALI_BLEND_EQUATION equation;
float constant;
};
struct pipe_blend_state base;
struct pan_blend_state pan;
struct pan_blend_info info[PIPE_MAX_COLOR_BUFS];
+ struct MALI_BLEND_EQUATION equation[PIPE_MAX_COLOR_BUFS];
};
/* Container for a final blend state, specialized to constants and a
for (unsigned i = 0; i < format_desc->nr_channels; i++)
chan_size = MAX2(format_desc->channel[0].size, chan_size);
- cfg.bifrost.equation = blend[i].equation.equation;
+ cfg.bifrost.equation = so->equation[i];
/* Fixed point constant */
u16 constant = blend[i].equation.constant * ((1 << chan_size) - 1);
if (blend[i].is_shader) {
cfg.midgard.shader_pc = blend[i].shader.gpu | blend[i].shader.first_tag;
} else {
- cfg.midgard.equation = blend[i].equation.equation;
+ cfg.midgard.equation = ctx->blend->equation[i];
cfg.midgard.constant = blend[i].equation.constant;
}
}
state->sfbd_blend_shader = blend[0].shader.gpu |
blend[0].shader.first_tag;
} else {
- state->sfbd_blend_equation = blend[0].equation.equation;
+ state->sfbd_blend_equation = so->equation[0];
state->sfbd_blend_constant = blend[0].equation.constant;
}
} else if (dev->quirks & MIDGARD_SFBD) {