| 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> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Compiles 2 shaders, attaches and links them to a program | 28 // Compiles 2 shaders, attaches and links them to a program |
| 29 // Returns program, 0 on failure. | 29 // Returns program, 0 on failure. |
| 30 static GLuint LoadProgram( | 30 static GLuint LoadProgram( |
| 31 const char* vertex_shader_source, | 31 const char* vertex_shader_source, |
| 32 const char* fragment_shader_source); | 32 const char* fragment_shader_source); |
| 33 | 33 |
| 34 // Make a unit quad with position only. | 34 // Make a unit quad with position only. |
| 35 // Returns the created buffer. | 35 // Returns the created buffer. |
| 36 static GLuint SetupUnitQuad(GLint position_location); | 36 static GLuint SetupUnitQuad(GLint position_location); |
| 37 | 37 |
| 38 // Make a 6 vertex colors. |
| 39 // Returns the created buffer. |
| 40 static GLuint SetupColorsForUnitQuad( |
| 41 GLint location, const GLfloat color[4], GLenum usage); |
| 42 |
| 38 // Checks an area of pixels for a color. | 43 // Checks an area of pixels for a color. |
| 39 static bool CheckPixels( | 44 static bool CheckPixels( |
| 40 GLint x, GLint y, GLsizei width, GLsizei height, GLint tolerance, | 45 GLint x, GLint y, GLsizei width, GLsizei height, GLint tolerance, |
| 41 const uint8* color); | 46 const uint8* color); |
| 42 | 47 |
| 43 // Uses ReadPixels to save an area of the current FBO/Backbuffer. | 48 // Uses ReadPixels to save an area of the current FBO/Backbuffer. |
| 44 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); | 49 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); |
| 45 | 50 |
| 46 // Run unit tests. | 51 // Run unit tests. |
| 47 static int RunTests(int argc, char** argv); | 52 static int RunTests(int argc, char** argv); |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 55 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| OLD | NEW |