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.
21 files changed:
if (ctx == NULL)
goto out;
if (ctx == NULL)
goto out;
- assert(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS);
-
ctx->cache = cso_cache_create();
if (ctx->cache == NULL)
goto out;
ctx->cache = cso_cache_create();
if (ctx->cache == NULL)
goto out;
DRAW_TOTAL_CLIP_PLANES), 0);
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
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
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
#if HAVE_LLVM < 0x0300
unsigned j;
struct draw_jit_texture *jit_tex;
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];
jit_tex = &draw->llvm->jit_context.textures[sampler_idx];
float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
float *viewport;
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];
#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(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))
(PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
LLVMValueRef ptr;
LLVMValueRef res;
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);
/* context[0] */
indices[0] = lp_build_const_int32(gallivm, 0);
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_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],
lp_build_sample_soa(gallivm,
&sampler->dynamic_state.static_state[unit],
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_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],
lp_build_size_query_soa(gallivm,
&sampler->dynamic_state.static_state[unit],
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->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",
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,
}
pipe->bind_vertex_sampler_states(pipe,
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->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]);
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;
unwrapped_views[i] = NULL;
views = unwrapped_views;
*/
const struct i915_blend_state *blend;
const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
*/
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;
const struct i915_depth_stencil_state *depth_stencil;
const struct i915_rasterizer_state *rasterizer;
- 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;
unsigned num_samplers;
unsigned num_fragment_sampler_views;
switch (cap) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
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;
struct i915_context *i915 = i915_context(pipe);
unsigned i;
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 &&
/* Check for no-op */
if (num_samplers == i915->num_vertex_samplers &&
for (i = 0; i < num_samplers; ++i)
i915->vertex_samplers[i] = samplers[i];
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;
i915->vertex_samplers[i] = NULL;
i915->num_vertex_samplers = num_samplers;
unsigned num = i915->num_vertex_sampler_views;
struct pipe_sampler_view **views = i915->vertex_sampler_views;
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);
- 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) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
if (view) {
struct i915_context *i915 = i915_context(pipe);
uint i;
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 &&
/* Check for no-op */
if (num == i915->num_vertex_sampler_views &&
- 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);
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
pipe_sampler_view_reference(&i915->vertex_sampler_views[i], view);
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->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]);
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;
unwrapped_views[i] = NULL;
views = unwrapped_views;
pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL);
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);
}
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);
}
pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
}
int so_count[PIPE_MAX_SO_BUFFERS];
int num_buffers;
} so_target;
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];
unsigned num_samplers[PIPE_SHADER_TYPES];
unsigned num_sampler_views[PIPE_SHADER_TYPES];
{
switch (param) {
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
{
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:
case PIPE_CAP_NPOT_TEXTURES:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
* the draw module.
*/
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
* the draw module.
*/
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
- return PIPE_MAX_VERTEX_SAMPLERS;
+ return PIPE_MAX_SAMPLERS;
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
const void *data[PIPE_MAX_TEXTURE_LEVELS];
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);
- 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) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
if (view) {
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->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;
struct pipe_sampler_view **views = NULL;
unsigned i;
struct rbug_resource *fs_texs[PIPE_MAX_SAMPLERS];
unsigned num_fs_views;
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;
unsigned num_vs_views;
unsigned nr_cbufs;
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
uint i, sh;
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 );
util_init_math();
softpipe->dump_fs = debug_get_bool_option( "SOFTPIPE_DUMP_FS", FALSE );
draw_texture_samplers(softpipe->draw,
PIPE_SHADER_VERTEX,
draw_texture_samplers(softpipe->draw,
PIPE_SHADER_VERTEX,
- PIPE_MAX_VERTEX_SAMPLERS,
(struct tgsi_sampler **)
softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]);
draw_texture_samplers(softpipe->draw,
PIPE_SHADER_GEOMETRY,
(struct tgsi_sampler **)
softpipe->tgsi.samplers_list[PIPE_SHADER_VERTEX]);
draw_texture_samplers(softpipe->draw,
PIPE_SHADER_GEOMETRY,
- PIPE_MAX_GEOMETRY_SAMPLERS,
(struct tgsi_sampler **)
softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]);
(struct tgsi_sampler **)
softpipe->tgsi.samplers_list[PIPE_SHADER_GEOMETRY]);
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
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];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
{
switch (param) {
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
{
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:
case PIPE_CAP_NPOT_TEXTURES:
return 1;
case PIPE_CAP_TWO_SIDED_STENCIL:
/* Softpipe doesn't yet know how to tell draw/llvm about textures */
return 0;
else
/* 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);
default:
if (sp_screen->use_llvm)
return draw_get_shader_param(shader, param);
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_sampler_view *tr_view;
struct pipe_context *pipe = tr_ctx->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)
unsigned i;
if (!pipe->set_vertex_sampler_views)
#define PIPE_MAX_COLOR_BUFS 8
#define PIPE_MAX_CONSTANT_BUFFERS 32
#define PIPE_MAX_SAMPLERS 16
#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
#define PIPE_MAX_SHADER_INPUTS 32
#define PIPE_MAX_SHADER_OUTPUTS 32
#define PIPE_MAX_SHADER_SAMPLER_VIEWS 32
struct pipe_depth_stencil_alpha_state depth_stencil;
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS];
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;
struct pipe_clip_state clip;
struct {
void *ptr;
} constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
} 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;
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
unsigned sample_mask;