[Mesa-dev] [PATCH 2/2] draw/softpipe: allow softpipe to set shader params depending on runtime llvm
Dave Airlie
airlied at gmail.com
Tue Jan 10 03:49:03 PST 2012
From: Dave Airlie <airlied at redhat.com>
If draw isn't using llvm we can support vertex texture and integers,
These will be fixed up later, but for now allow this check to happen
at run-time.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/auxiliary/draw/draw_context.c | 10 ++++++++++
src/gallium/auxiliary/draw/draw_context.h | 2 ++
src/gallium/drivers/softpipe/sp_screen.c | 12 +++++++++---
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index f91e408..f1c9eb8 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -106,6 +106,16 @@ err_out:
return NULL;
}
+bool
+draw_using_llvm(void)
+{
+#if HAVE_LLVM
+ if (draw_get_option_use_llvm()) {
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
/**
* Create new draw module context, with LLVM JIT.
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 7655ad0..63ba0de 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -56,6 +56,8 @@ struct draw_context *draw_create( struct pipe_context *pipe );
struct draw_context *draw_create_no_llvm(struct pipe_context *pipe);
+bool draw_using_llvm(void);
+
struct draw_context *
draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm);
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 07f1970..090e8e5 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -141,11 +141,17 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
switch (param) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
#ifdef HAVE_LLVM
- /* Softpipe doesn't yet know how to tell draw/llvm about textures */
- return 0;
-#else
+ if (draw_using_llvm())
+ /* Softpipe doesn't yet know how to tell draw/llvm about textures */
+ return 0;
+#endif
return PIPE_MAX_VERTEX_SAMPLERS;
+ case PIPE_SHADER_CAP_INTEGERS:
+#ifdef HAVE_LLVM /* gallivm doesn't support integers yet */
+ if (draw_using_llvm())
+ return 0;
#endif
+ /* fallthrough */
default:
return draw_get_shader_param(shader, param);
}
--
1.7.7.4
More information about the mesa-dev
mailing list