From 6ae4aff3035dd93cd589310674cecb541780e609 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 23 Jun 2014 22:06:15 +0200 Subject: 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" Reviewed-by: Jose Fonseca Reviewed-by: Ilia Mirkin Tested-by: Ilia Mirkin (cherry picked from commit 604e54de78aa00430b1d61d030656e387866e840) --- src/gallium/auxiliary/draw/draw_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 783c3efcc9b..d8dc2ab0bae 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); } /** -- cgit v1.2.3