summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup.h
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-05-25 01:04:17 -0400
committerZack Rusin <[email protected]>2013-05-25 09:49:20 -0400
commitc88ce3480c715ab40f4d488c86c90213b1472613 (patch)
tree9a73611bc0035c57ea978af663e0117d7342b6ff /src/gallium/drivers/llvmpipe/lp_setup.h
parentd7d676252d2ae1fd6d3dd76d4e205251ad7c6152 (diff)
llvmpipe: clamp scissors to be between 0 and max
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 <[email protected]> Reviewed-by: José Fonseca<[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h6
1 files changed, 6 insertions, 0 deletions
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