Mesa (main): aux/draw: Check for preferred IR to take nir-to-tgsi path in draw module

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 3 23:00:19 UTC 2021


Module: Mesa
Branch: main
Commit: 6751d832c5a3fd437216361a1a55f1fa1d0aed9b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6751d832c5a3fd437216361a1a55f1fa1d0aed9b

Author: Charmaine Lee <charmainel at vmware.com>
Date:   Fri Jul 30 16:53:53 2021 -0700

aux/draw: Check for preferred IR to take nir-to-tgsi path in draw module

When a vertex program is translated to nir, it uses
nir_to_tgsi_compile_options for drivers with only nir-to-tgsi based
NIR support. But this compile option might not be the same as the NIR
compile option from llvmpipe, hence when the nir shader is bound
to the draw module, it hits an assertion in do_alu_action() when
encounters nir_op_fdot3.

With this patch, draw will take the nir-to-tgsi path if preferred IR
from the driver is TGSI.

Fixes assert running Maya on SVGA device.

Reviewed-by: Emma Anholt <emma at anholt.net>
Reviewed-by: Neha Bhende <bhenden at vmware.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12176>

---

 src/gallium/auxiliary/draw/draw_vs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index 20ecc2f1696..41e6c7a0417 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -68,8 +68,11 @@ draw_create_vertex_shader(struct draw_context *draw,
    if (draw->pt.middle.llvm) {
       struct pipe_screen *screen = draw->pipe->screen;
       if (shader->type == PIPE_SHADER_IR_NIR &&
-          (!screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
-                                     PIPE_SHADER_CAP_INTEGERS))) {
+          ((!screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
+                                     PIPE_SHADER_CAP_INTEGERS)) ||
+           (screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
+                                     PIPE_SHADER_CAP_PREFERRED_IR) ==
+            PIPE_SHADER_IR_TGSI))) {
         state.type = PIPE_SHADER_IR_TGSI;
         state.tokens = nir_to_tgsi(shader->ir.nir, screen);
       }



More information about the mesa-commit mailing list