Chromium Code Reviews| Index: ui/gl/test/gl_test_helper.h |
| diff --git a/ui/gl/test/gl_test_helper.h b/ui/gl/test/gl_test_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d7b8c01839662660b8410d949ae3e84a462ac309 |
| --- /dev/null |
| +++ b/ui/gl/test/gl_test_helper.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_GL_TEST_GL_TEST_HELPER_H_ |
| +#define UI_GL_TEST_GL_TEST_HELPER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "ui/gl/gl_bindings.h" |
| + |
| +namespace gfx { |
| + |
| +class GLTestHelper { |
| + public: |
| + // Creates a texture object. |
|
Daniele Castagna
2015/09/30 19:17:36
You might want to specify it binds it too.
reveman
2015/10/01 04:01:37
I made sure that no code relies on that instead.
|
| + // Does not check for errors, always returns texture. |
| + static GLuint CreateTexture(GLenum target); |
| + |
| + // Compiles a shader. |
| + // Does not check for errors, always returns shader. |
| + static GLuint CompileShader(GLenum type, const char* src); |
|
Daniele Castagna
2015/09/30 19:17:36
Can this be private?
reveman
2015/10/01 04:01:37
I'm keeping it like this so it's the same as gpu/c
|
| + |
| + // Compiles a shader and checks for compilation errors. |
| + // Returns shader, 0 on failure. |
| + static GLuint LoadShader(GLenum type, const char* src); |
| + |
| + // Attaches 2 shaders and links them to a program. |
| + // Does not check for errors, always returns program. |
| + static GLuint LinkProgram(GLuint vertex_shader, GLuint fragment_shader); |
|
Daniele Castagna
2015/09/30 19:17:36
Same here, can this be private?
reveman
2015/10/01 04:01:37
Keeping it for the same reason.
|
| + |
| + // Attaches 2 shaders, links them to a program, and checks for errors. |
| + // Returns program, 0 on failure. |
| + static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); |
| + |
| + // Compiles 2 shaders, attaches and links them to a program |
| + // Returns program, 0 on failure. |
| + static GLuint LoadProgram(const char* vertex_shader_src, |
|
Daniele Castagna
2015/09/30 19:17:36
Is this used anywhere?
reveman
2015/10/01 04:01:37
No, forgot to remove it from the header.
|
| + const char* fragment_shader_src); |
| + |
| + // Creates a framebuffer, attaches a color buffer, and checks for errors. |
| + // Returns framebuffer, 0 on failure. |
| + static GLuint SetupFramebuffer(int width, int height); |
| + |
| + // Checks an area of pixels for a color. |
| + static bool CheckPixels(GLint x, |
| + GLint y, |
| + GLsizei width, |
| + GLsizei height, |
| + const uint8_t expected_color[4]); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GL_TEST_GL_TEST_HELPER_H_ |