[Mesa-dev] [PATCH 1/3] draw: draw_get_shader_param should return correct values WRT llvm

Marek Olšák maraeo at gmail.com
Tue Jul 3 17:35:37 PDT 2012


---
 src/gallium/auxiliary/draw/draw_context.c |   34 ++++++++++++++++++++++++++--
 src/gallium/auxiliary/draw/draw_context.h |   13 +---------
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 2eae204..b1501c7 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -43,10 +43,12 @@
 #if HAVE_LLVM
 #include "gallivm/lp_bld_init.h"
 #include "draw_llvm.h"
+#endif
 
 static boolean
-draw_get_option_use_llvm(void)
+draw_can_use_llvm(void)
 {
+#if HAVE_LLVM
    static boolean first = TRUE;
    static boolean value;
    if (first) {
@@ -61,8 +63,10 @@ draw_get_option_use_llvm(void)
 #endif
    }
    return value;
-}
+#else
+   return FALSE;
 #endif
+}
 
 
 /**
@@ -77,7 +81,7 @@ draw_create_context(struct pipe_context *pipe, boolean try_llvm,
       goto err_out;
 
 #if HAVE_LLVM
-   if (try_llvm && draw_get_option_use_llvm()) {
+   if (try_llvm && draw_can_use_llvm()) {
       if (!gallivm) {
          gallivm = gallivm_create();
          draw->own_gallivm = gallivm;
@@ -830,3 +834,27 @@ draw_set_mapped_texture(struct draw_context *draw,
                                 row_stride, img_stride, data);
 #endif
 }
+
+int
+draw_get_shader_param(unsigned shader, enum pipe_shader_cap param)
+{
+   switch(shader) {
+   case PIPE_SHADER_VERTEX:
+   case PIPE_SHADER_GEOMETRY:
+      if (draw_can_use_llvm()) {
+         /* XXX No idea what should be here. I only know it cannot do
+          * integers: */
+         switch (param) {
+         case PIPE_SHADER_CAP_INTEGERS:
+            return 0;
+         default:
+            return tgsi_exec_get_shader_param(param);
+         }
+      }
+      else {
+         return tgsi_exec_get_shader_param(param);
+      }
+   default:
+      return 0;
+   }
+}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 4cd0caf..01b82e5 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -277,16 +277,7 @@ boolean draw_need_pipeline(const struct draw_context *draw,
                            const struct pipe_rasterizer_state *rasterizer,
                            unsigned prim );
 
-static INLINE int
-draw_get_shader_param(unsigned shader, enum pipe_shader_cap param)
-{
-   switch(shader) {
-   case PIPE_SHADER_VERTEX:
-   case PIPE_SHADER_GEOMETRY:
-      return tgsi_exec_get_shader_param(param);
-   default:
-      return 0;
-   }
-}
+int
+draw_get_shader_param(unsigned shader, enum pipe_shader_cap param);
 
 #endif /* DRAW_CONTEXT_H */
-- 
1.7.4.1



More information about the mesa-dev mailing list