summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-08-12 16:59:25 -0600
committerTim Rowley <[email protected]>2016-08-17 17:08:55 -0500
commit812b45d04958e31e7a3bfc7331308374e8b73afa (patch)
tree34b7373135575d928101e6c89018ed4103b36afd
parent93fb768c7e608a64db3a8fc94126880ae91c7147 (diff)
swr: [rasterizer core] clamp scissor rects to current tile rect
Signed-off-by: Tim Rowley <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/utils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h
index 79f45ebf25d..e66cdc34bae 100644
--- a/src/gallium/drivers/swr/rasterizer/core/utils.h
+++ b/src/gallium/drivers/swr/rasterizer/core/utils.h
@@ -29,6 +29,7 @@
#include <string.h>
#include <type_traits>
+#include <algorithm>
#include "common/os.h"
#include "common/simdintrin.h"
#include "common/swr_assert.h"
@@ -95,6 +96,23 @@ OSALIGNLINE(struct) BBOX
{
return !(*this == rhs);
}
+
+ BBOX& Intersect(const BBOX& other)
+ {
+ this->top = std::max(this->top, other.top);
+ this->bottom = std::min(this->bottom, other.bottom);
+ this->left = std::max(this->left, other.left);
+ this->right = std::min(this->right, other.right);
+
+ if (right - left < 0 ||
+ bottom - top < 0)
+ {
+ // Zero area
+ top = bottom = left = right = 0;
+ }
+
+ return *this;
+ }
};
struct simdBBox