summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2015-09-01 16:29:17 -0600
committerBrian Paul <brianp@vmware.com>2015-09-01 16:29:17 -0600
commit17542086174ed1c2ea47f3b9b5917ce478442819 (patch)
treef8754752636da1035e5ecfcfd1b698991b2aaf4b /src/gallium/auxiliary
parentfec4f5de67b22a7048266fb7e57f49fe6fc3744a (diff)
downloadexternal_mesa3d-17542086174ed1c2ea47f3b9b5917ce478442819.zip
external_mesa3d-17542086174ed1c2ea47f3b9b5917ce478442819.tar.gz
external_mesa3d-17542086174ed1c2ea47f3b9b5917ce478442819.tar.bz2
gallium/util: fix returning empty box for rectangle intersection
These functions deal with inclusive coordinates, hence a 0/0/0/0 rect returned when there's no intersection doesn't actually represent an empty rectangle. Hence return 0/-1/0/-1 instead. This fixes some problems in llvmpipe with empty scissor rects (which up to now didn't really matter because while the intersect test returned the wrong result all pixels were scissored away later anyway).
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_rect.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_rect.h b/src/gallium/auxiliary/util/u_rect.h
index dea1e1e..221d918 100644
--- a/src/gallium/auxiliary/util/u_rect.h
+++ b/src/gallium/auxiliary/util/u_rect.h
@@ -87,7 +87,12 @@ u_rect_possible_intersection(const struct u_rect *a,
u_rect_find_intersection(a,b);
}
else {
- b->x0 = b->x1 = b->y0 = b->y1 = 0;
+ /*
+ * Note the u_rect_xx tests deal with inclusive coordinates
+ * hence all-zero would not be an empty box.
+ */
+ b->x0 = b->y0 = 0;
+ b->x1 = b->y1 = -1;
}
}