| 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 <stdint.h> |
| 12 | 12 |
| 13 class GLTestHelper { | 13 class GLTestHelper { |
| 14 public: | 14 public: |
| 15 static const uint8 kCheckClearValue = 123u; | 15 static const uint8_t kCheckClearValue = 123u; |
| 16 | 16 |
| 17 static bool HasExtension(const char* extension); | 17 static bool HasExtension(const char* extension); |
| 18 static bool CheckGLError(const char* msg, int line); | 18 static bool CheckGLError(const char* msg, int line); |
| 19 | 19 |
| 20 // Compiles a shader. | 20 // Compiles a shader. |
| 21 // Does not check for errors, always returns shader. | 21 // Does not check for errors, always returns shader. |
| 22 static GLuint CompileShader(GLenum type, const char* shaderSrc); | 22 static GLuint CompileShader(GLenum type, const char* shaderSrc); |
| 23 | 23 |
| 24 // Compiles a shader and checks for compilation errors. | 24 // Compiles a shader and checks for compilation errors. |
| 25 // Returns shader, 0 on failure. | 25 // Returns shader, 0 on failure. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 // Make a unit quad with position only. | 42 // Make a unit quad with position only. |
| 43 // Returns the created buffer. | 43 // Returns the created buffer. |
| 44 static GLuint SetupUnitQuad(GLint position_location); | 44 static GLuint SetupUnitQuad(GLint position_location); |
| 45 | 45 |
| 46 // Make a 6 vertex colors. | 46 // Make a 6 vertex colors. |
| 47 // Returns the created buffer. | 47 // Returns the created buffer. |
| 48 static GLuint SetupColorsForUnitQuad( | 48 static GLuint SetupColorsForUnitQuad( |
| 49 GLint location, const GLfloat color[4], GLenum usage); | 49 GLint location, const GLfloat color[4], GLenum usage); |
| 50 | 50 |
| 51 // Checks an area of pixels for a color. | 51 // Checks an area of pixels for a color. |
| 52 static bool CheckPixels( | 52 static bool CheckPixels(GLint x, |
| 53 GLint x, GLint y, GLsizei width, GLsizei height, GLint tolerance, | 53 GLint y, |
| 54 const uint8* color); | 54 GLsizei width, |
| 55 GLsizei height, |
| 56 GLint tolerance, |
| 57 const uint8_t* color); |
| 55 | 58 |
| 56 // Uses ReadPixels to save an area of the current FBO/Backbuffer. | 59 // Uses ReadPixels to save an area of the current FBO/Backbuffer. |
| 57 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); | 60 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 63 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| OLD | NEW |