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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 6 18:17:50 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: a7f1ebda2c7475b8600aab85390679ad67256bcf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7f1ebda2c7475b8600aab85390679ad67256bcf

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>
Cc: 21.2 mesa-stable

(cherry picked from commit 6751d832c5a3fd437216361a1a55f1fa1d0aed9b)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12200>

---

 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