/** Constant state objects */
const struct pipe_blend_state *blend;
- const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+
const struct pipe_depth_stencil_alpha_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
struct lp_fragment_shader *fs;
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- 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 *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct pipe_index_buffer index_buffer;
} so_target;
struct pipe_resource *mapped_vs_tex[PIPE_MAX_VERTEX_SAMPLERS];
- unsigned num_samplers;
- unsigned num_fragment_sampler_views;
- unsigned num_vertex_samplers;
- unsigned num_vertex_sampler_views;
+ unsigned num_samplers[PIPE_SHADER_TYPES];
+ unsigned num_sampler_views[PIPE_SHADER_TYPES];
+
unsigned num_vertex_buffers;
unsigned dirty; /**< Mask of LP_NEW_x flags */
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == llvmpipe->num_samplers &&
- !memcmp(llvmpipe->sampler, sampler, num * sizeof(void *)))
+ if (num == llvmpipe->num_samplers[PIPE_SHADER_FRAGMENT] &&
+ !memcmp(llvmpipe->samplers[PIPE_SHADER_FRAGMENT], sampler, num * sizeof(void *)))
return;
draw_flush(llvmpipe->draw);
for (i = 0; i < num; ++i)
- llvmpipe->sampler[i] = sampler[i];
+ llvmpipe->samplers[PIPE_SHADER_FRAGMENT][i] = sampler[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
- llvmpipe->sampler[i] = NULL;
+ llvmpipe->samplers[PIPE_SHADER_FRAGMENT][i] = NULL;
- llvmpipe->num_samplers = num;
+ llvmpipe->num_samplers[PIPE_SHADER_FRAGMENT] = num;
llvmpipe->dirty |= LP_NEW_SAMPLER;
}
assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS);
/* Check for no-op */
- if (num_samplers == llvmpipe->num_vertex_samplers &&
- !memcmp(llvmpipe->vertex_samplers, samplers, num_samplers * sizeof(void *)))
+ if (num_samplers == llvmpipe->num_samplers[PIPE_SHADER_VERTEX] &&
+ !memcmp(llvmpipe->samplers[PIPE_SHADER_VERTEX], samplers, num_samplers * sizeof(void *)))
return;
draw_flush(llvmpipe->draw);
for (i = 0; i < num_samplers; ++i)
- llvmpipe->vertex_samplers[i] = samplers[i];
+ llvmpipe->samplers[PIPE_SHADER_VERTEX][i] = samplers[i];
for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
- llvmpipe->vertex_samplers[i] = NULL;
+ llvmpipe->samplers[PIPE_SHADER_VERTEX][i] = NULL;
- llvmpipe->num_vertex_samplers = num_samplers;
+ llvmpipe->num_samplers[PIPE_SHADER_VERTEX] = num_samplers;
draw_set_samplers(llvmpipe->draw,
- llvmpipe->vertex_samplers,
- llvmpipe->num_vertex_samplers);
+ llvmpipe->samplers[PIPE_SHADER_VERTEX],
+ llvmpipe->num_samplers[PIPE_SHADER_VERTEX]);
llvmpipe->dirty |= LP_NEW_SAMPLER;
}
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == llvmpipe->num_fragment_sampler_views &&
- !memcmp(llvmpipe->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
+ if (num == llvmpipe->num_sampler_views[PIPE_SHADER_FRAGMENT] &&
+ !memcmp(llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT], views, num * sizeof(struct pipe_sampler_view *)))
return;
draw_flush(llvmpipe->draw);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], view);
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], view);
}
- llvmpipe->num_fragment_sampler_views = num;
+ llvmpipe->num_sampler_views[PIPE_SHADER_FRAGMENT] = num;
llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
}
assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
/* Check for no-op */
- if (num == llvmpipe->num_vertex_sampler_views &&
- !memcmp(llvmpipe->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
+ if (num == llvmpipe->num_sampler_views[PIPE_SHADER_VERTEX] &&
+ !memcmp(llvmpipe->sampler_views[PIPE_SHADER_VERTEX], views, num * sizeof(struct pipe_sampler_view *))) {
return;
}
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], view);
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], view);
}
- llvmpipe->num_vertex_sampler_views = num;
+ llvmpipe->num_sampler_views[PIPE_SHADER_VERTEX] = num;
draw_set_sampler_views(llvmpipe->draw,
- llvmpipe->vertex_sampler_views,
- llvmpipe->num_vertex_sampler_views);
+ llvmpipe->sampler_views[PIPE_SHADER_VERTEX],
+ llvmpipe->num_sampler_views[PIPE_SHADER_VERTEX]);
llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
}