Chromium Code Reviews| 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 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 namespace gfx { | |
| 16 class Size; | |
| 17 } // namespace gfx | |
| 18 | |
| 19 class GLTestHelper { | 15 class GLTestHelper { |
| 20 public: | 16 public: |
| 21 static const uint8_t kCheckClearValue = 123u; | 17 static const uint8_t kCheckClearValue = 123u; |
| 22 | 18 |
| 23 static bool HasExtension(const char* extension); | 19 static bool HasExtension(const char* extension); |
| 24 static bool CheckGLError(const char* msg, int line); | 20 static bool CheckGLError(const char* msg, int line); |
| 25 | 21 |
| 26 // Compiles a shader. | 22 // Compiles a shader. |
| 27 // Does not check for errors, always returns shader. | 23 // Does not check for errors, always returns shader. |
| 28 static GLuint CompileShader(GLenum type, const char* shaderSrc); | 24 static GLuint CompileShader(GLenum type, const char* shaderSrc); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 57 // Returns the created buffer. | 53 // Returns the created buffer. |
| 58 static GLuint SetupColorsForUnitQuad( | 54 static GLuint SetupColorsForUnitQuad( |
| 59 GLint location, const GLfloat color[4], GLenum usage); | 55 GLint location, const GLfloat color[4], GLenum usage); |
| 60 | 56 |
| 61 // Checks an area of pixels for a color. | 57 // Checks an area of pixels for a color. |
| 62 static bool CheckPixels(GLint x, | 58 static bool CheckPixels(GLint x, |
| 63 GLint y, | 59 GLint y, |
| 64 GLsizei width, | 60 GLsizei width, |
| 65 GLsizei height, | 61 GLsizei height, |
| 66 GLint tolerance, | 62 GLint tolerance, |
| 67 const uint8_t* color); | 63 const uint8_t* color, |
| 64 const uint8_t* mask); | |
|
Zhenyao Mo
2017/01/03 23:09:00
Can you add a comment what "mask" means?
Say, "if
qiankun
2017/01/04 02:39:57
Done.
| |
| 68 | 65 |
| 69 // Uses ReadPixels to save an area of the current FBO/Backbuffer. | 66 // Uses ReadPixels to save an area of the current FBO/Backbuffer. |
| 70 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); | 67 static bool SaveBackbufferAsBMP(const char* filename, int width, int height); |
| 71 | 68 |
| 72 static void DrawTextureQuad(GLenum target, const gfx::Size& size); | 69 static void DrawTextureQuad(const char* vertex_src, |
| 70 const char* fragment_src, | |
| 71 const char* position_name, | |
| 72 const char* sampler_name); | |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ | 75 #endif // GPU_COMMAND_BUFFER_TESTS_GL_TEST_UTILS_H_ |
| OLD | NEW |