Reset cache in ProgramExecutable::updateActiveSamplers.

This missing reset was causing incorrect state validation to
persist in a few instances.

Bug: chromium:1266437
Change-Id: I7ab47c81bf9f855e3ad75048f9d1aaefbc2291df
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3262477
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2021-11-04 13:22:47 -04:00 коммит произвёл Angle LUCI CQ
Родитель fab56bdb6f
Коммит 019ddad593
2 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -808,6 +808,9 @@ void ProgramExecutable::updateActiveSamplers(const ProgramState &programState)
mActiveSamplersMask.set(textureUnit);
}
}
// Invalidate the validation cache.
resetCachedValidateSamplersResult();
}
void ProgramExecutable::updateActiveImages(const ProgramExecutable &executable)

Просмотреть файл

@ -7066,6 +7066,48 @@ TEST_P(SimpleStateChangeTestES3, DeleteFramebufferBeforeQuery)
ASSERT_GL_NO_ERROR();
}
// Covers an edge case
TEST_P(SimpleStateChangeTestES3, TextureTypeConflictAfterDraw)
{
constexpr char kVS[] = R"(precision highp float;
attribute vec4 a_position;
void main()
{
gl_Position = a_position;
}
)";
constexpr char kFS[] = R"(precision highp float;
uniform sampler2D u_2d1;
uniform samplerCube u_Cube1;
void main()
{
gl_FragColor = texture2D(u_2d1, vec2(0.0, 0.0)) + textureCube(u_Cube1, vec3(0.0, 0.0, 0.0));
}
)";
ANGLE_GL_PROGRAM(testProgram, kVS, kFS);
glUseProgram(testProgram);
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
glTexStorage2D(GL_TEXTURE_2D, 4, GL_SRGB8, 1268, 614);
GLint uniformloc = glGetUniformLocation(testProgram, "u_Cube1");
ASSERT_NE(-1, uniformloc);
glUniform1i(uniformloc, 1);
glDrawArrays(GL_POINTS, 0, 1);
ASSERT_GL_NO_ERROR();
// Trigger the state update.
glLinkProgram(testProgram);
texture.reset();
// The texture types are now conflicting, and draws should fail.
glDrawArrays(GL_POINTS, 0, 1);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
} // anonymous namespace
ANGLE_INSTANTIATE_TEST_ES2(StateChangeTest);