Refactor internal format pixel math methods.
This removes the use of the ErrorOrResult class from these methods.
This will enable more performant Error handling. Also cleans up the
ANGLE_TRY_CHECKED_MATH macro to be more general.
Bug: angleproject:2713
Change-Id: I349947d320907839ca88ec1f9251e6ddc3858a08
Reviewed-on: https://chromium-review.googlesource.com/1128920
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index b0faa9b..0a0fd1d 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1405,13 +1405,14 @@
return false;
}
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
- if (blockSizeOrErr.isError())
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
{
context->handleError(InvalidValue());
return false;
}
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
{
context->handleError(InvalidValue());
return false;
@@ -2026,13 +2027,14 @@
return false;
}
- auto blockSizeOrErr = formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth));
- if (blockSizeOrErr.isError())
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
{
- context->handleError(blockSizeOrErr.getError());
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
return false;
}
- if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
{
context->handleError(InvalidValue());
return false;