draw: pass sampler state down to llvm jit state
authorBrian Paul <brianp@vmware.com>
Wed, 29 Sep 2010 16:34:41 +0000 (10:34 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 29 Sep 2010 16:34:43 +0000 (10:34 -0600)
Fixes a regression caused from the change to make min/max lod dynamic
state.

https://bugs.freedesktop.org/show_bug.cgi?id=30437

src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h

index b07de76a498aa098996a5959f86ce11b540af7d1..032fcbbc70a22becbb77eced943163b9822b7d4d 100644 (file)
@@ -709,6 +709,11 @@ draw_set_samplers(struct draw_context *draw,
       draw->samplers[i] = NULL;
 
    draw->num_samplers = num;
+
+#ifdef HAVE_LLVM
+   if (draw->llvm)
+      draw_llvm_set_sampler_state(draw);
+#endif
 }
 
 void
index 5154c1f3c5f80b721ab2fed44902a7c3dceae064..4749bb57a53174e68bc836459c4378166e2c6f52 100644 (file)
@@ -44,6 +44,7 @@
 #include "tgsi/tgsi_dump.h"
 
 #include "util/u_cpu_detect.h"
+#include "util/u_math.h"
 #include "util/u_pointer.h"
 #include "util/u_string.h"
 
@@ -1089,6 +1090,23 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
    }
 }
 
+
+void
+draw_llvm_set_sampler_state(struct draw_context *draw)
+{
+   unsigned i;
+
+   for (i = 0; i < draw->num_samplers; i++) {
+      struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i];
+
+      jit_tex->min_lod = draw->samplers[i]->min_lod;
+      jit_tex->max_lod = draw->samplers[i]->max_lod;
+      jit_tex->lod_bias = draw->samplers[i]->lod_bias;
+      COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color);
+   }
+}
+
+
 void
 draw_llvm_destroy_variant(struct draw_llvm_variant *variant)
 {
index b881ef6113b60750a1fd46ac568fcb6b876685a7..d0a68ae412dd8b7b9b11c69e04522dff137c8853 100644 (file)
@@ -282,6 +282,9 @@ struct lp_build_sampler_soa *
 draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
                              LLVMValueRef context_ptr);
 
+void
+draw_llvm_set_sampler_state(struct draw_context *draw);
+
 void
 draw_llvm_set_mapped_texture(struct draw_context *draw,
                              unsigned sampler_idx,