Fix vertex array element limit condition.
Certain overflows wouldn't be detected when the attribute size was less
than the attribute size and we were drawing a small number of vertices.
Fix this and also set the sentinel value for an integer overflow to be
negative maxint instead of -1 to more effectily distinguish the cases.
Bug: angleproject:1391
Change-Id: I970d5e2a630c0a84c2c02ac0ac41ab1a395819fe
Reviewed-on: https://chromium-review.googlesource.com/1162264
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 2b68e5b..99b7009 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -117,9 +117,11 @@
return true;
}
- // An overflow can happen when adding the offset. Negative indicates overflow.
- if (context->getStateCache().getNonInstancedVertexElementLimit() < 0 ||
- context->getStateCache().getInstancedVertexElementLimit() < 0)
+ // An overflow can happen when adding the offset. Check against a special constant.
+ if (context->getStateCache().getNonInstancedVertexElementLimit() ==
+ VertexAttribute::kIntegerOverflow ||
+ context->getStateCache().getInstancedVertexElementLimit() ==
+ VertexAttribute::kIntegerOverflow)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
return false;