summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-08-09 20:59:43 -0600
committerBrian Paul <[email protected]>2012-08-16 09:01:31 -0600
commitdf87fb59136eb302d72eac4b58fd8ffb25989ed5 (patch)
tree43bb960f0b5cadf1657294c1ea1368793a2de61c /src/gallium/auxiliary/draw
parenta8ed00d5f13d7b016bc2ea56f130adc3fa857cc8 (diff)
gallium: add a shader stage/type param to some draw functions
To prepare for geometry shader texture support in the draw module. Note: we still only handle the vertex shader case.
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c47
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h3
2 files changed, 31 insertions, 19 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index be30b7db245..dd4698be952 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -754,45 +754,52 @@ draw_set_so_state(struct draw_context *draw,
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,
@@ -800,12 +807,14 @@ draw_set_mapped_texture(struct draw_context *draw,
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
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index cc95600c530..4a73ec8c37d 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -139,15 +139,18 @@ draw_texture_samplers(struct draw_context *draw,
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,