diff options
author | Dave Airlie <[email protected]> | 2012-01-05 14:25:04 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2012-01-11 07:13:27 +0000 |
commit | 02932f37fa030f2d438b599106651cb938c3edc9 (patch) | |
tree | c2c6d110b141a58cab943fe9079bcc9860627b45 | |
parent | 092cf9a5b598710c12739b4cdb50649cd66fe231 (diff) |
softpipe: allow softpipe to set shader params depending on runtime llvm (v3)
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.
v3: use debug option, restructure to store in screen, as suggested by Jakob.
Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.h | 6 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e533e5a8243..abe0507b1ac 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -50,7 +50,7 @@ #include "sp_tex_tile_cache.h" #include "sp_texture.h" #include "sp_query.h" - +#include "sp_screen.h" /** @@ -230,6 +230,7 @@ struct pipe_context * softpipe_create_context( struct pipe_screen *screen, void *priv ) { + struct softpipe_screen *sp_screen = softpipe_screen(screen); struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); uint i; @@ -304,7 +305,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 (sp_screen->using_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 982af6b3808..35521b64ab1 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -45,6 +45,7 @@ #include "sp_fence.h" #include "sp_public.h" +DEBUG_GET_ONCE_BOOL_OPTION(use_llvm, "SOFTPIPE_USE_LLVM", FALSE); static const char * softpipe_get_vendor(struct pipe_screen *screen) @@ -135,6 +136,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) static int softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param) { + struct softpipe_screen *sp_screen = softpipe_screen(screen); switch(shader) { case PIPE_SHADER_FRAGMENT: @@ -144,11 +146,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 (sp_screen->use_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 (sp_screen->use_llvm) + return 0; #endif + /* fallthrough */ default: return draw_get_shader_param(shader, param); } @@ -326,6 +334,8 @@ softpipe_create_screen(struct sw_winsys *winsys) screen->base.context_create = softpipe_create_context; screen->base.flush_frontbuffer = softpipe_flush_frontbuffer; + screen->using_llvm = debug_get_option_use_llvm(); + util_format_s3tc_init(); softpipe_init_screen_texture_funcs(&screen->base); diff --git a/src/gallium/drivers/softpipe/sp_screen.h b/src/gallium/drivers/softpipe/sp_screen.h index f741454c9e5..2cac81641a0 100644 --- a/src/gallium/drivers/softpipe/sp_screen.h +++ b/src/gallium/drivers/softpipe/sp_screen.h @@ -45,12 +45,10 @@ struct softpipe_screen { /* Increments whenever textures are modified. Contexts can track * this. */ - unsigned timestamp; + unsigned timestamp; + boolean using_llvm; }; - - - static INLINE struct softpipe_screen * softpipe_screen( struct pipe_screen *pipe ) { |