diff options
author | Marek Olšák <[email protected]> | 2011-09-27 22:22:06 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-09-30 23:19:52 +0200 |
commit | f5bfe54a34d9c8cd5de2b096d0e8486fe0d990a7 (patch) | |
tree | 5c61a58b22bd018661f8b4f12e5974bf07b18c20 /src | |
parent | 557c3febdfd88ba1a41d3e8e0221e447d491c343 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_screen.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_screen.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/i965/brw_screen.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_screen.c | 25 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_screen.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_screen.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_screen.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 21 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 6 |
15 files changed, 64 insertions, 56 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index a7507157906..223da2cb1c6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -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; } diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index a98529dc777..14a6173ff35 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -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); diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index e0f44cd4ee8..3d601a5911d 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -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; diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 39e9e2fa6ac..076338ad550 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -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; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 11a264cc5dc..7848d80f739 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -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; } diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 59d2dfafa47..bd405a78f87 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -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; diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 695144e5510..a28c7d76c07 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -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; diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 49bd9323137..50f346700d8 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -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; } diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 5e3aeee2efb..deb14287df9 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -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; diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index f1d8360d7b2..25e7c43f4dc 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -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; } diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 9c6e4c4c4ca..24852a53976 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -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; } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index e0027f34798..a624cd996a3 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -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: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index e562e491284..950672c9171 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -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 }; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 9d8bbd89537..ca2636cb6ba 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -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)); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 27fff39a8b6..2be191cc10e 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -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 |