From a7f1ebda2c7475b8600aab85390679ad67256bcf Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Fri, 30 Jul 2021 16:53:53 -0700 Subject: [PATCH] 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 Reviewed-by: Neha Bhende Reviewed-by: Roland Scheidegger Cc: 21.2 mesa-stable (cherry picked from commit 6751d832c5a3fd437216361a1a55f1fa1d0aed9b) Part-of: --- 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); }