panfrost: Simplify make_fixed_blend_mode prototype

blend_rt is a bitfield so in practice it will be quite small, let's save
the indirection.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6440>
This commit is contained in:
Alyssa Rosenzweig 2020-08-18 17:50:39 -04:00 committed by Tomeu Vizoso
parent 94c9f87df1
commit 919818a8a0
3 changed files with 23 additions and 27 deletions

View file

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

View file

@ -341,19 +341,18 @@ panfrost_constant_mask(unsigned *factors, unsigned num_factors)
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;
@ -364,8 +363,8 @@ panfrost_make_fixed_blend_mode(
* 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));
@ -376,12 +375,12 @@ panfrost_make_fixed_blend_mode(
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;

View file

@ -33,10 +33,9 @@ struct panfrost_blend_state;
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);