/* First, we'll try fixed function, matching equation and constant */
if (pan_blend_can_fixed_function(dev, &pan_blend, rti)) {
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),
.opaque = pan_blend_is_opaque(&pan_blend, rti),
.no_colour = pan_blend.rts[rti].equation.color_mask == 0,
.first_tag = shader->first_tag,
.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;
(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
-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];
-
- if (state->logicop_enable ||
- (rt_state->equation.color_mask &&
- rt_state->equation.color_mask != 0xF))
- return true;
-
- 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;
+ return (equation.color_mask && equation.color_mask != 0xF) ||
+ is_dest_factor(equation.rgb_src_factor, false) ||
+ is_dest_factor(equation.alpha_src_factor, true) ||
+ equation.rgb_dst_factor != BLEND_FACTOR_ZERO ||
+ equation.rgb_invert_dst_factor ||
+ equation.alpha_dst_factor != BLEND_FACTOR_ZERO ||
+ equation.alpha_invert_dst_factor;
}
/* Create the descriptor for a fixed blend mode given the corresponding Gallium