Mesa (master): mesa/st: Lower shader images before handing off to NIR-to-TGSI.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 00:25:46 UTC 2021


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jan 11 15:43:54 2021 -0800

mesa/st: Lower shader images before handing off to NIR-to-TGSI.

Otherwise you'll just throw unknown intrinsic errors on drivers ignorant
of this NIR option.

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8488>

---

 src/mesa/state_tracker/st_program.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index e2a91d57cd0..3cec2d9ab8d 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -40,6 +40,7 @@
 #include "program/prog_to_nir.h"
 #include "program/programopt.h"
 
+#include "compiler/glsl/gl_nir.h"
 #include "compiler/nir/nir.h"
 #include "compiler/nir/nir_serialize.h"
 #include "draw/draw_context.h"
@@ -509,6 +510,12 @@ st_create_nir_shader(struct st_context *st, struct pipe_shader_state *state)
 
    if (PIPE_SHADER_IR_NIR !=
        screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_PREFERRED_IR)) {
+      /* u_screen.c defaults to images as deref enabled for some reason (which
+       * is what radeonsi wants), but nir-to-tgsi requires lowered images.
+       */
+      if (screen->get_param(screen, PIPE_CAP_NIR_IMAGES_AS_DEREF))
+         NIR_PASS_V(nir, gl_nir_lower_images, false);
+
       state->type = PIPE_SHADER_IR_TGSI;
       state->tokens = nir_to_tgsi(nir, screen);
    }



More information about the mesa-commit mailing list