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@anholt.net>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12176>
This commit is contained in:
Charmaine Lee
2021-07-30 16:53:53 -07:00
committed by Marge Bot
parent 0ddac113f8
commit 6751d832c5
+5 -2
View File
@@ -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);
}