From 41118246c6069db3a4443fb6b1ab872b6af1b2b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 4 Dec 2019 17:27:13 -0500 Subject: [PATCH] draw, st/mesa: generate TGSI for ffvp/ARB_vp if draw lacks LLVM Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/draw/draw_context.c | 9 +++++++++ src/gallium/auxiliary/draw/draw_context.h | 2 ++ src/mesa/state_tracker/st_program.c | 9 +++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 5e2e2580fb6..fb0b22eae43 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -63,6 +63,15 @@ draw_get_option_use_llvm(void) } #endif +bool +draw_has_llvm(void) +{ +#ifdef LLVM_AVAILABLE + return draw_get_option_use_llvm(); +#else + return false; +#endif +} /** * Create new draw module context with gallivm state for LLVM JIT. diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 0170f13e735..c58c12cc497 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -63,6 +63,8 @@ struct draw_so_target { int internal_offset; }; +bool draw_has_llvm(void); + struct draw_context *draw_create( struct pipe_context *pipe ); #ifdef LLVM_AVAILABLE diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 1beba6317b6..84fd8e320af 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -462,7 +462,11 @@ st_translate_vertex_program(struct st_context *st, stp->state.type = PIPE_SHADER_IR_NIR; stp->Base.nir = st_translate_prog_to_nir(st, &stp->Base, MESA_SHADER_VERTEX); - return true; + /* For st_draw_feedback, we need to generate TGSI too if draw doesn't + * use LLVM. + */ + if (draw_has_llvm()) + return true; } } @@ -578,7 +582,8 @@ st_create_vp_variant(struct st_context *st, state.stream_output = stvp->state.stream_output; - if (stvp->state.type == PIPE_SHADER_IR_NIR) { + if (stvp->state.type == PIPE_SHADER_IR_NIR && + (!key->is_draw_shader || draw_has_llvm())) { bool finalize = false; state.type = PIPE_SHADER_IR_NIR; -- 2.30.2