Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_GL_TEST_GL_TEST_HELPER_H_ | |
| 6 #define UI_GL_TEST_GL_TEST_HELPER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "ui/gl/gl_bindings.h" | |
| 10 | |
| 11 namespace gfx { | |
| 12 | |
| 13 class GLTestHelper { | |
| 14 public: | |
| 15 // 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.
| |
| 16 // Does not check for errors, always returns texture. | |
| 17 static GLuint CreateTexture(GLenum target); | |
| 18 | |
| 19 // Compiles a shader. | |
| 20 // Does not check for errors, always returns shader. | |
| 21 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
| |
| 22 | |
| 23 // Compiles a shader and checks for compilation errors. | |
| 24 // Returns shader, 0 on failure. | |
| 25 static GLuint LoadShader(GLenum type, const char* src); | |
| 26 | |
| 27 // Attaches 2 shaders and links them to a program. | |
| 28 // Does not check for errors, always returns program. | |
| 29 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.
| |
| 30 | |
| 31 // Attaches 2 shaders, links them to a program, and checks for errors. | |
| 32 // Returns program, 0 on failure. | |
| 33 static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader); | |
| 34 | |
| 35 // Compiles 2 shaders, attaches and links them to a program | |
| 36 // Returns program, 0 on failure. | |
| 37 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.
| |
| 38 const char* fragment_shader_src); | |
| 39 | |
| 40 // Creates a framebuffer, attaches a color buffer, and checks for errors. | |
| 41 // Returns framebuffer, 0 on failure. | |
| 42 static GLuint SetupFramebuffer(int width, int height); | |
| 43 | |
| 44 // Checks an area of pixels for a color. | |
| 45 static bool CheckPixels(GLint x, | |
| 46 GLint y, | |
| 47 GLsizei width, | |
| 48 GLsizei height, | |
| 49 const uint8_t expected_color[4]); | |
| 50 }; | |
| 51 | |
| 52 } // namespace gfx | |
| 53 | |
| 54 #endif // UI_GL_TEST_GL_TEST_HELPER_H_ | |
| OLD | NEW |