panfrost: Don't allow FPK if a RT is missing

A fragment shader that forgets to write to one of the bound render
targets (in the presence of MRT) invalidates a core FPK invariant. Check
for this and add it to the naughty list.

I don't think this needs a backport since FPK isn't really used yet.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10271>
This commit is contained in:
Alyssa Rosenzweig
2021-04-15 18:25:54 -04:00
committed by Marge Bot
parent 600a48248e
commit dbf9a4b072
3 changed files with 14 additions and 2 deletions
+8 -2
View File
@@ -448,11 +448,16 @@ panfrost_prepare_bifrost_fs_state(struct panfrost_context *ctx,
fs->bo ? fs->bo->ptr.gpu : 0,
state);
/* Track if any colour buffer is reused across draws, either
* from reading it directly, or from failing to write it */
bool blend_reads_dest = false;
unsigned rt_mask = 0;
for (unsigned i = 0; i < ctx->pipe_framebuffer.nr_cbufs; ++i) {
blend_reads_dest |= (blend[i].load_dest &&
ctx->pipe_framebuffer.cbufs[i]);
if (ctx->pipe_framebuffer.cbufs[i]) {
rt_mask |= (1 << i);
blend_reads_dest |= blend[i].load_dest;
}
}
state->properties.bifrost.allow_forward_pixel_to_kill =
@@ -461,6 +466,7 @@ panfrost_prepare_bifrost_fs_state(struct panfrost_context *ctx,
!fs->info.fs.writes_coverage &&
!fs->info.fs.can_discard &&
!fs->info.fs.outputs_read &&
!(rt_mask & ~fs->info.outputs_written) &&
!alpha_to_coverage &&
!blend_reads_dest;
}
+5
View File
@@ -178,10 +178,15 @@ pan_shader_compile(const struct panfrost_device *dev,
info->fs.writes_coverage = true;
uint64_t outputs_read = s->info.outputs_read;
uint64_t outputs_written = s->info.outputs_written;
if (outputs_read & BITFIELD64_BIT(FRAG_RESULT_COLOR))
outputs_read |= BITFIELD64_BIT(FRAG_RESULT_DATA0);
if (outputs_written & BITFIELD64_BIT(FRAG_RESULT_COLOR))
outputs_written |= BITFIELD64_BIT(FRAG_RESULT_DATA0);
info->fs.outputs_read = outputs_read >> FRAG_RESULT_DATA0;
info->fs.outputs_written = outputs_written >> FRAG_RESULT_DATA0;
/* EXT_shader_framebuffer_fetch requires per-sample */
info->fs.sample_shading = s->info.fs.uses_sample_shading ||
+1
View File
@@ -175,6 +175,7 @@ struct pan_shader_info {
bool sample_shading;
bool early_fragment_tests;
BITSET_WORD outputs_read;
BITSET_WORD outputs_written;
} fs;
struct {