aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2012-08-24 11:27:22 +0100
committerJosé Fonseca <[email protected]>2012-08-24 11:28:00 +0100
commit3e3f99277df947a96029580dc4e66ae38a93f004 (patch)
tree0ab4fc580f7188e7850565902951a7b19dbd1b25 /src/gallium
parente84d45fdb73687019a6798cfb37b01291b212f4d (diff)
draw: Fix regression in draw_set_sampler(_views).
draw->samplers(_views) now has PIPE_SHADER_TYPES elements, instead of PIPE_MAX_SAMPLERS as before. Also, shader_stage must be less than PIPE_SHADER_TYPES to prevent buffer overflow. Trivial.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 4fc59a5d133..1aa9b615bc8 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -760,12 +760,12 @@ draw_set_sampler_views(struct draw_context *draw,
{
unsigned i;
- debug_assert(num <= Elements(draw->sampler_views));
- debug_assert(shader_stage <= PIPE_SHADER_TYPES);
+ debug_assert(shader_stage < PIPE_SHADER_TYPES);
+ debug_assert(num <= PIPE_MAX_SAMPLERS);
for (i = 0; i < num; ++i)
draw->sampler_views[shader_stage][i] = views[i];
- for (i = num; i < Elements(draw->sampler_views); ++i)
+ for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
draw->sampler_views[shader_stage][i] = NULL;
draw->num_sampler_views[shader_stage] = num;
@@ -779,12 +779,12 @@ draw_set_samplers(struct draw_context *draw,
{
unsigned i;
- debug_assert(num <= Elements(draw->samplers));
- debug_assert(shader_stage <= PIPE_SHADER_TYPES);
+ debug_assert(shader_stage < PIPE_SHADER_TYPES);
+ debug_assert(num <= PIPE_MAX_SAMPLERS);
for (i = 0; i < num; ++i)
draw->samplers[shader_stage][i] = samplers[i];
- for (i = num; i < Elements(draw->samplers); ++i)
+ for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
draw->samplers[shader_stage][i] = NULL;
draw->num_samplers[shader_stage] = num;