| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/tests/gl_test_utils.h" | 5 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 static_cast<double>(size.height()), | 64 static_cast<double>(size.height()), |
| 65 kFragmentShader) | 65 kFragmentShader) |
| 66 .c_str()); | 66 .c_str()); |
| 67 default: | 67 default: |
| 68 NOTREACHED(); | 68 NOTREACHED(); |
| 69 return 0; | 69 return 0; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool GLTestHelper::HasExtension(const char* extension) { | 73 bool GLTestHelper::HasExtension(const char* extension) { |
| 74 // Pad with an extra space to ensure that |extension| is not a substring of | 74 std::string extensions( |
| 75 // another extension. | 75 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); |
| 76 std::string extensions = | 76 return extensions.find(extension) != std::string::npos; |
| 77 std::string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))) + | |
| 78 " "; | |
| 79 std::string extension_padded = std::string(extension) + " "; | |
| 80 return extensions.find(extension_padded) != std::string::npos; | |
| 81 } | 77 } |
| 82 | 78 |
| 83 bool GLTestHelper::CheckGLError(const char* msg, int line) { | 79 bool GLTestHelper::CheckGLError(const char* msg, int line) { |
| 84 bool success = true; | 80 bool success = true; |
| 85 GLenum error = GL_NO_ERROR; | 81 GLenum error = GL_NO_ERROR; |
| 86 while ((error = glGetError()) != GL_NO_ERROR) { | 82 while ((error = glGetError()) != GL_NO_ERROR) { |
| 87 success = false; | 83 success = false; |
| 88 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), error) | 84 EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), error) |
| 89 << "GL ERROR in " << msg << " at line " << line << " : " << error; | 85 << "GL ERROR in " << msg << " at line " << line << " : " << error; |
| 90 } | 86 } |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 ASSERT_NE(vertex_buffer, 0u); | 352 ASSERT_NE(vertex_buffer, 0u); |
| 357 glUniform1i(sampler_location, 0); | 353 glUniform1i(sampler_location, 0); |
| 358 | 354 |
| 359 glDrawArrays(GL_TRIANGLES, 0, 6); | 355 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 360 | 356 |
| 361 glDeleteShader(vertex_shader); | 357 glDeleteShader(vertex_shader); |
| 362 glDeleteShader(fragment_shader); | 358 glDeleteShader(fragment_shader); |
| 363 glDeleteProgram(program); | 359 glDeleteProgram(program); |
| 364 glDeleteBuffers(1, &vertex_buffer); | 360 glDeleteBuffers(1, &vertex_buffer); |
| 365 } | 361 } |
| OLD | NEW |