panfrost: Invert no_colour to enabled
This way, blend info that's left zeroed out defaults to disabled. Fixes an assertion failure in KHR-GLES31.core.draw_buffers_indexed.color_masks due to the blend CSO max_rt being set unreliably. This is also probably clearer. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17841>
This commit is contained in:

committed by
Marge Bot

parent
39bf3ea7d3
commit
0a71d56fd4
@@ -37,7 +37,7 @@ struct panfrost_bo;
|
||||
struct pan_blend_info {
|
||||
unsigned constant_mask : 4;
|
||||
bool fixed_function : 1;
|
||||
bool no_colour : 1;
|
||||
bool enabled : 1;
|
||||
bool load_dest : 1;
|
||||
bool opaque : 1;
|
||||
bool alpha_zero_nop : 1;
|
||||
|
@@ -272,7 +272,7 @@ panfrost_fs_required(
|
||||
|
||||
/* If colour is written we need to execute */
|
||||
for (unsigned i = 0; i < state->nr_cbufs; ++i) {
|
||||
if (state->cbufs[i] && !blend->info[i].no_colour)
|
||||
if (state->cbufs[i] && blend->info[i].enabled)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ panfrost_overdraw_alpha(const struct panfrost_context *ctx, bool zero)
|
||||
for (unsigned i = 0; i < ctx->pipe_framebuffer.nr_cbufs; ++i) {
|
||||
const struct pan_blend_info info = so->info[i];
|
||||
|
||||
bool enabled = ctx->pipe_framebuffer.cbufs[i] && info.no_colour;
|
||||
bool enabled = ctx->pipe_framebuffer.cbufs[i] && !info.enabled;
|
||||
bool flag = zero ? info.alpha_zero_nop : info.alpha_one_store;
|
||||
|
||||
if (enabled && !flag)
|
||||
@@ -355,7 +355,7 @@ panfrost_emit_blend(struct panfrost_batch *batch, void *rts, mali_ptr *blend_sha
|
||||
struct mali_blend_packed *packed = rts + (i * pan_size(BLEND));
|
||||
|
||||
/* Disable blending for unbacked render targets */
|
||||
if (rt_count == 0 || !batch->key.cbufs[i] || so->info[i].no_colour) {
|
||||
if (rt_count == 0 || !batch->key.cbufs[i] || !so->info[i].enabled) {
|
||||
pan_pack(rts + i * pan_size(BLEND), BLEND, cfg) {
|
||||
cfg.enable = false;
|
||||
#if PAN_ARCH >= 6
|
||||
@@ -578,7 +578,7 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
|
||||
if (rt_count > 0) {
|
||||
cfg.multisample_misc.load_destination = so->info[0].load_dest;
|
||||
cfg.multisample_misc.blend_shader = (blend_shaders[0] != 0);
|
||||
cfg.stencil_mask_misc.write_enable = !so->info[0].no_colour;
|
||||
cfg.stencil_mask_misc.write_enable = so->info[0].enabled;
|
||||
cfg.stencil_mask_misc.srgb = util_format_is_srgb(ctx->pipe_framebuffer.cbufs[0]->format);
|
||||
cfg.stencil_mask_misc.dither_disable = !so->base.dither;
|
||||
cfg.stencil_mask_misc.alpha_to_one = so->base.alpha_to_one;
|
||||
@@ -4592,7 +4592,7 @@ panfrost_create_blend_state(struct pipe_context *pipe,
|
||||
unsigned constant_mask = pan_blend_constant_mask(equation);
|
||||
const bool supports_2src = pan_blend_supports_2src(PAN_ARCH);
|
||||
so->info[c] = (struct pan_blend_info) {
|
||||
.no_colour = (equation.color_mask == 0),
|
||||
.enabled = (equation.color_mask != 0),
|
||||
.opaque = pan_blend_is_opaque(equation),
|
||||
.constant_mask = constant_mask,
|
||||
|
||||
|
@@ -182,7 +182,7 @@ panfrost_get_blend(struct panfrost_batch *batch, unsigned rti, struct panfrost_b
|
||||
/* On all architectures, we can disable writes for a blend descriptor,
|
||||
* at which point the format doesn't matter.
|
||||
*/
|
||||
if (info.no_colour)
|
||||
if (!info.enabled)
|
||||
return 0;
|
||||
|
||||
/* On Bifrost and newer, we can also use fixed-function for opaque
|
||||
|
@@ -210,7 +210,7 @@ panfrost_set_batch_masks_blend(struct panfrost_batch *batch)
|
||||
struct panfrost_blend_state *blend = ctx->blend;
|
||||
|
||||
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
|
||||
if (!blend->info[i].no_colour && batch->key.cbufs[i])
|
||||
if (blend->info[i].enabled && batch->key.cbufs[i])
|
||||
panfrost_draw_target(batch, PIPE_CLEAR_COLOR0 << i);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user