summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c47
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h3
-rw-r--r--src/gallium/drivers/i915/i915_state.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c21
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c14
5 files changed, 51 insertions, 37 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,
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index c5ec0c6c076..8af26fa9dc5 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -325,6 +325,7 @@ i915_bind_vertex_sampler_states(struct pipe_context *pipe,
i915->num_vertex_samplers = num_samplers;
draw_set_samplers(i915->draw,
+ PIPE_SHADER_VERTEX,
i915->vertex_samplers,
i915->num_vertex_samplers);
}
@@ -405,6 +406,7 @@ i915_prepare_vertex_sampling(struct i915_context *i915)
}
draw_set_mapped_texture(i915->draw,
+ PIPE_SHADER_VERTEX,
i,
tex->width0, tex->height0, tex->depth0,
view->u.tex.first_level, tex->last_level,
@@ -792,6 +794,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe,
i915->num_vertex_sampler_views = num;
draw_set_sampler_views(i915->draw,
+ PIPE_SHADER_VERTEX,
i915->vertex_sampler_views,
i915->num_vertex_sampler_views);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 604a42e6cd0..121569ede73 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -88,13 +88,11 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe,
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;
@@ -150,13 +148,11 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe,
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;
@@ -279,6 +275,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
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,
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 93ae9178928..fe33508a332 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -90,10 +90,11 @@ softpipe_bind_sampler_states(struct pipe_context *pipe,
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;
@@ -183,10 +184,11 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
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;