panfrost: Generate shader variants on framebuffer bind
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 10 Jul 2020 16:12:14 +0000 (12:12 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 13:35:11 +0000 (13:35 +0000)
If we keyed the shader for the framebuffer.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

src/gallium/drivers/panfrost/pan_context.c

index 56706a5fe46cd4e6a16d4b035d9bd6c3343b08d5..70ef7249362d7a440d9a1cec0c6bd62a1a2e1b4f 100644 (file)
@@ -1147,6 +1147,13 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
         util_copy_framebuffer_state(&ctx->pipe_framebuffer, fb);
         ctx->batch = NULL;
         panfrost_invalidate_frame(ctx);
+
+        /* We may need to generate a new variant if the fragment shader is
+         * keyed to the framebuffer format (due to EXT_framebuffer_fetch) */
+        struct panfrost_shader_variants *fs = ctx->shader[PIPE_SHADER_FRAGMENT];
+
+        if (fs && fs->variant_count && fs->variants[fs->active_variant].outputs_read)
+                ctx->base.bind_fs_state(&ctx->base, fs);
 }
 
 static void *