| 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 // Helper functions for GL. | 5 // Helper functions for GL. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 7 #ifndef GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| 8 #define GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 8 #define GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| 9 | 9 |
| 10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 class GLTestHelper { | 13 class GLTestHelper { |
| 14 public: | 14 public: |
| 15 static const uint8 kCheckClearValue = 123u; |
| 16 |
| 15 static bool HasExtension(const char* extension); | 17 static bool HasExtension(const char* extension); |
| 16 static bool CheckGLError(const char* msg, int line); | 18 static bool CheckGLError(const char* msg, int line); |
| 17 | 19 |
| 18 // Compiles a shader. | 20 // Compiles a shader. |
| 19 // Returns shader, 0 on failure.. | 21 // Returns shader, 0 on failure.. |
| 20 static GLuint LoadShader(GLenum type, const char* shaderSrc); | 22 static GLuint LoadShader(GLenum type, const char* shaderSrc); |
| 21 | 23 |
| 22 // Attaches 2 shaders and links them to a program. | 24 // Attaches 2 shaders and links them to a program. |
| 23 // Returns program, 0 on failure.. | 25 // Returns program, 0 on failure.. |
| 24 static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); | 26 static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 const uint8* color); | 41 const uint8* color); |
| 40 | 42 |
| 41 // Uses ReadPixels to save an area of the current FBO/Backbuffer. | 43 // Uses ReadPixels to save an area of the current FBO/Backbuffer. |
| 42 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); | 44 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); |
| 43 | 45 |
| 44 // Run unit tests. | 46 // Run unit tests. |
| 45 static int RunTests(int argc, char** argv); | 47 static int RunTests(int argc, char** argv); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 50 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| OLD | NEW |