diff options
author | Roland Scheidegger <sroland@vmware.com> | 2014-06-23 22:06:15 +0200 |
---|---|---|
committer | Roland Scheidegger <sroland@vmware.com> | 2014-06-24 00:37:52 +0200 |
commit | 604e54de78aa00430b1d61d030656e387866e840 (patch) | |
tree | 1f03640a27b608674352f36c7d237a60105c8e47 /src/gallium/auxiliary/draw/draw_private.h | |
parent | f6a99d1167b14a3ada7c1d6f41a5cc6f13290e0d (diff) | |
download | external_mesa3d-604e54de78aa00430b1d61d030656e387866e840.zip external_mesa3d-604e54de78aa00430b1d61d030656e387866e840.tar.gz external_mesa3d-604e54de78aa00430b1d61d030656e387866e840.tar.bz2 |
draw: (trivial) fix clamping of viewport index
The old logic would let all negative values go through unclamped, with
potentially disastrous results (probably trying to fetch viewport values
from random memory locations). GL has undefined rendering for vp indices
outside valid range but that's a bit too undefined...
(The logic is now the same as in llvmpipe.)
CC: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_private.h')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_private.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 783c3ef..d8dc2ab 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -493,7 +493,7 @@ draw_stats_clipper_primitives(struct draw_context *draw, static INLINE unsigned draw_clamp_viewport_idx(int idx) { - return ((PIPE_MAX_VIEWPORTS > idx || idx < 0) ? idx : 0); + return ((PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0); } /** |