Mesa (master): draw: pass sampler state down to llvm jit state

Brian Paul brianp at kemper.freedesktop.org
Wed Sep 29 16:35:52 UTC 2010


Module: Mesa
Branch: master
Commit: 0cb545a7f2e823c85309013c4c41e9461f297d06
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cb545a7f2e823c85309013c4c41e9461f297d06

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Sep 29 10:34:41 2010 -0600

draw: pass sampler state down to llvm jit state

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 |    5 +++++
 src/gallium/auxiliary/draw/draw_llvm.c    |   18 ++++++++++++++++++
 src/gallium/auxiliary/draw/draw_llvm.h    |    3 +++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index b07de76..032fcbb 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -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
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 5154c1f..4749bb5 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -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)
 {
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index b881ef6..d0a68ae 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -283,6 +283,9 @@ 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,
                              uint32_t width, uint32_t height, uint32_t depth,




More information about the mesa-commit mailing list