llvmpipe: fix PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS query
[mesa.git] / src / gallium / drivers / llvmpipe / lp_jit.c
index b10ee7a463a3d1f258051b5db03ca2ef30208472..8e6dfb293d04326b67470971648703ff8a3bb617 100644 (file)
@@ -38,7 +38,7 @@
 #include "util/u_memory.h"
 #include "util/u_cpu_detect.h"
 #include "gallivm/lp_bld_init.h"
-#include "lp_debug.h"
+#include "gallivm/lp_bld_debug.h"
 #include "lp_screen.h"
 #include "gallivm/lp_bld_intr.h"
 #include "lp_jit.h"
@@ -103,10 +103,6 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
       elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType();
       elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] = LLVMInt32Type();
       elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32Type();
-      elem_types[LP_JIT_CTX_SCISSOR_XMIN] = LLVMFloatType();
-      elem_types[LP_JIT_CTX_SCISSOR_YMIN] = LLVMFloatType();
-      elem_types[LP_JIT_CTX_SCISSOR_XMAX] = LLVMFloatType();
-      elem_types[LP_JIT_CTX_SCISSOR_YMAX] = LLVMFloatType();
       elem_types[LP_JIT_CTX_BLEND_COLOR] = LLVMPointerType(LLVMInt8Type(), 0);
       elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
                                                       PIPE_MAX_SAMPLERS);
@@ -125,18 +121,6 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_back,
                              screen->target, context_type,
                              LP_JIT_CTX_STENCIL_REF_BACK);
-      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin,
-                             screen->target, context_type,
-                             LP_JIT_CTX_SCISSOR_XMIN);
-      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymin,
-                             screen->target, context_type,
-                             LP_JIT_CTX_SCISSOR_YMIN);
-      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmax,
-                             screen->target, context_type,
-                             LP_JIT_CTX_SCISSOR_XMAX);
-      LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymax,
-                             screen->target, context_type,
-                             LP_JIT_CTX_SCISSOR_YMAX);
       LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
                              screen->target, context_type,
                              LP_JIT_CTX_BLEND_COLOR);
@@ -151,8 +135,9 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
       screen->context_ptr_type = LLVMPointerType(context_type, 0);
    }
 
-   if (LP_DEBUG & DEBUG_JIT)
+   if (gallivm_debug & GALLIVM_DEBUG_IR) {
       LLVMDumpModule(screen->module);
+   }
 }
 
 
@@ -180,7 +165,7 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
    screen->pass = LLVMCreateFunctionPassManager(screen->provider);
    LLVMAddTargetData(screen->target, screen->pass);
 
-   if ((LP_DEBUG & DEBUG_NO_LLVM_OPT) == 0) {
+   if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
       /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
        * but there are more on SVN. */
       /* TODO: Add more passes */
@@ -195,6 +180,11 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
          LLVMAddInstructionCombiningPass(screen->pass);
       }
       LLVMAddGVNPass(screen->pass);
+   } else {
+      /* We need at least this pass to prevent the backends to fail in
+       * unexpected ways.
+       */
+      LLVMAddPromoteMemoryToRegisterPass(screen->pass);
    }
 
    lp_jit_init_globals(screen);