ES31: Fix detaching/deleting compute shader after LinkProgram.
This change also moves the ShaderType enum from D3D renderer to angletype.h.
And it uses a bit mask to track the linked shader stages.
BUG=angleproject:2247
Change-Id: I5c7ee1445d353a02e24549ffcf6b0ac694dd1069
Reviewed-on: https://chromium-review.googlesource.com/768629
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/ComputeShaderTest.cpp b/src/tests/gl_tests/ComputeShaderTest.cpp
index 9e1f4fb..4f46e3f 100644
--- a/src/tests/gl_tests/ComputeShaderTest.cpp
+++ b/src/tests/gl_tests/ComputeShaderTest.cpp
@@ -42,6 +42,38 @@
EXPECT_GL_NO_ERROR();
}
+// Link a simple compute program. Then detach the shader and dispatch compute.
+// It should be successful.
+TEST_P(ComputeShaderTest, DetachShaderAfterLinkSuccess)
+{
+ const std::string csSource =
+ R"(#version 310 es
+ layout(local_size_x=1) in;
+ void main()
+ {
+ })";
+
+ GLuint program = glCreateProgram();
+
+ GLuint cs = CompileShader(GL_COMPUTE_SHADER, csSource);
+ EXPECT_NE(0u, cs);
+
+ glAttachShader(program, cs);
+ glDeleteShader(cs);
+
+ glLinkProgram(program);
+ GLint linkStatus;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+ EXPECT_EQ(GL_TRUE, linkStatus);
+
+ glDetachShader(program, cs);
+ EXPECT_GL_NO_ERROR();
+
+ glUseProgram(program);
+ glDispatchCompute(8, 4, 2);
+ EXPECT_GL_NO_ERROR();
+}
+
// link a simple compute program. There is no local size and linking should fail.
TEST_P(ComputeShaderTest, LinkComputeProgramNoLocalSizeLinkError)
{