diff --git a/.pick_status.json b/.pick_status.json index c73b59405b8..f35aa0d5c01 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2317,7 +2317,7 @@ "description": "panfrost: Fix the reads_dest prototype", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "93824b6451a4cc3eece1d7afa77e9a440ee41ee3" }, diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index 9a79bb44098..5a2044d00ce 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -154,7 +154,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc /* 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, @@ -191,7 +191,8 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti, struc .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; diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c index 8e51fd1cc45..13b5ce5e0f5 100644 --- a/src/panfrost/lib/pan_blend.c +++ b/src/panfrost/lib/pan_blend.c @@ -304,25 +304,20 @@ is_dest_factor(enum blend_factor factor, bool 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 -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 diff --git a/src/panfrost/lib/pan_blend.h b/src/panfrost/lib/pan_blend.h index 6cd4dc6ca9f..78a209b0640 100644 --- a/src/panfrost/lib/pan_blend.h +++ b/src/panfrost/lib/pan_blend.h @@ -96,7 +96,7 @@ struct pan_blend_shader { }; bool -pan_blend_reads_dest(const struct pan_blend_state *state, unsigned rt); +pan_blend_reads_dest(const struct pan_blend_equation eq); bool pan_blend_can_fixed_function(const struct panfrost_device *dev,