summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/tests/gl_program_unittest.cc
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2015-02-24 21:24:31 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-25 05:25:25 +0000
commitc6a36cdd86305aa691641fcfd6ded5a571510834 (patch)
treeb833fa48f13f0649b88eeede0daab620689842ec /gpu/command_buffer/tests/gl_program_unittest.cc
parent586e3dbe02974966b7a3adaf0aebfbcc4d6983ba (diff)
downloadchromium_src-c6a36cdd86305aa691641fcfd6ded5a571510834.zip
chromium_src-c6a36cdd86305aa691641fcfd6ded5a571510834.tar.gz
chromium_src-c6a36cdd86305aa691641fcfd6ded5a571510834.tar.bz2
Compile shader upon deletion if attached.
R=kbr@chromium.org, vmiura@chromium.org BUG=459778 TEST=chromote locally with enableVideoDecodeRenderer Review URL: https://codereview.chromium.org/954073002 Cr-Commit-Position: refs/heads/master@{#317985}
Diffstat (limited to 'gpu/command_buffer/tests/gl_program_unittest.cc')
-rw-r--r--gpu/command_buffer/tests/gl_program_unittest.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/gpu/command_buffer/tests/gl_program_unittest.cc b/gpu/command_buffer/tests/gl_program_unittest.cc
index d243994..c0abb12 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