Make angle::Result an enum.
This moves away from a class type to a value type. This should improve
performance when using angle::Result as a return value. Previously the
generated code would return a pointer instead of a value.
Improves performance in the most targeted microbenchmark by 10%. In
more realistic scanarios it will have a smaller improvement. Also
simplifies the class implementation and usage.
Includes some unrelated code generation changes.
Bug: angleproject:2491
Change-Id: Ifcf86870bf1c00a2f73c39ea6e4f05ca705050aa
Reviewed-on: https://chromium-review.googlesource.com/c/1356139
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 8740569..107cea4 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -222,7 +222,7 @@
{
ANGLE_TRY(attachment->initializeContents(context));
}
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
bool IsColorMaskedOut(const BlendState &blend)
@@ -989,7 +989,7 @@
if (mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE)
{
angle::Result err = syncState(context);
- if (err != angle::Result::Continue())
+ if (err != angle::Result::Continue)
{
return 0;
}
@@ -1345,12 +1345,12 @@
const auto &glState = context->getGLState();
if (glState.isRasterizerDiscardEnabled())
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
ANGLE_TRY(mImpl->clear(context, mask));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::clearBufferfv(const Context *context,
@@ -1361,12 +1361,12 @@
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
ANGLE_TRY(mImpl->clearBufferfv(context, buffer, drawbuffer, values));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::clearBufferuiv(const Context *context,
@@ -1377,12 +1377,12 @@
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
ANGLE_TRY(mImpl->clearBufferuiv(context, buffer, drawbuffer, values));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::clearBufferiv(const Context *context,
@@ -1393,12 +1393,12 @@
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
ANGLE_TRY(mImpl->clearBufferiv(context, buffer, drawbuffer, values));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::clearBufferfi(const Context *context,
@@ -1410,12 +1410,12 @@
if (context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
ANGLE_TRY(mImpl->clearBufferfi(context, buffer, drawbuffer, depth, stencil));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::getImplementationColorReadFormat(const Context *context,
@@ -1423,14 +1423,14 @@
{
ANGLE_TRY(syncState(context));
*formatOut = mImpl->getImplementationColorReadFormat(context);
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut)
{
ANGLE_TRY(syncState(context));
*typeOut = mImpl->getImplementationColorReadType(context);
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::readPixels(const Context *context,
@@ -1448,7 +1448,7 @@
unpackBuffer->onPixelPack(context);
}
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::blit(const Context *context,
@@ -1478,7 +1478,7 @@
if (!blitMask)
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
auto *sourceFBO = context->getGLState().getReadFramebuffer();
@@ -1522,7 +1522,7 @@
GLfloat *xy) const
{
ANGLE_TRY(mImpl->getSamplePosition(context, index, xy));
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
bool Framebuffer::hasValidDepthStencil() const
@@ -1807,7 +1807,7 @@
mDirtyBits.reset();
mDirtyBitsGuard.reset();
}
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
void Framebuffer::onSubjectStateChange(const Context *context,
@@ -2017,7 +2017,7 @@
const auto &glState = context->getGLState();
if (!context->isRobustResourceInitEnabled() || glState.isRasterizerDiscardEnabled())
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
const BlendState &blend = glState.getBlendState();
@@ -2029,7 +2029,7 @@
if (!color && !depth && !stencil)
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
if (partialClearNeedsInit(context, color, depth, stencil))
@@ -2042,7 +2042,7 @@
// the clear.
markDrawAttachmentsInitialized(color, depth, stencil);
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context,
@@ -2053,7 +2053,7 @@
context->getGLState().isRasterizerDiscardEnabled() ||
IsClearBufferMaskedOut(context, buffer))
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
if (partialBufferClearNeedsInit(context, buffer))
@@ -2066,14 +2066,14 @@
// the clear.
markBufferInitialized(buffer, drawbuffer);
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::ensureDrawAttachmentsInitialized(const Context *context)
{
if (!context->isRobustResourceInitEnabled())
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
// Note: we don't actually filter by the draw attachment enum. Just init everything.
@@ -2094,7 +2094,7 @@
}
mState.mResourceNeedsInit.reset();
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
angle::Result Framebuffer::ensureReadAttachmentInitialized(const Context *context,
@@ -2102,7 +2102,7 @@
{
if (!context->isRobustResourceInitEnabled() || mState.mResourceNeedsInit.none())
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
if ((blitMask & GL_COLOR_BUFFER_BIT) != 0 && mState.mReadBufferState != GL_NONE)
@@ -2133,7 +2133,7 @@
}
}
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
void Framebuffer::markDrawAttachmentsInitialized(bool color, bool depth, bool stencil)
@@ -2228,7 +2228,7 @@
if (mState.mResourceNeedsInit.none())
{
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
switch (bufferType)
@@ -2280,7 +2280,7 @@
break;
}
- return angle::Result::Continue();
+ return angle::Result::Continue;
}
bool Framebuffer::partialBufferClearNeedsInit(const Context *context, GLenum bufferType)