pan/midgard: Lower txd with lower_tex
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 19 Dec 2019 16:12:50 +0000 (11:12 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 20 Dec 2019 08:10:39 +0000 (09:10 +0100)
This is a hack since we do have native gradient stuff, but for the
moment I'm more interested in conformance and the lowered code is good
enough. Fixes
dEQP-GLES3.functional.shaders.texture_functions.texturegrad.sampler2d_fixed_fragment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3169>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3169>

src/panfrost/midgard/midgard_compile.c

index ab62770c69e18ac6241d256a92411231af0bfd99..1e28b08e77dbf8612c345d9cb97df127972f3326 100644 (file)
@@ -494,7 +494,6 @@ optimise_nir(nir_shader *nir, unsigned quirks)
                 (nir->options->lower_flrp64 ? 64 : 0);
 
         NIR_PASS(progress, nir, nir_lower_regs_to_ssa);
-        NIR_PASS(progress, nir, midgard_nir_lower_fdot2);
         NIR_PASS(progress, nir, nir_lower_idiv, nir_lower_idiv_fast);
 
         nir_lower_tex_options lower_tex_options = {
@@ -502,10 +501,16 @@ optimise_nir(nir_shader *nir, unsigned quirks)
                 .lower_txp = ~0,
                 .lower_tex_without_implicit_lod =
                         (quirks & MIDGARD_EXPLICIT_LOD),
+
+                /* TODO: we have native gradient.. */
+                .lower_txd = true,
         };
 
         NIR_PASS(progress, nir, nir_lower_tex, &lower_tex_options);
 
+        /* Must lower fdot2 after tex is lowered */
+        NIR_PASS(progress, nir, midgard_nir_lower_fdot2);
+
         /* T720 is broken. */
 
         if (quirks & MIDGARD_BROKEN_LOD)