Enable [[nodiscard]] for gl::Error.
This forces all return values to be checked for gl::Error.
Requires quite a bit of minor refactoring. I also added a macro to
swallow an error without returning from a function.
We could look at storing the errors in the Context at some point,
since almost always when we're generating errors that we need to
discard we have access to the Context as a parameter.
BUG=angleproject:2150
Change-Id: I457e48a30c002eda0993acbcd3180ba87bf169fb
Reviewed-on: https://chromium-review.googlesource.com/665173
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index c257e3b..8a355f0 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -453,7 +453,7 @@
for (auto &zeroTexture : mZeroTextures)
{
- zeroTexture.second->onDestroy(this);
+ ANGLE_TRY(zeroTexture.second->onDestroy(this));
zeroTexture.second.set(this, nullptr);
}
mZeroTextures.clear();
@@ -2108,7 +2108,7 @@
QueryProgramInterfaceiv(programObject, programInterface, pname, params);
}
-Error Context::handleError(const Error &error)
+void Context::handleError(const Error &error)
{
if (error.isError())
{
@@ -2126,8 +2126,6 @@
GL_DEBUG_SEVERITY_HIGH, error.getMessage());
}
}
-
- return error;
}
// Get one of the recorded errors and clear its flag, if any.
@@ -4205,7 +4203,7 @@
return;
}
- mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ);
+ handleError(mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ));
}
void Context::texStorage2D(GLenum target,