panfrost: Fix the reads_dest prototype

Takes too much state, only pass what we need.

Fixes: 93824b6451 ("panfrost: Move the blend logic out of the gallium driver")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
This commit is contained in:
Alyssa Rosenzweig
2021-05-14 09:47:37 -04:00
committed by Marge Bot
parent 1d62ec348a
commit a0592066b0
3 changed files with 16 additions and 20 deletions

View File

@@ -146,7 +146,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
/* First, we'll try fixed function, matching equation and constant */ /* First, we'll try fixed function, matching equation and constant */
if (pan_blend_can_fixed_function(dev, &pan_blend, rti)) { if (pan_blend_can_fixed_function(dev, &pan_blend, rti)) {
struct panfrost_blend_final final = { struct panfrost_blend_final final = {
.load_dest = pan_blend_reads_dest(&pan_blend, rti), .load_dest = pan_blend_reads_dest(pan_blend.rts[rti].equation),
.equation.constant = pan_blend_get_constant(dev, &pan_blend, rti), .equation.constant = pan_blend_get_constant(dev, &pan_blend, rti),
.opaque = pan_blend_is_opaque(&pan_blend, rti), .opaque = pan_blend_is_opaque(&pan_blend, rti),
.no_colour = pan_blend.rts[rti].equation.color_mask == 0, .no_colour = pan_blend.rts[rti].equation.color_mask == 0,
@@ -196,7 +196,8 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc
.first_tag = shader->first_tag, .first_tag = shader->first_tag,
.gpu = (*bo)->ptr.gpu + *shader_offset, .gpu = (*bo)->ptr.gpu + *shader_offset,
}, },
.load_dest = pan_blend_reads_dest(&pan_blend, rti), .load_dest = pan_blend.logicop_enable ||
pan_blend_reads_dest(pan_blend.rts[rti].equation),
}; };
*shader_offset += shader->binary.size; *shader_offset += shader->binary.size;

View File

@@ -304,25 +304,20 @@ is_dest_factor(enum blend_factor factor, bool alpha)
(factor == BLEND_FACTOR_SRC_ALPHA_SATURATE && !alpha); (factor == BLEND_FACTOR_SRC_ALPHA_SATURATE && !alpha);
} }
/* Determines if a blend equation reads back the destination. This can occur by
* explicitly referencing the destination in the blend equation, or by using a
* partial writemask. */
bool bool
pan_blend_reads_dest(const struct pan_blend_state *state, unsigned rt) pan_blend_reads_dest(const struct pan_blend_equation equation)
{ {
const struct pan_blend_rt_state *rt_state = &state->rts[rt]; return (equation.color_mask && equation.color_mask != 0xF) ||
is_dest_factor(equation.rgb_src_factor, false) ||
if (state->logicop_enable || is_dest_factor(equation.alpha_src_factor, true) ||
(rt_state->equation.color_mask && equation.rgb_dst_factor != BLEND_FACTOR_ZERO ||
rt_state->equation.color_mask != 0xF)) equation.rgb_invert_dst_factor ||
return true; equation.alpha_dst_factor != BLEND_FACTOR_ZERO ||
equation.alpha_invert_dst_factor;
if (is_dest_factor(rt_state->equation.rgb_src_factor, false) ||
is_dest_factor(rt_state->equation.alpha_src_factor, true) ||
rt_state->equation.rgb_dst_factor != BLEND_FACTOR_ZERO ||
rt_state->equation.rgb_invert_dst_factor ||
rt_state->equation.alpha_dst_factor != BLEND_FACTOR_ZERO ||
rt_state->equation.alpha_invert_dst_factor)
return true;
return false;
} }
/* Create the descriptor for a fixed blend mode given the corresponding Gallium /* Create the descriptor for a fixed blend mode given the corresponding Gallium

View File

@@ -97,7 +97,7 @@ struct pan_blend_shader {
}; };
bool bool
pan_blend_reads_dest(const struct pan_blend_state *state, unsigned rt); pan_blend_reads_dest(const struct pan_blend_equation eq);
bool bool
pan_blend_can_fixed_function(const struct panfrost_device *dev, pan_blend_can_fixed_function(const struct panfrost_device *dev,