From e1896948da317406fd0fc27096952badf1d3cffc Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 14 May 2014 11:06:21 -0400 Subject: [PATCH] freedreno/a3xx: add debug flag to expose glsl130 We are starting to add integer support to the compiler, which does not get exercised with glsl feature level 120 and without advertising integer support. But doing so breaks too many things right now. So for now use a debug flag to conditionally expose the functionality while it is in development. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_screen.c | 10 +++++++--- src/gallium/drivers/freedreno/freedreno_util.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 607f81fcc5c..2a346e9e619 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -69,6 +69,7 @@ static const struct debug_named_value debug_options[] = { {"noopt", FD_DBG_NOOPT , "Disable optimization passes in compiler"}, {"optmsgs", FD_DBG_OPTMSGS,"Enable optimizater debug messages"}, {"optdump", FD_DBG_OPTDUMP,"Dump shader DAG to .dot files"}, + {"glsl130", FD_DBG_GLSL130,"Temporary flag to enable GLSL 130 on a3xx+"}, DEBUG_NAMED_VALUE_END }; @@ -76,6 +77,7 @@ DEBUG_GET_ONCE_FLAGS_OPTION(fd_mesa_debug, "FD_MESA_DEBUG", debug_options, 0) int fd_mesa_debug = 0; bool fd_binning_enabled = true; +static bool glsl130 = false; static const char * fd_screen_get_name(struct pipe_screen *pscreen) @@ -188,7 +190,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 256; case PIPE_CAP_GLSL_FEATURE_LEVEL: - return 120; + return ((screen->gpu_id >= 300) && glsl130) ? 130 : 120; /* Unsupported features. */ case PIPE_CAP_INDEP_BLEND_ENABLE: @@ -243,7 +245,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_QUERY_TIMESTAMP: return 0; case PIPE_CAP_OCCLUSION_QUERY: - return (screen->gpu_id >= 300) ? 1: 0; + return (screen->gpu_id >= 300) ? 1 : 0; case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET: case PIPE_CAP_MIN_TEXEL_OFFSET: @@ -345,7 +347,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, /* we should be able to support this on a3xx, but not * implemented yet: */ - return 0; + return ((screen->gpu_id >= 300) && glsl130) ? 1 : 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; @@ -412,6 +414,8 @@ fd_screen_create(struct fd_device *dev) if (fd_mesa_debug & FD_DBG_NOBIN) fd_binning_enabled = false; + glsl130 = !!(fd_mesa_debug & FD_DBG_GLSL130); + if (!screen) return NULL; diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index b57702c54c8..26e4231cdc4 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -65,6 +65,7 @@ enum adreno_stencil_op fd_stencil_op(unsigned op); #define FD_DBG_NOOPT 0x0200 #define FD_DBG_OPTMSGS 0x0400 #define FD_DBG_OPTDUMP 0x0800 +#define FD_DBG_GLSL130 0x1000 extern int fd_mesa_debug; extern bool fd_binning_enabled; -- 2.30.2