Fix clearing the program's validation-related cache too early

When attempting to link a new program, the program must be marked
as unlinked, but the validation-related caching should not be
cleared yet, since we can still use the previously linked program
if linking fails at this point.

Added an angle end2end test which fails without this fix and
passes with this fix.

Fixes the following WebGL 1.0.4 test with SwANGLE:
conformance/programs/program-test.html

Bug: angleproject:3557
Change-Id: Ib6722ba88803979e8f292c9b7b81f85cc0304662
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2173538
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Alexis Hétu <sugoi@chromium.org>
This commit is contained in:
Alexis Hetu
2020-04-29 16:20:09 -04:00
committed by Commit Bot
parent 4271443d7e
commit 73bf99b716
4 changed files with 89 additions and 1 deletions

View File

@@ -164,6 +164,25 @@ GLuint CheckLinkStatusAndReturnProgram(GLuint program, bool outputErrorMessages)
return program;
}
GLuint GetProgramShader(GLuint program, GLint requestedType)
{
static constexpr GLsizei kMaxShaderCount = 16;
GLuint attachedShaders[kMaxShaderCount] = {0u};
GLsizei count = 0;
glGetAttachedShaders(program, kMaxShaderCount, &count, attachedShaders);
for (int i = 0; i < count; ++i)
{
GLint type = 0;
glGetShaderiv(attachedShaders[i], GL_SHADER_TYPE, &type);
if (type == requestedType)
{
return attachedShaders[i];
}
}
return 0;
}
GLuint CompileProgramWithTransformFeedback(
const char *vsSource,
const char *fsSource,