| 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 <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 namespace gfx { |
| 14 class Size; |
| 15 } // namespace gfx |
| 16 |
| 13 class GLTestHelper { | 17 class GLTestHelper { |
| 14 public: | 18 public: |
| 15 static const uint8_t kCheckClearValue = 123u; | 19 static const uint8_t kCheckClearValue = 123u; |
| 16 | 20 |
| 17 static bool HasExtension(const char* extension); | 21 static bool HasExtension(const char* extension); |
| 18 static bool CheckGLError(const char* msg, int line); | 22 static bool CheckGLError(const char* msg, int line); |
| 19 | 23 |
| 20 // Compiles a shader. | 24 // Compiles a shader. |
| 21 // Does not check for errors, always returns shader. | 25 // Does not check for errors, always returns shader. |
| 22 static GLuint CompileShader(GLenum type, const char* shaderSrc); | 26 static GLuint CompileShader(GLenum type, const char* shaderSrc); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 // Checks an area of pixels for a color. | 55 // Checks an area of pixels for a color. |
| 52 static bool CheckPixels(GLint x, | 56 static bool CheckPixels(GLint x, |
| 53 GLint y, | 57 GLint y, |
| 54 GLsizei width, | 58 GLsizei width, |
| 55 GLsizei height, | 59 GLsizei height, |
| 56 GLint tolerance, | 60 GLint tolerance, |
| 57 const uint8_t* color); | 61 const uint8_t* color); |
| 58 | 62 |
| 59 // Uses ReadPixels to save an area of the current FBO/Backbuffer. | 63 // Uses ReadPixels to save an area of the current FBO/Backbuffer. |
| 60 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); | 64 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); |
| 65 |
| 66 static void DrawTextureQuad(GLenum target, const gfx::Size& size); |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 69 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| OLD | NEW |