pan/bi: Handle info.fs.untyped_color_outputs on Valhall
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 19 Aug 2022 18:56:18 +0000 (14:56 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sun, 21 Aug 2022 19:37:10 +0000 (19:37 +0000)
Colour outputs in TGSI are untyped so we have to ignore the register format on
the store_output. Luckily, Valhall gives us the auto32 escape hatch to deal with
it, and Bifrost doesn't care anyway. This will avoid regressions from native int
output without corrupting the compiler for GLSL and SPIR-V shaders that are
well-typed.

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

src/panfrost/bifrost/bifrost_compile.c

index cedf32b..db4ec22 100644 (file)
@@ -770,6 +770,10 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T,
         uint64_t blend_desc = inputs->blend.bifrost_blend_desc;
         enum bi_register_format regfmt = bi_reg_fmt_for_nir(T);
 
+        /* Workaround for NIR-to-TGSI */
+        if (b->shader->nir->info.fs.untyped_color_outputs)
+                regfmt = BI_REGISTER_FORMAT_AUTO;
+
         if (inputs->is_blend && inputs->blend.nr_samples > 1) {
                 /* Conversion descriptor comes from the compile inputs, pixel
                  * indices derived at run time based on sample ID */