Optimize resolveLink.
This changes the program query to resolve the link if required. If the
validation layer is skipped the link is resolved in the gl::Context.
Resolving the link on program query allows us to avoid resolving the
link on most of the gl::Program query APIs.
This improves inlining and particularly affects uniform update. It
fixes a performance regression introduced by the parallel shader
linking extension. Gives a 17% increased score on a uniform benchmark.
Also fixes two missing cases of checking for the extension in our
validation code.
Note that some bugs might still exist when the validation layer is
disabled.
Bug: angleproject:2851
Change-Id: I5d725eede3fa147cedf2ce0129791b3412a97a61
Reviewed-on: https://chromium-review.googlesource.com/1255509
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@google.com>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 9e233eb..0e138f6 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -2250,7 +2250,7 @@
return true;
case GL_PROGRAM:
- if (context->getProgram(name) == nullptr)
+ if (context->getProgramNoResolveLink(name) == nullptr)
{
context->handleError(InvalidValue() << "name is not a valid program.");
return false;
@@ -3843,7 +3843,7 @@
return false;
}
- const auto *programObject = context->getProgram(program);
+ const auto *programObject = context->getProgramNoResolveLink(program);
if (!programObject)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
@@ -3878,7 +3878,7 @@
return false;
}
- const auto *programObject = context->getProgram(program);
+ const auto *programObject = context->getProgramResolveLink(program);
if (!programObject || programObject->isFlaggedForDeletion())
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramDoesNotExist);
@@ -4933,7 +4933,7 @@
return false;
}
- if (!context->getProgram(program))
+ if (!context->getProgramResolveLink(program))
{
if (context->getShader(program))
{
@@ -4959,7 +4959,7 @@
if (!context->getShader(shader))
{
- if (context->getProgram(shader))
+ if (context->getProgramResolveLink(shader))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidShaderName);
return false;
@@ -6322,7 +6322,7 @@
{
if (program != 0)
{
- Program *programObject = context->getProgram(program);
+ Program *programObject = context->getProgramResolveLink(program);
if (!programObject)
{
// ES 3.1.0 section 7.3 page 72