Commit f5bfe54a authored by Marek Olšák's avatar Marek Olšák

gallium: add and use PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS

This removes:
- PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
- PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
in favor of the that new per-shader cap.
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 557c3feb
......@@ -408,6 +408,8 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return 1;
case PIPE_SHADER_CAP_INTEGERS:
return 1;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return PIPE_MAX_SAMPLERS;
default:
return 0;
}
......
......@@ -58,8 +58,6 @@ static int
cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return CELL_MAX_SAMPLERS;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return CELL_MAX_SAMPLERS;
case PIPE_CAP_NPOT_TEXTURES:
......@@ -107,7 +105,12 @@ cell_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
switch(shader)
{
case PIPE_SHADER_FRAGMENT:
return tgsi_exec_get_shader_param(param);
switch (param) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return CELL_MAX_SAMPLERS;
default:
return tgsi_exec_get_shader_param(param);
}
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return draw_get_shader_param(shader, param);
......
......@@ -140,11 +140,8 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
return is->debug.lie ? 1 : 0;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 8;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......@@ -178,7 +175,12 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
{
switch(shader) {
case PIPE_SHADER_VERTEX:
return draw_get_shader_param(shader, cap);
switch (cap) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 0;
default:
return draw_get_shader_param(shader, cap);
}
case PIPE_SHADER_FRAGMENT:
break;
default:
......@@ -220,6 +222,8 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
return 0;
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 8;
default:
debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);
return 0;
......
......@@ -154,10 +154,6 @@ static int
brw_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 8;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 8;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 16; /* XXX correct? */
case PIPE_CAP_NPOT_TEXTURES:
......@@ -245,6 +241,8 @@ brw_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shad
return 1;
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 8;
default:
assert(0);
return 0;
......
......@@ -104,17 +104,6 @@ static int
llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return PIPE_MAX_SAMPLERS;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
/* At this time, the draw module and llvmpipe driver only
* support vertex shader texture lookups when LLVM is enabled in
* the draw module.
*/
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
return PIPE_MAX_VERTEX_SAMPLERS;
else
return 0;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS;
case PIPE_CAP_NPOT_TEXTURES:
......@@ -183,7 +172,19 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
return tgsi_exec_get_shader_param(param);
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return draw_get_shader_param(shader, param);
switch (param) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
/* At this time, the draw module and llvmpipe driver only
* support vertex shader texture lookups when LLVM is enabled in
* the draw module.
*/
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
return PIPE_MAX_VERTEX_SAMPLERS;
else
return 0;
default:
return draw_get_shader_param(shader, param);
}
default:
return 0;
}
......
......@@ -77,9 +77,6 @@ static int
nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 32;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 64;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
......@@ -193,6 +190,8 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
return 0; /* please inline, or provide function declarations */
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 32;
default:
NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
return 0;
......
......@@ -68,9 +68,6 @@ static int
nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 32;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 64;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
......@@ -185,6 +182,8 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
return 1; /* but inlining everything, we need function declarations */
case PIPE_SHADER_CAP_INTEGERS:
return 1;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 32;
default:
NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
return 0;
......
......@@ -27,8 +27,6 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
struct nvfx_screen *screen = nvfx_screen(pscreen);
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 16;
case PIPE_CAP_NPOT_TEXTURES:
return screen->advertise_npot;
case PIPE_CAP_TWO_SIDED_STENCIL:
......@@ -60,8 +58,6 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 13;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return !!screen->use_nv4x;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 0; /* We have 4 on nv40 - but unsupported currently */
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return screen->advertise_blend_equation_separate;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
......@@ -137,6 +133,8 @@ nvfx_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum
return 0;
case PIPE_SHADER_CAP_SUBROUTINES:
return screen->use_nv4x ? 1 : 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 16;
default:
break;
}
......@@ -179,6 +177,8 @@ nvfx_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum
return 1;
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 0; /* We have 4 on nv40 - but unsupported currently */
default:
break;
}
......
......@@ -138,7 +138,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
case PIPE_CAP_SEAMLESS_CUBE_MAP:
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
case PIPE_CAP_SCALED_RESOLVE:
......@@ -152,7 +151,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
return !r300screen->caps.has_tcl;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return r300screen->caps.num_tex_units;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
......@@ -220,6 +218,8 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
case PIPE_SHADER_CAP_SUBROUTINES:
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return r300screen->caps.num_tex_units;
}
break;
case PIPE_SHADER_VERTEX:
......@@ -257,6 +257,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
case PIPE_SHADER_CAP_SUBROUTINES:
case PIPE_SHADER_CAP_INTEGERS:
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 0;
}
break;
......
......@@ -389,9 +389,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
return rscreen->info.drm_minor >= 9 ?
(family >= CHIP_CEDAR ? 16384 : 8192) : 0;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 16;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 32;
......@@ -491,6 +488,8 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
return 0;
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 16;
default:
return 0;
}
......
......@@ -64,15 +64,6 @@ static int
softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
{
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return PIPE_MAX_SAMPLERS;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
#ifdef HAVE_LLVM
/* Softpipe doesn't yet know how to tell draw/llvm about textures */
return 0;
#else
return PIPE_MAX_VERTEX_SAMPLERS;
#endif
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS;
case PIPE_CAP_NPOT_TEXTURES:
......@@ -147,7 +138,17 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
return tgsi_exec_get_shader_param(param);
case PIPE_SHADER_VERTEX:
case PIPE_SHADER_GEOMETRY:
return draw_get_shader_param(shader, param);
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
return PIPE_MAX_VERTEX_SAMPLERS;
#endif
default:
return draw_get_shader_param(shader, param);
}
default:
return 0;
}
......
......@@ -122,8 +122,6 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
return 16.0;
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 16;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 16;
case PIPE_CAP_NPOT_TEXTURES:
......@@ -256,6 +254,8 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
return 0;
case PIPE_SHADER_CAP_INTEGERS:
return 0;
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
return 16;
}
break;
case PIPE_SHADER_VERTEX:
......
......@@ -418,7 +418,6 @@ enum pipe_transfer_usage {
* pipe_screen::get_param() and pipe_screen::get_paramf().
*/
enum pipe_cap {
PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS = 0,
PIPE_CAP_NPOT_TEXTURES = 1,
PIPE_CAP_TWO_SIDED_STENCIL = 2,
PIPE_CAP_GLSL = 3, /* XXX need something better */
......@@ -444,7 +443,6 @@ enum pipe_cap {
PIPE_CAP_GUARD_BAND_RIGHT = 23, /*< float */
PIPE_CAP_GUARD_BAND_BOTTOM = 24, /*< float */
PIPE_CAP_TEXTURE_MIRROR_CLAMP = 25,
PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS = 27,
PIPE_CAP_BLEND_EQUATION_SEPARATE = 28,
PIPE_CAP_SM3 = 29, /*< Shader Model, supported */
PIPE_CAP_STREAM_OUTPUT = 30,
......@@ -496,7 +494,8 @@ enum pipe_shader_cap
PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR = 14,
PIPE_SHADER_CAP_INDIRECT_CONST_ADDR = 15,
PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */
PIPE_SHADER_CAP_INTEGERS = 17
PIPE_SHADER_CAP_INTEGERS = 17,
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18
};
......
......@@ -102,7 +102,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
}
screen_caps.stages_with_sampling = (1 << screen_caps.stages) - 1;
if(!screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS))
if(!screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS))
screen_caps.stages_with_sampling &=~ (1 << PIPE_SHADER_VERTEX);
memset(format_support, 0xff, sizeof(format_support));
......
......@@ -90,11 +90,13 @@ void st_init_limits(struct st_context *st)
= screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS);
c->MaxTextureImageUnits
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS),
= _min(screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
MAX_TEXTURE_IMAGE_UNITS);
c->MaxVertexTextureImageUnits
= _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS),
= _min(screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
MAX_VERTEX_TEXTURE_IMAGE_UNITS);
c->MaxCombinedTextureImageUnits
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment