To prepare for geometry shader texture support in the draw module.
Note: we still only handle the vertex shader case.
void
draw_set_sampler_views(struct draw_context *draw,
+ unsigned shader_stage,
struct pipe_sampler_view **views,
unsigned num)
{
unsigned i;
- debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
+ if (shader_stage == PIPE_SHADER_VERTEX) {
+ debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
- for (i = 0; i < num; ++i)
- draw->sampler_views[i] = views[i];
- for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
- draw->sampler_views[i] = NULL;
+ for (i = 0; i < num; ++i)
+ draw->sampler_views[i] = views[i];
+ for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
+ draw->sampler_views[i] = NULL;
- draw->num_sampler_views = num;
+ draw->num_sampler_views = num;
+ }
}
void
draw_set_samplers(struct draw_context *draw,
+ unsigned shader_stage,
struct pipe_sampler_state **samplers,
unsigned num)
{
unsigned i;
- debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
+ if (shader_stage == PIPE_SHADER_VERTEX) {
+ debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
- for (i = 0; i < num; ++i)
- draw->samplers[i] = samplers[i];
- for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
- draw->samplers[i] = NULL;
+ for (i = 0; i < num; ++i)
+ draw->samplers[i] = samplers[i];
+ for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
+ draw->samplers[i] = NULL;
- draw->num_samplers = num;
+ draw->num_samplers = num;
#ifdef HAVE_LLVM
- if (draw->llvm)
- draw_llvm_set_sampler_state(draw);
+ if (draw->llvm)
+ draw_llvm_set_sampler_state(draw);
#endif
+ }
}
void
draw_set_mapped_texture(struct draw_context *draw,
+ unsigned shader_stage,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
{
+ if (shader_stage == PIPE_SHADER_VERTEX) {
#ifdef HAVE_LLVM
- if(draw->llvm)
- draw_llvm_set_mapped_texture(draw,
- sampler_idx,
- width, height, depth, first_level, last_level,
- row_stride, img_stride, data);
+ if (draw->llvm)
+ draw_llvm_set_mapped_texture(draw,
+ sampler_idx,
+ width, height, depth, first_level, last_level,
+ row_stride, img_stride, data);
+ }
#endif
}
void
draw_set_sampler_views(struct draw_context *draw,
+ unsigned shader_stage,
struct pipe_sampler_view **views,
unsigned num);
void
draw_set_samplers(struct draw_context *draw,
+ unsigned shader_stage,
struct pipe_sampler_state **samplers,
unsigned num);
void
draw_set_mapped_texture(struct draw_context *draw,
+ unsigned shader_stage,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
i915->num_vertex_samplers = num_samplers;
draw_set_samplers(i915->draw,
+ PIPE_SHADER_VERTEX,
i915->vertex_samplers,
i915->num_vertex_samplers);
}
}
draw_set_mapped_texture(i915->draw,
+ PIPE_SHADER_VERTEX,
i,
tex->width0, tex->height0, tex->depth0,
view->u.tex.first_level, tex->last_level,
i915->num_vertex_sampler_views = num;
draw_set_sampler_views(i915->draw,
+ PIPE_SHADER_VERTEX,
i915->vertex_sampler_views,
i915->num_vertex_sampler_views);
}
llvmpipe->num_samplers[shader] = num;
- /* XXX call draw_set_samplers() here for geometry shaders once
- * draw_set_samplers() is extended to accept a shader argument.
- */
- if (shader == PIPE_SHADER_VERTEX) {
+ if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
draw_set_samplers(llvmpipe->draw,
- llvmpipe->samplers[PIPE_SHADER_VERTEX],
- llvmpipe->num_samplers[PIPE_SHADER_VERTEX]);
+ shader,
+ llvmpipe->samplers[shader],
+ llvmpipe->num_samplers[shader]);
}
llvmpipe->dirty |= LP_NEW_SAMPLER;
llvmpipe->num_sampler_views[shader] = num;
- /* XXX call draw_set_sampler_views() here for geometry shaders once
- * draw_set_sampler_views() is extended to accept a shader argument.
- */
- if (shader == PIPE_SHADER_VERTEX) {
+ if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
draw_set_sampler_views(llvmpipe->draw,
- llvmpipe->sampler_views[PIPE_SHADER_VERTEX],
- llvmpipe->num_sampler_views[PIPE_SHADER_VERTEX]);
+ shader,
+ llvmpipe->sampler_views[shader],
+ llvmpipe->num_sampler_views[shader]);
}
llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
assert(data[0]);
}
draw_set_mapped_texture(lp->draw,
+ PIPE_SHADER_VERTEX,
i,
tex->width0, tex->height0, tex->depth0,
view->u.tex.first_level, tex->last_level,
softpipe->num_samplers[shader] = num;
- if (shader == PIPE_SHADER_VERTEX) {
+ if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
draw_set_samplers(softpipe->draw,
- softpipe->samplers[PIPE_SHADER_VERTEX],
- softpipe->num_samplers[PIPE_SHADER_VERTEX]);
+ shader,
+ softpipe->samplers[shader],
+ softpipe->num_samplers[shader]);
}
softpipe->dirty |= SP_NEW_SAMPLER;
softpipe->num_sampler_views[shader] = num;
- if (shader == PIPE_SHADER_VERTEX) {
+ if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
draw_set_sampler_views(softpipe->draw,
- softpipe->sampler_views[PIPE_SHADER_VERTEX],
- softpipe->num_sampler_views[PIPE_SHADER_VERTEX]);
+ shader,
+ softpipe->sampler_views[shader],
+ softpipe->num_sampler_views[shader]);
}
softpipe->dirty |= SP_NEW_TEXTURE;