panvk: Narrow the allow-forward-pixel-kill condition

Setting it to info->fs.can_fpk is wrong. Let's mimic the gallium driver
here.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12762>
This commit is contained in:
Boris Brezillon 2021-09-06 12:16:41 +02:00
parent c0e43b844c
commit 8182f7a981
3 changed files with 12 additions and 1 deletions

View file

@ -735,6 +735,7 @@ struct panvk_pipeline {
uint32_t rsd_template[RSD_WORDS];
bool required;
bool dynamic_rsd;
uint8_t rt_mask;
} fs;
struct {
@ -788,6 +789,7 @@ struct panvk_pipeline {
uint8_t index;
uint16_t bifrost_factor;
} constant[8];
bool reads_dest;
} blend;
VkViewport viewport;

View file

@ -747,7 +747,13 @@ panvk_per_arch(emit_base_fs_rsd)(const struct panvk_device *dev,
cfg.properties.midgard.shader_contains_discard =
zs_enabled && info->fs.can_discard;
#else
cfg.properties.bifrost.allow_forward_pixel_to_kill = info->fs.can_fpk;
uint8_t rt_written = pipeline->fs.info.outputs_written >> FRAG_RESULT_DATA0;
uint8_t rt_mask = pipeline->fs.rt_mask;
cfg.properties.bifrost.allow_forward_pixel_to_kill =
pipeline->fs.info.fs.can_fpk &&
!(rt_mask & ~rt_written) &&
!pipeline->ms.alpha_to_coverage &&
!pipeline->blend.reads_dest;
#endif
} else {
#if PAN_ARCH == 5

View file

@ -606,6 +606,8 @@ panvk_pipeline_builder_parse_color_blend(struct panvk_pipeline_builder *builder,
out->equation.alpha_dst_factor = translate_blend_factor(in->dstAlphaBlendFactor, dest_has_alpha);
out->equation.alpha_invert_dst_factor = inverted_blend_factor(in->dstAlphaBlendFactor, dest_has_alpha);
pipeline->blend.reads_dest |= pan_blend_reads_dest(out->equation);
unsigned constant_mask =
panvk_per_arch(blend_needs_lowering)(pdev, &pipeline->blend.state, i) ?
0 : pan_blend_constant_mask(out->equation);
@ -755,6 +757,7 @@ panvk_pipeline_builder_init_fs_state(struct panvk_pipeline_builder *builder,
pipeline->fs.address = pipeline->binary_bo->ptr.gpu +
builder->stages[MESA_SHADER_FRAGMENT].shader_offset;
pipeline->fs.info = builder->shaders[MESA_SHADER_FRAGMENT]->info;
pipeline->fs.rt_mask = builder->active_color_attachments;
pipeline->fs.required = panvk_fs_required(pipeline);
}