Index: gpu/command_buffer/tests/gl_program_unittest.cc |
diff --git a/gpu/command_buffer/tests/gl_program_unittest.cc b/gpu/command_buffer/tests/gl_program_unittest.cc |
index d243994855823f368d4d06d9a5154a33b525f796..c0abb12aa81688a9d60fd55ebca18f6e92bc8fee 100644 |
--- a/gpu/command_buffer/tests/gl_program_unittest.cc |
+++ b/gpu/command_buffer/tests/gl_program_unittest.cc |
@@ -251,5 +251,38 @@ TEST_F(GLProgramTest, DeferCompileWithExt) { |
EXPECT_NE(0u, program_good2); |
} |
+TEST_F(GLProgramTest, DeleteAttachedShaderLinks) { |
+ static const char* v_shdr_str = R"( |
+ attribute vec4 vPosition; |
+ void main() |
+ { |
+ gl_Position = vPosition; |
+ } |
+ )"; |
+ static const char* f_shdr_str = R"( |
+ void main() |
+ { |
+ gl_FragColor = vec4(1, 1, 1, 1); |
+ } |
+ )"; |
+ |
+ // Compiling the shaders, attaching, then deleting before linking should work. |
+ GLuint vs = GLTestHelper::CompileShader(GL_VERTEX_SHADER, v_shdr_str); |
+ GLuint fs = GLTestHelper::CompileShader(GL_FRAGMENT_SHADER, f_shdr_str); |
+ |
+ GLuint program = glCreateProgram(); |
+ glAttachShader(program, vs); |
+ glAttachShader(program, fs); |
+ |
+ glDeleteShader(vs); |
+ glDeleteShader(fs); |
+ |
+ glLinkProgram(program); |
+ |
+ GLint linked = 0; |
+ glGetProgramiv(program, GL_LINK_STATUS, &linked); |
+ EXPECT_NE(0, linked); |
+} |
+ |
} // namespace gpu |