From c88ce3480c715ab40f4d488c86c90213b1472613 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 25 May 2013 01:04:17 -0400 Subject: llvmpipe: clamp scissors to be between 0 and max MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to clamp to make sure invalid shader doesn't crash our driver. The spec says to return 0-th index for everything that's out of bounds. Signed-off-by: Zack Rusin Reviewed-by: José Fonseca Reviewed-by: Brian Paul --- src/gallium/drivers/llvmpipe/lp_setup.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium/drivers/llvmpipe/lp_setup.h') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 1f55aa41c7f..712ed145d8e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -154,4 +154,10 @@ void lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq); +static INLINE unsigned +lp_clamp_scissor_idx(int idx) +{ + return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0; +} + #endif -- cgit v1.2.3