draw, st/mesa: generate TGSI for ffvp/ARB_vp if draw lacks LLVM
authorMarek Olšák <marek.olsak@amd.com>
Wed, 4 Dec 2019 22:27:13 +0000 (17:27 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 Dec 2019 02:09:28 +0000 (21:09 -0500)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/mesa/state_tracker/st_program.c

index 5e2e2580fb666940ac960220f572f88206f992b1..fb0b22eae4394e8e1a36913928ef4911d3cb5db5 100644 (file)
@@ -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.
index 0170f13e73557fdfd8875450f15a69780073f4f8..c58c12cc497d78d00715ba97f72d7f5b38f6dcd1 100644 (file)
@@ -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
index 1beba6317b6f7d9a0b54e842214fd5925fb23554..84fd8e320af81c4a7ea84e4eee0fec21bc92c940 100644 (file)
@@ -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;