summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen6_scissor_state.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-10-18 13:11:29 -0700
committerEric Anholt <eric@anholt.net>2010-10-18 13:11:29 -0700
commit641028debf0e4b03111b205088763d3d957070b2 (patch)
treebe853ca45301b79aae4a97c66efbd94753f91e2c /src/mesa/drivers/dri/i965/gen6_scissor_state.c
parent022531209d1575b5c1cd84070757521566f856b7 (diff)
downloadexternal_mesa3d-641028debf0e4b03111b205088763d3d957070b2.zip
external_mesa3d-641028debf0e4b03111b205088763d3d957070b2.tar.gz
external_mesa3d-641028debf0e4b03111b205088763d3d957070b2.tar.bz2
i965: Fix scissor-offscreen on gen6 like we did pre-gen6.
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_scissor_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_scissor_state.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_scissor_state.c b/src/mesa/drivers/dri/i965/gen6_scissor_state.c
index 5684c2e..b57126c 100644
--- a/src/mesa/drivers/dri/i965/gen6_scissor_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_scissor_state.c
@@ -46,7 +46,19 @@ prepare_scissor_state(struct brw_context *brw)
* Note that the hardware's coordinates are inclusive, while Mesa's min is
* inclusive but max is exclusive.
*/
- if (render_to_fbo) {
+ if (ctx->DrawBuffer->_Xmin == ctx->DrawBuffer->_Xmax ||
+ ctx->DrawBuffer->_Ymin == ctx->DrawBuffer->_Ymax) {
+ /* If the scissor was out of bounds and got clamped to 0
+ * width/height at the bounds, the subtraction of 1 from
+ * maximums could produce a negative number and thus not clip
+ * anything. Instead, just provide a min > max scissor inside
+ * the bounds, which produces the expected no rendering.
+ */
+ scissor.xmin = 1;
+ scissor.xmax = 0;
+ scissor.ymin = 1;
+ scissor.ymax = 0;
+ } else if (render_to_fbo) {
/* texmemory: Y=0=bottom */
scissor.xmin = ctx->DrawBuffer->_Xmin;
scissor.xmax = ctx->DrawBuffer->_Xmax - 1;