From: Roland Scheidegger Date: Tue, 26 Nov 2013 01:30:41 +0000 (+0100) Subject: gallium: new shader cap bit for the amount of sampler views X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2983c039df630bb9bcb70c52219c631e27b0eae6;p=mesa.git gallium: new shader cap bit for the amount of sampler views Ever since introducing separate sampler and sampler view max this was really missing. Every driver but llvmpipe reports the same number as number of samplers for now, so nothing should break. Reviewed-by: Jose Fonseca --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h b/src/gallium/auxiliary/gallivm/lp_bld_limits.h index 5675e367c4e..521b45b360a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h @@ -112,6 +112,8 @@ gallivm_get_shader_param(enum pipe_shader_cap param) return 1; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: return PIPE_MAX_SAMPLERS; + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: + return PIPE_MAX_SHADER_SAMPLER_VIEWS; case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: return 1; default: diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index a01f5480f52..035309da816 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -247,10 +247,12 @@ to be 0. BGNSUB, ENDSUB, CAL, and RET, including RET in the main block. * ``PIPE_SHADER_CAP_INTEGERS``: Whether integer opcodes are supported. If unsupported, only float opcodes are supported. -* ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: THe maximum number of texture +* ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: The maximum number of texture samplers. * ``PIPE_SHADER_CAP_PREFERRED_IR``: Preferred representation of the program. It should be one of the ``pipe_shader_ir`` enum values. +* ``PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS``: The maximum number of texture + sampler views. Must not be lower than PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS. .. _pipe_compute_cap: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 20adf21eec6..5dafa927aab 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -323,6 +323,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, */ return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; case PIPE_SHADER_CAP_PREFERRED_IR: return PIPE_SHADER_IR_TGSI; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 77607d0621d..5e1e18def91 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -106,6 +106,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha case PIPE_SHADER_VERTEX: switch (cap) { case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: if (debug_get_bool_option("DRAW_USE_LLVM", TRUE)) return PIPE_MAX_SAMPLERS; else @@ -151,6 +152,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha case PIPE_SHADER_CAP_INTEGERS: return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return I915_TEX_UNITS; default: debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap); diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index a345b70b658..d6e3f94fb18 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -141,6 +141,8 @@ ilo_get_shader_param(struct pipe_screen *screen, unsigned shader, return 1; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: return ILO_MAX_SAMPLERS; + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: + return ILO_MAX_SAMPLER_VIEWS; case PIPE_SHADER_CAP_PREFERRED_IR: return PIPE_SHADER_IR_TGSI; case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index f61df98fb94..81ebc69f4f5 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -262,6 +262,11 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe return PIPE_MAX_SAMPLERS; else return 0; + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: + if (debug_get_bool_option("DRAW_USE_LLVM", TRUE)) + return PIPE_MAX_SHADER_SAMPLER_VIEWS; + else + return 0; default: return draw_get_shader_param(shader, param); } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 807100ee0d0..26ff6812e50 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -190,6 +190,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, case PIPE_SHADER_CAP_MAX_TEMPS: return (eng3d->oclass >= NV40_3D_CLASS) ? 32 : 13; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 0; case PIPE_SHADER_CAP_MAX_ADDRS: return 2; @@ -228,6 +229,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, case PIPE_SHADER_CAP_MAX_ADDRS: return (eng3d->oclass >= NV40_3D_CLASS) ? 1 : 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; case PIPE_SHADER_CAP_MAX_PREDS: case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 0ce9e34f5e5..f7dfc98b70b 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -250,6 +250,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, case PIPE_SHADER_CAP_INTEGERS: return 1; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + /* The chip could handle more sampler views than samplers */ + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return MIN2(32, PIPE_MAX_SAMPLERS); default: NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index b203089ec08..cc5814e1f3e 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -253,10 +253,8 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, return 1; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: return 16; /* would be 32 in linked (OpenGL-style) mode */ - /* - case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLER_VIEWS: - return 32; - */ + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: + return 16; /* XXX not sure if more are really safe */ default: NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param); return 0; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 476770afe44..c21ee68348b 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -238,6 +238,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e case PIPE_SHADER_CAP_MAX_PREDS: return is_r500 ? 1 : 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return r300screen->caps.num_tex_units; case PIPE_SHADER_CAP_MAX_ADDRS: case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: @@ -257,6 +258,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e switch (param) { case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: case PIPE_SHADER_CAP_SUBROUTINES: return 0; default:; @@ -297,6 +299,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e case PIPE_SHADER_CAP_SUBROUTINES: case PIPE_SHADER_CAP_INTEGERS: case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 0; case PIPE_SHADER_CAP_PREFERRED_IR: return PIPE_SHADER_IR_TGSI; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 633c22a1cce..5e1d26216ac 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -597,6 +597,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e case PIPE_SHADER_CAP_INTEGERS: return 1; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; case PIPE_SHADER_CAP_PREFERRED_IR: if (shader == PIPE_SHADER_COMPUTE) { diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c index e662e7886b4..1ff8c14369d 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c +++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c @@ -492,6 +492,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e case PIPE_SHADER_CAP_SUBROUTINES: return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; case PIPE_SHADER_CAP_PREFERRED_IR: return PIPE_SHADER_IR_TGSI; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 47ef20ec59a..0ec0aad6714 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -204,13 +204,14 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe case PIPE_SHADER_GEOMETRY: switch (param) { case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: if (sp_screen->use_llvm) /* Softpipe doesn't yet know how to tell draw/llvm about textures */ return 0; - else + else return PIPE_MAX_SAMPLERS; default: - if (sp_screen->use_llvm) + if (sp_screen->use_llvm) return draw_get_shader_param(shader, param); else return draw_get_shader_param_no_llvm(shader, param); diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index c16be16a59f..977dec53dfe 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -332,6 +332,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en case PIPE_SHADER_CAP_INTEGERS: return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; default: debug_printf("Unexpected fragment shader query %u\n", param); @@ -382,6 +383,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en case PIPE_SHADER_CAP_INTEGERS: return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: + case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 0; default: debug_printf("Unexpected vertex shader query %u\n", param); diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index db6db32e744..7e71e771182 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -571,7 +571,8 @@ enum pipe_shader_cap PIPE_SHADER_CAP_INTEGERS = 17, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18, PIPE_SHADER_CAP_PREFERRED_IR = 19, - PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED = 20 + PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED = 20, + PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS = 21 }; /**