aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_context.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-08-09 20:59:44 -0600
committerBrian Paul <[email protected]>2012-08-16 09:01:31 -0600
commita2c1df4c9a7375bc5306e8cfd07a9f7087759a96 (patch)
tree92691c4d7786bd2decc45a393f4b5b2e496e685f /src/gallium/auxiliary/draw/draw_context.c
parentbef196c7929606bb8c7e9c06fe83a90fc0d95f09 (diff)
draw: index samplers and sampler_view state by shader type
So that we can handle GS state and other types of shaders in the future.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 3c9c7f1690e..9ca4191aee2 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -760,16 +760,15 @@ draw_set_sampler_views(struct draw_context *draw,
{
unsigned i;
- if (shader_stage == PIPE_SHADER_VERTEX) {
- debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
+ debug_assert(num <= Elements(draw->sampler_views));
+ debug_assert(shader_stage <= PIPE_SHADER_TYPES);
- 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[shader_stage][i] = views[i];
+ for (i = num; i < Elements(draw->sampler_views); ++i)
+ draw->sampler_views[shader_stage][i] = NULL;
- draw->num_sampler_views = num;
- }
+ draw->num_sampler_views[shader_stage] = num;
}
void
@@ -780,21 +779,20 @@ draw_set_samplers(struct draw_context *draw,
{
unsigned i;
- if (shader_stage == PIPE_SHADER_VERTEX) {
- debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
+ debug_assert(num <= Elements(draw->samplers));
+ debug_assert(shader_stage <= PIPE_SHADER_TYPES);
- 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[shader_stage][i] = samplers[i];
+ for (i = num; i < Elements(draw->samplers); ++i)
+ draw->samplers[shader_stage][i] = NULL;
- draw->num_samplers = num;
+ draw->num_samplers[shader_stage] = num;
#ifdef HAVE_LLVM
- if (draw->llvm)
- draw_llvm_set_sampler_state(draw);
+ if (draw->llvm && shader_stage == PIPE_SHADER_VERTEX)
+ draw_llvm_set_sampler_state(draw);
#endif
- }
}
void