Mesa (master): tgsi_to_nir: use pipe_screen::finalize_nir

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 24 01:15:11 UTC 2019


Module: Mesa
Branch: master
Commit: 43efccb65701e716d837d5d93b8b6e8fed0cec26
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43efccb65701e716d837d5d93b8b6e8fed0cec26

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Sep 27 14:55:58 2019 -0400

tgsi_to_nir: use pipe_screen::finalize_nir

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 3753ac75e92..bd0b47a856f 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -2626,7 +2626,7 @@ ttn_optimize_nir(nir_shader *nir)
  * so we have to do it here too.
  */
 static void
-ttn_finalize_nir(struct ttn_compile *c)
+ttn_finalize_nir(struct ttn_compile *c, struct pipe_screen *screen)
 {
    struct nir_shader *nir = c->build.shader;
 
@@ -2644,8 +2644,13 @@ ttn_finalize_nir(struct ttn_compile *c)
    if (!c->cap_samplers_as_deref)
       NIR_PASS_V(nir, nir_lower_samplers);
 
-   ttn_optimize_nir(nir);
-   nir_shader_gather_info(nir, c->build.impl);
+   if (screen->finalize_nir) {
+      screen->finalize_nir(screen, nir, true);
+   } else {
+      ttn_optimize_nir(nir);
+      nir_shader_gather_info(nir, c->build.impl);
+   }
+
    nir_validate_shader(nir, "TTN: after all optimizations");
 }
 
@@ -2658,7 +2663,7 @@ tgsi_to_nir(const void *tgsi_tokens,
 
    c = ttn_compile_init(tgsi_tokens, NULL, screen);
    s = c->build.shader;
-   ttn_finalize_nir(c);
+   ttn_finalize_nir(c, screen);
    ralloc_free(c);
 
    return s;




More information about the mesa-commit mailing list