D3D: Make computeOffset not use ErrorOrResult.
Unblocks further error refactoring. Also cleans up some checked math
logic.
Bug: angleproject:2738
Change-Id: I0c9fba9bb908dfc8424921d0db9871241b86e7de
Reviewed-on: https://chromium-review.googlesource.com/1142954
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 8e53155..fa47053 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -128,18 +128,21 @@
TranslatedAttribute::TranslatedAttribute(const TranslatedAttribute &other) = default;
-gl::ErrorOrResult<unsigned int> TranslatedAttribute::computeOffset(GLint startVertex) const
+gl::Error TranslatedAttribute::computeOffset(GLint startVertex, unsigned int *offsetOut) const
{
if (!usesFirstVertexOffset)
{
- return baseOffset;
+ *offsetOut = baseOffset;
+ return gl::NoError();
}
- CheckedNumeric<unsigned int> offset;
+ CheckedNumeric<unsigned int> offset(baseOffset);
+ CheckedNumeric<unsigned int> checkedStride(stride);
- offset = baseOffset + stride * static_cast<unsigned int>(startVertex);
+ offset += checkedStride * static_cast<unsigned int>(startVertex);
ANGLE_TRY_CHECKED_MATH(offset.IsValid());
- return offset.ValueOrDie();
+ *offsetOut = offset.ValueOrDie();
+ return gl::NoError();
}
// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.