diff options
21 files changed, 41 insertions, 49 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 7fb8caf1337..db4fa019a35 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -256,8 +256,6 @@ struct cso_context *cso_create_context( struct pipe_context *pipe ) if (ctx == NULL) goto out; - assert(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS); - ctx->cache = cso_cache_create(); if (ctx->cache == NULL) goto out; diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 133aa5f6983..ebfe437261c 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -164,7 +164,7 @@ create_jit_context_type(struct gallivm_state *gallivm, DRAW_TOTAL_CLIP_PLANES), 0); elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */ elem_types[4] = LLVMArrayType(texture_type, - PIPE_MAX_VERTEX_SAMPLERS); /* textures */ + PIPE_MAX_SAMPLERS); /* textures */ context_type = LLVMStructTypeInContext(gallivm->context, elem_types, Elements(elem_types), 0); #if HAVE_LLVM < 0x0300 @@ -1371,7 +1371,7 @@ draw_llvm_set_mapped_texture(struct draw_context *draw, unsigned j; struct draw_jit_texture *jit_tex; - assert(sampler_idx < PIPE_MAX_VERTEX_SAMPLERS); + assert(sampler_idx < Elements(draw->llvm->jit_context.textures)); jit_tex = &draw->llvm->jit_context.textures[sampler_idx]; diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 39d83cfe99f..9a291a47627 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -97,7 +97,7 @@ struct draw_jit_context float (*planes) [DRAW_TOTAL_CLIP_PLANES][4]; float *viewport; - struct draw_jit_texture textures[PIPE_MAX_VERTEX_SAMPLERS]; + struct draw_jit_texture textures[PIPE_MAX_SAMPLERS]; }; @@ -184,7 +184,7 @@ struct draw_llvm_variant_key #define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \ (sizeof(struct draw_llvm_variant_key) + \ - PIPE_MAX_VERTEX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \ + PIPE_MAX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \ (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element)) diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index 1dbe5f5bd19..53317165557 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -98,7 +98,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base, LLVMValueRef ptr; LLVMValueRef res; - debug_assert(unit < PIPE_MAX_VERTEX_SAMPLERS); + debug_assert(unit < PIPE_MAX_SAMPLERS); /* context[0] */ indices[0] = lp_build_const_int32(gallivm, 0); @@ -180,7 +180,7 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, { struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base; - assert(unit < PIPE_MAX_VERTEX_SAMPLERS); + assert(unit < PIPE_MAX_SAMPLERS); lp_build_sample_soa(gallivm, &sampler->dynamic_state.static_state[unit], @@ -207,7 +207,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, { struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base; - assert(unit < PIPE_MAX_VERTEX_SAMPLERS); + assert(unit < PIPE_MAX_SAMPLERS); lp_build_size_query_soa(gallivm, &sampler->dynamic_state.static_state[unit], 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) diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 76559ad2649..9ea9c0e3286 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -58,8 +58,6 @@ extern "C" { #define PIPE_MAX_COLOR_BUFS 8 #define PIPE_MAX_CONSTANT_BUFFERS 32 #define PIPE_MAX_SAMPLERS 16 -#define PIPE_MAX_VERTEX_SAMPLERS 16 -#define PIPE_MAX_GEOMETRY_SAMPLERS 16 #define PIPE_MAX_SHADER_INPUTS 32 #define PIPE_MAX_SHADER_OUTPUTS 32 #define PIPE_MAX_SHADER_SAMPLER_VIEWS 32 diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 0dfd81c1b79..8afd7766362 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -99,7 +99,7 @@ struct st_context struct pipe_depth_stencil_alpha_state depth_stencil; struct pipe_rasterizer_state rasterizer; struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_state vertex_samplers[PIPE_MAX_SAMPLERS]; struct pipe_clip_state clip; struct { void *ptr; @@ -107,7 +107,7 @@ struct st_context } constants[PIPE_SHADER_TYPES]; struct pipe_framebuffer_state framebuffer; struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_scissor_state scissor; struct pipe_viewport_state viewport; unsigned sample_mask; |