Remove HasIndexRange.
This is superseded by the DrawCallParams class. Instead of
storing the context, we also return an error from the index
range resolution.
Bug: angleproject:2389
Change-Id: I9e7d58f006f51872eb3b52cbb9efbee16fff7ef6
Reviewed-on: https://chromium-review.googlesource.com/960570
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index b3122b2..e7f1e9a 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2944,31 +2944,27 @@
else
{
// Use the parameter buffer to retrieve and cache the index range.
- const auto ¶ms = context->getParams<HasIndexRange>();
- const auto &indexRangeOpt = params.getIndexRange();
- if (!indexRangeOpt.valid())
- {
- // Unexpected error.
- return false;
- }
+ const DrawCallParams ¶ms = context->getParams<DrawCallParams>();
+ ANGLE_VALIDATION_TRY(params.ensureIndexRangeResolved(context));
+ const IndexRange &indexRange = params.getIndexRange();
// If we use an index greater than our maximum supported index range, return an error.
// The ES3 spec does not specify behaviour here, it is undefined, but ANGLE should always
// return an error if possible here.
- if (static_cast<GLuint64>(indexRangeOpt.value().end) >= context->getCaps().maxElementIndex)
+ if (static_cast<GLuint64>(indexRange.end) >= context->getCaps().maxElementIndex)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExceedsMaxElement);
return false;
}
- if (!ValidateDrawAttribs(context, primcount, static_cast<GLint>(indexRangeOpt.value().end),
- static_cast<GLint>(indexRangeOpt.value().vertexCount())))
+ if (!ValidateDrawAttribs(context, primcount, static_cast<GLint>(indexRange.end),
+ static_cast<GLint>(indexRange.vertexCount())))
{
return false;
}
// No op if there are no real indices in the index data (all are primitive restart).
- return (indexRangeOpt.value().vertexIndexCount > 0);
+ return (indexRange.vertexIndexCount > 0);
}
return true;