summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_screen.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-01-05 14:25:04 +0000
committerDave Airlie <[email protected]>2012-01-11 07:13:27 +0000
commit02932f37fa030f2d438b599106651cb938c3edc9 (patch)
treec2c6d110b141a58cab943fe9079bcc9860627b45 /src/gallium/drivers/softpipe/sp_screen.c
parent092cf9a5b598710c12739b4cdb50649cd66fe231 (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]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_screen.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c16
1 files changed, 13 insertions, 3 deletions
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);