summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_context.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-05-25 01:02:46 -0400
committerZack Rusin <[email protected]>2013-05-25 09:49:20 -0400
commitd7d676252d2ae1fd6d3dd76d4e205251ad7c6152 (patch)
treeee2de4e74375ddb379c1da9f440231eb557216a3 /src/gallium/auxiliary/draw/draw_context.c
parent26fe24c47975f1484c193617a18cd2a9cdb65eb4 (diff)
draw: clamp the viewports to always be between 0 and max
If the viewport index is larger than the PIPE_MAX_VIEWPORTS, then the first (0-th) viewport should be used. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca<[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_context.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 63ccf386f29..58ce270cdd0 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -319,14 +319,12 @@ void draw_set_viewport_states( struct draw_context *draw,
const struct pipe_viewport_state *viewport = vps;
draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE);
- if (start_slot > PIPE_MAX_VIEWPORTS)
- return;
-
- if ((start_slot + num_viewports) > PIPE_MAX_VIEWPORTS)
- num_viewports = PIPE_MAX_VIEWPORTS - start_slot;
+ debug_assert(start_slot < PIPE_MAX_VIEWPORTS);
+ debug_assert((start_slot + num_viewports) <= PIPE_MAX_VIEWPORTS);
memcpy(draw->viewports + start_slot, vps,
sizeof(struct pipe_viewport_state) * num_viewports);
+
draw->identity_viewport = (num_viewports == 1) &&
(viewport->scale[0] == 1.0f &&
viewport->scale[1] == 1.0f &&