panfrost: Call nir_lower_fragcolor based on key
We only want it to trigger if MRT is actually in use. This is a cheap key (only require multiple variants for an obscure edge case) and avoids the perf regression of using this pass which is needed for conformance. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
This commit is contained in:
parent
6a4482df98
commit
28ac4d1e00
|
@ -76,6 +76,10 @@ panfrost_shader_compile(struct panfrost_context *ctx,
|
|||
s = tgsi_to_nir(ir, ctx->base.screen, false);
|
||||
}
|
||||
|
||||
/* Lower this early so the backends don't have to worry about it */
|
||||
if (stage == MESA_SHADER_FRAGMENT)
|
||||
NIR_PASS_V(s, nir_lower_fragcolor, state->nr_cbufs);
|
||||
|
||||
s->info.stage = stage;
|
||||
|
||||
/* Call out to Midgard compiler given the above NIR */
|
||||
|
|
|
@ -959,6 +959,10 @@ panfrost_variant_matches(
|
|||
}
|
||||
}
|
||||
|
||||
if (variant->info.stage == MESA_SHADER_FRAGMENT &&
|
||||
variant->nr_cbufs != ctx->pipe_framebuffer.nr_cbufs)
|
||||
return false;
|
||||
|
||||
/* Otherwise, we're good to go */
|
||||
return true;
|
||||
}
|
||||
|
@ -1054,6 +1058,8 @@ panfrost_bind_shader_state(
|
|||
|
||||
if (type == PIPE_SHADER_FRAGMENT) {
|
||||
struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
|
||||
v->nr_cbufs = fb->nr_cbufs;
|
||||
|
||||
for (unsigned i = 0; i < fb->nr_cbufs; ++i) {
|
||||
enum pipe_format fmt = PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||
|
||||
|
|
|
@ -216,7 +216,9 @@ struct panfrost_shader_state {
|
|||
/* GPU-executable memory */
|
||||
struct panfrost_bo *bo;
|
||||
|
||||
/* Variants */
|
||||
enum pipe_format rt_formats[8];
|
||||
unsigned nr_cbufs;
|
||||
};
|
||||
|
||||
/* A collection of varyings (the CSO) */
|
||||
|
|
|
@ -130,6 +130,7 @@ struct panfrost_compile_inputs {
|
|||
bool no_ubo_to_push;
|
||||
|
||||
enum pipe_format rt_formats[8];
|
||||
unsigned nr_cbufs;
|
||||
};
|
||||
|
||||
struct pan_shader_varying {
|
||||
|
|
Loading…
Reference in New Issue