OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
8 | 8 |
9 #include "gpu/command_buffer/service/context_group.h" | 9 #include "gpu/command_buffer/service/context_group.h" |
10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 glGetProgramiv(program_bad2, GL_LINK_STATUS, &linked_bad2); | 244 glGetProgramiv(program_bad2, GL_LINK_STATUS, &linked_bad2); |
245 EXPECT_EQ(0, linked_bad2); | 245 EXPECT_EQ(0, linked_bad2); |
246 | 246 |
247 // Be sure extension was actually turned on by recompiling. | 247 // Be sure extension was actually turned on by recompiling. |
248 GLuint vs_good2 = GLTestHelper::LoadShader(GL_VERTEX_SHADER, v_shdr_str); | 248 GLuint vs_good2 = GLTestHelper::LoadShader(GL_VERTEX_SHADER, v_shdr_str); |
249 GLuint fs_good2 = GLTestHelper::LoadShader(GL_FRAGMENT_SHADER, f_shdr_str); | 249 GLuint fs_good2 = GLTestHelper::LoadShader(GL_FRAGMENT_SHADER, f_shdr_str); |
250 GLuint program_good2 = GLTestHelper::SetupProgram(vs_good2, fs_good2); | 250 GLuint program_good2 = GLTestHelper::SetupProgram(vs_good2, fs_good2); |
251 EXPECT_NE(0u, program_good2); | 251 EXPECT_NE(0u, program_good2); |
252 } | 252 } |
253 | 253 |
| 254 TEST_F(GLProgramTest, DeleteAttachedShaderLinks) { |
| 255 static const char* v_shdr_str = R"( |
| 256 attribute vec4 vPosition; |
| 257 void main() |
| 258 { |
| 259 gl_Position = vPosition; |
| 260 } |
| 261 )"; |
| 262 static const char* f_shdr_str = R"( |
| 263 void main() |
| 264 { |
| 265 gl_FragColor = vec4(1, 1, 1, 1); |
| 266 } |
| 267 )"; |
| 268 |
| 269 // Compiling the shaders, attaching, then deleting before linking should work. |
| 270 GLuint vs = GLTestHelper::CompileShader(GL_VERTEX_SHADER, v_shdr_str); |
| 271 GLuint fs = GLTestHelper::CompileShader(GL_FRAGMENT_SHADER, f_shdr_str); |
| 272 |
| 273 GLuint program = glCreateProgram(); |
| 274 glAttachShader(program, vs); |
| 275 glAttachShader(program, fs); |
| 276 |
| 277 glDeleteShader(vs); |
| 278 glDeleteShader(fs); |
| 279 |
| 280 glLinkProgram(program); |
| 281 |
| 282 GLint linked = 0; |
| 283 glGetProgramiv(program, GL_LINK_STATUS, &linked); |
| 284 EXPECT_NE(0, linked); |
| 285 } |
| 286 |
254 } // namespace gpu | 287 } // namespace gpu |
255 | 288 |
OLD | NEW |