summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-04-01 11:30:17 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-04-01 11:30:17 -0600
commitc14da8f52407529f20f819e31a01356535de0117 (patch)
treed8730e5fad37e49e84b05991e1c069e421907098
parent6ddd2df1aec329be494d342dbd88a9f5af5e7b2c (diff)
cell: assert num samplers/textures <= CELL_MAX_SAMPLERS
-rw-r--r--src/gallium/drivers/cell/ppu/cell_pipe_state.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
index 52c3126050..67b87f16d7 100644
--- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c
+++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
@@ -232,12 +232,12 @@ cell_bind_sampler_states(struct pipe_context *pipe,
{
struct cell_context *cell = cell_context(pipe);
- draw_flush(cell->draw);
+ assert(num <= CELL_MAX_SAMPLERS);
- assert(unit < PIPE_MAX_SAMPLERS);
+ draw_flush(cell->draw);
memcpy(cell->sampler, samplers, num * sizeof(void *));
- memset(&cell->sampler[num], 0, (PIPE_MAX_SAMPLERS - num) *
+ memset(&cell->sampler[num], 0, (CELL_MAX_SAMPLERS - num) *
sizeof(void *));
cell->num_samplers = num;
@@ -261,6 +261,8 @@ cell_set_sampler_textures(struct pipe_context *pipe,
struct cell_context *cell = cell_context(pipe);
uint i;
+ assert(num <= CELL_MAX_SAMPLERS);
+
/* Check for no-op */
if (num == cell->num_textures &&
!memcmp(cell->texture, texture, num * sizeof(struct pipe_texture *)))
@@ -268,7 +270,7 @@ cell_set_sampler_textures(struct pipe_context *pipe,
draw_flush(cell->draw);
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
struct pipe_texture *tex = i < num ? texture[i] : NULL;
pipe_texture_reference((struct pipe_texture **) &cell->texture[i], tex);