diff options
author | Brian Paul <[email protected]> | 2012-08-09 20:59:44 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-08-16 09:01:31 -0600 |
commit | cab2fed135bc1edf7b65ddca3236020638427061 (patch) | |
tree | 17a56b4023ad6345eb1a7baf9813da7dcf0469ff /src/gallium/drivers | |
parent | a2c1df4c9a7375bc5306e8cfd07a9f7087759a96 (diff) |
gallium: remove PIPE_MAX_VERTEX/GEOMETRY_SAMPLERS #define
PIPE_MAX_SAMPLERS, PIPE_MAX_VERTEX_SAMPLERS and PIPE_MAX_GEOMETRY_SAMPLERS
were all defined to the same value (16).
In various places we're creating arrays such as
sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS] so we were assuming
the same number of max samplers for all shader stages anyway.
Of course, drivers are still free to advertise different numbers of max
samplers for different shaders.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/galahad/glhd_context.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_context.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/identity/id_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_sampler.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/rbug/rbug_context.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/rbug/rbug_context.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_context.c | 2 |
15 files changed, 32 insertions, 36 deletions
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c index 01ab92341a0..dc7f017d91e 100644 --- a/src/gallium/drivers/galahad/glhd_context.c +++ b/src/gallium/drivers/galahad/glhd_context.c @@ -208,10 +208,10 @@ galahad_context_bind_vertex_sampler_states(struct pipe_context *_pipe, struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - if (num_samplers > PIPE_MAX_VERTEX_SAMPLERS) { + if (num_samplers > PIPE_MAX_SAMPLERS) { glhd_error("%u vertex samplers requested, " "but only %u are permitted by API", - num_samplers, PIPE_MAX_VERTEX_SAMPLERS); + num_samplers, PIPE_MAX_SAMPLERS); } pipe->bind_vertex_sampler_states(pipe, @@ -587,14 +587,14 @@ galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe, { struct galahad_context *glhd_pipe = galahad_context(_pipe); struct pipe_context *pipe = glhd_pipe->pipe; - struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view **views = NULL; unsigned i; if (_views) { for (i = 0; i < num; i++) unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]); - for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++) + for (; i < Elements(unwrapped_views); i++) unwrapped_views[i] = NULL; views = unwrapped_views; diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 16b0c57166d..c9198e270db 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -230,7 +230,7 @@ struct i915_context { */ const struct i915_blend_state *blend; const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_state *vertex_samplers[PIPE_MAX_SAMPLERS]; const struct i915_depth_stencil_state *depth_stencil; const struct i915_rasterizer_state *rasterizer; @@ -250,8 +250,8 @@ struct i915_context { unsigned dirty; - struct pipe_resource *mapped_vs_tex[PIPE_MAX_VERTEX_SAMPLERS]; - struct i915_winsys_buffer* mapped_vs_tex_buffer[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_resource *mapped_vs_tex[PIPE_MAX_SAMPLERS]; + struct i915_winsys_buffer* mapped_vs_tex_buffer[PIPE_MAX_SAMPLERS]; unsigned num_samplers; unsigned num_fragment_sampler_views; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 35b343e0de8..579337b0f23 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -107,7 +107,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha switch (cap) { case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: if (debug_get_bool_option("DRAW_USE_LLVM", TRUE)) - return PIPE_MAX_VERTEX_SAMPLERS; + return PIPE_MAX_SAMPLERS; else return 0; default: diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 8af26fa9dc5..fdbff8b4a4e 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -310,7 +310,7 @@ i915_bind_vertex_sampler_states(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); unsigned i; - assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS); + assert(num_samplers <= Elements(i915->vertex_samplers)); /* Check for no-op */ if (num_samplers == i915->num_vertex_samplers && @@ -319,7 +319,7 @@ i915_bind_vertex_sampler_states(struct pipe_context *pipe, for (i = 0; i < num_samplers; ++i) i915->vertex_samplers[i] = samplers[i]; - for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) + for (i = num_samplers; i < Elements(i915->vertex_samplers); ++i) i915->vertex_samplers[i] = NULL; i915->num_vertex_samplers = num_samplers; @@ -374,11 +374,11 @@ i915_prepare_vertex_sampling(struct i915_context *i915) unsigned num = i915->num_vertex_sampler_views; struct pipe_sampler_view **views = i915->vertex_sampler_views; - assert(num <= PIPE_MAX_VERTEX_SAMPLERS); + assert(num <= PIPE_MAX_SAMPLERS); if (!num) return; - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; if (view) { @@ -777,7 +777,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, struct i915_context *i915 = i915_context(pipe); uint i; - assert(num <= PIPE_MAX_VERTEX_SAMPLERS); + assert(num <= Elements(i915->vertex_sampler_views)); /* Check for no-op */ if (num == i915->num_vertex_sampler_views && @@ -785,7 +785,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, return; } - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + for (i = 0; i < Elements(i915->vertex_sampler_views); i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; pipe_sampler_view_reference(&i915->vertex_sampler_views[i], view); diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 2d47296f230..794e62ca1f2 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -517,14 +517,14 @@ identity_set_vertex_sampler_views(struct pipe_context *_pipe, { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; - struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view **views = NULL; unsigned i; if (_views) { for (i = 0; i < num; i++) unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]); - for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++) + for (; i < Elements(unwrapped_views); i++) unwrapped_views[i] = NULL; views = unwrapped_views; diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 7d0ca1f8cd8..dec34738029 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -69,11 +69,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL); - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) { pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL); } - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) { pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL); } diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index f8610ae8f0c..b7b7ede7eaf 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -86,7 +86,7 @@ struct llvmpipe_context { int so_count[PIPE_MAX_SO_BUFFERS]; int num_buffers; } so_target; - struct pipe_resource *mapped_vs_tex[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_resource *mapped_vs_tex[PIPE_MAX_SAMPLERS]; unsigned num_samplers[PIPE_SHADER_TYPES]; unsigned num_sampler_views[PIPE_SHADER_TYPES]; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 61aa1925eec..5f19a4753ba 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -105,7 +105,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_COMBINED_SAMPLERS: - return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS; + return 2 * PIPE_MAX_SAMPLERS; /* VS + FS samplers */ case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: @@ -234,7 +234,7 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe * the draw module. */ if (debug_get_bool_option("DRAW_USE_LLVM", TRUE)) - return PIPE_MAX_VERTEX_SAMPLERS; + return PIPE_MAX_SAMPLERS; else return 0; default: diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 121569ede73..8e30b5c634a 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -234,11 +234,11 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp, uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS]; const void *data[PIPE_MAX_TEXTURE_LEVELS]; - assert(num <= PIPE_MAX_VERTEX_SAMPLERS); + assert(num <= PIPE_MAX_SAMPLERS); if (!num) return; - for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; if (view) { diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 65f0d71031b..eb6230ed000 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -753,7 +753,7 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe, { struct rbug_context *rb_pipe = rbug_context(_pipe); struct pipe_context *pipe = rb_pipe->pipe; - struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view **views = NULL; unsigned i; diff --git a/src/gallium/drivers/rbug/rbug_context.h b/src/gallium/drivers/rbug/rbug_context.h index 80c803da83f..0a41bbd1047 100644 --- a/src/gallium/drivers/rbug/rbug_context.h +++ b/src/gallium/drivers/rbug/rbug_context.h @@ -54,8 +54,8 @@ struct rbug_context { struct rbug_resource *fs_texs[PIPE_MAX_SAMPLERS]; unsigned num_fs_views; - struct rbug_sampler_view *vs_views[PIPE_MAX_VERTEX_SAMPLERS]; - struct rbug_resource *vs_texs[PIPE_MAX_VERTEX_SAMPLERS]; + struct rbug_sampler_view *vs_views[PIPE_MAX_SAMPLERS]; + struct rbug_resource *vs_texs[PIPE_MAX_SAMPLERS]; unsigned num_vs_views; unsigned nr_cbufs; diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e2e32b9bd8c..0360b3ba9fb 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -216,10 +216,6 @@ softpipe_create_context( struct pipe_screen *screen, struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); uint i, sh; - /* Check since we have arrays[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS] */ - STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS); - STATIC_ASSERT(PIPE_MAX_SAMPLERS == PIPE_MAX_GEOMETRY_SAMPLERS); - util_init_math(); softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE ); @@ -290,13 +286,13 @@ softpipe_create_context( struct pipe_screen *screen, draw_texture_samplers(softpipe->draw, PIPE_SHADER_VERTEX, - PIPE_MAX_VERTEX_SAMPLERS, + PIPE_MAX_SAMPLERS, (struct tgsi_sampler **) softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]); draw_texture_samplers(softpipe->draw, PIPE_SHADER_GEOMETRY, - PIPE_MAX_GEOMETRY_SAMPLERS, + PIPE_MAX_SAMPLERS, (struct tgsi_sampler **) softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]); diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 2185fb85277..44599dd4845 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -79,7 +79,7 @@ struct softpipe_context { struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; - struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_GEOMETRY_SAMPLERS]; + struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 5588611edcf..98a3e093f82 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -67,7 +67,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_COMBINED_SAMPLERS: - return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS; + return 2 * PIPE_MAX_SAMPLERS; /* VS + FS */ case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: @@ -190,7 +190,7 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe /* Softpipe doesn't yet know how to tell draw/llvm about textures */ return 0; else - return PIPE_MAX_VERTEX_SAMPLERS; + return PIPE_MAX_SAMPLERS; default: if (sp_screen->use_llvm) return draw_get_shader_param(shader, param); diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ffaa3d06939..17f7e95087f 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -998,7 +998,7 @@ trace_context_set_vertex_sampler_views(struct pipe_context *_pipe, struct trace_context *tr_ctx = trace_context(_pipe); struct trace_sampler_view *tr_view; struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS]; unsigned i; if (!pipe->set_vertex_sampler_views) |