From: Dave Airlie <airl...@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.
v2: since 3e22c7a25321554a32fa6254485912fd53deff3a we can ask draw for a non-llvm context. Just track if ask and set the vars accordingly. This probably isn't perfect but should cover the cases we care about. Signed-off-by: Dave Airlie <airl...@redhat.com> --- src/gallium/drivers/softpipe/sp_context.c | 2 +- src/gallium/drivers/softpipe/sp_screen.c | 26 +++++++++++++++++++++++--- src/gallium/drivers/softpipe/sp_screen.h | 3 ++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e533e5a..779832e 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -304,7 +304,7 @@ softpipe_create_context( struct pipe_screen *screen, /* * Create drawing context and plug our rendering stage into it. */ - if (debug_get_bool_option("SOFTPIPE_USE_LLVM", FALSE)) + if (softpipe_using_draw_llvm()) softpipe->draw = draw_create(&softpipe->pipe); else softpipe->draw = draw_create_no_llvm(&softpipe->pipe); diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 982af6b..bedf0b0 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -45,6 +45,20 @@ #include "sp_fence.h" #include "sp_public.h" +boolean +softpipe_using_draw_llvm(void) +{ + static int using_draw_llvm = -1; + + if (using_draw_llvm == -1) { + if (debug_get_bool_option("SOFTPIPE_USE_LLVM", FALSE)) + using_draw_llvm = 1; + else + using_draw_llvm = 0; + } + + return using_draw_llvm ? TRUE : FALSE; +} static const char * softpipe_get_vendor(struct pipe_screen *screen) @@ -144,11 +158,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 (softpipe_using_draw_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 (softpipe_using_draw_llvm()) + return 0; #endif + /* fallthrough */ default: return draw_get_shader_param(shader, param); } diff --git a/src/gallium/drivers/softpipe/sp_screen.h b/src/gallium/drivers/softpipe/sp_screen.h index f741454..0a19bba 100644 --- a/src/gallium/drivers/softpipe/sp_screen.h +++ b/src/gallium/drivers/softpipe/sp_screen.h @@ -48,7 +48,8 @@ struct softpipe_screen { unsigned timestamp; }; - +boolean +softpipe_using_draw_llvm(void); static INLINE struct softpipe_screen * -- 1.7.7.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev