Commit 7f1c0c3b by Mohan Maiya Committed by Commit Bot

Call resolveLink in Program::attachShader and Program::detachShader

Previously glAttachShader and glDetachShader would only call resolveLink during validation. Adding the resolveLink in attachShader/detachShader handles the case where glAttachShader and glDetachShader is called with EGL_CONTEXT_OPENGL_NO_ERROR_KHR to skip validation. Tests: angle_end2end_tests --gtest_filter=ContextNoErrorTest.DetachAfterLink* Bug: angleproject:2868 Change-Id: I1e01cf8e6f8a382333226bdef037c46f4c62a119 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2745654Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 25c084a7
......@@ -872,10 +872,6 @@ GLuint Context::createShaderProgramv(ShaderType type, GLsizei count, const GLcha
return 0u;
}
// Need to manually resolveLink(), since onProgramLink() doesn't think the program
// is in use. For the normal glDetachShader() API call path, this is done during
// ValidateDetachShader() via gl::GetValidProgram().
programObject->resolveLink(this);
programObject->detachShader(this, shaderObject);
}
......
......@@ -1357,7 +1357,7 @@ const std::string &Program::getLabel() const
void Program::attachShader(const Context *context, Shader *shader)
{
ASSERT(!mLinkingState);
resolveLink(context);
ShaderType shaderType = shader->getType();
ASSERT(shaderType != ShaderType::InvalidEnum);
......@@ -1376,7 +1376,7 @@ void Program::attachShader(const Context *context, Shader *shader)
void Program::detachShader(const Context *context, Shader *shader)
{
ASSERT(!mLinkingState);
resolveLink(context);
ShaderType shaderType = shader->getType();
ASSERT(shaderType != ShaderType::InvalidEnum);
......
......@@ -117,6 +117,27 @@ TEST_P(ContextNoErrorTest, NoError)
EXPECT_GL_NO_ERROR();
}
// Test glDetachShader to make sure it resolves linking with a no error context and doesn't assert
TEST_P(ContextNoErrorTest, DetachAfterLink)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_KHR_no_error"));
GLuint vs = CompileShader(GL_VERTEX_SHADER, essl1_shaders::vs::Simple());
GLuint fs = CompileShader(GL_FRAGMENT_SHADER, essl1_shaders::fs::Red());
GLuint program = glCreateProgram();
glAttachShader(program, vs);
glAttachShader(program, fs);
glLinkProgram(program);
glDetachShader(program, vs);
glDetachShader(program, fs);
glDeleteShader(vs);
glDeleteShader(fs);
glDeleteProgram(program);
EXPECT_GL_NO_ERROR();
}
// Tests that we can draw with a program pipeline when GL_KHR_no_error is enabled.
TEST_P(ContextNoErrorTest31, DrawWithPPO)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment