Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: gpu/command_buffer/tests/gl_program_unittest.cc

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/test_helper.cc ('k') | gpu/command_buffer/tests/gl_unittests_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aec95b2f5e4ee92c98b11ebff02a441724cf3166..186b28b8004eb962e617c536cbb62e8044c3c7dc 100644
--- a/gpu/command_buffer/tests/gl_program_unittest.cc
+++ b/gpu/command_buffer/tests/gl_program_unittest.cc
@@ -121,6 +121,35 @@ TEST_F(GLProgramTest, NewShaderInCurrentProgram) {
GLTestHelper::CheckGLError("no errors", __LINE__);
}
+TEST_F(GLProgramTest, ShaderLengthSpecified) {
+ const std::string valid_shader_str = SHADER(
+ attribute vec4 a_position;
+ void main()
+ {
+ gl_Position = a_position;
+ }
+ );
+
+ const std::string invalid_shader = valid_shader_str + "invalid suffix";
+
+ // Compiling invalid program should fail.
+ const char* invalid_shader_strings[] = { invalid_shader.c_str() };
+ GLuint vs = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vs, 1, invalid_shader_strings, NULL);
+ glCompileShader(vs);
+
+ GLint compile_state = 0;
+ glGetShaderiv(vs, GL_COMPILE_STATUS, &compile_state);
+ EXPECT_EQ(GL_FALSE, compile_state);
+
+ // Compiling program cutting off invalid parts should succeed.
+ const GLint lengths[] = { valid_shader_str.length() };
+ glShaderSource(vs, 1, invalid_shader_strings, lengths);
+ glCompileShader(vs);
+ glGetShaderiv(vs, GL_COMPILE_STATUS, &compile_state);
+ EXPECT_EQ(GL_TRUE, compile_state);
+}
+
TEST_F(GLProgramTest, UniformsInCurrentProgram) {
static const char* v_shader_str = SHADER(
attribute vec4 a_position;
« no previous file with comments | « gpu/command_buffer/service/test_helper.cc ('k') | gpu/command_buffer/tests/gl_unittests_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698