1 //
2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // draw_call_perf_utils.h:
7 //   Common utilities for performance tests that need to do a large amount of draw calls.
8 //
9 
10 #ifndef TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_
11 #define TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_
12 
13 #include <stddef.h>
14 
15 #include "util/gles_loader_autogen.h"
16 
17 // Returns program ID. The program is left in use, no uniforms.
18 GLuint SetupSimpleDrawProgram();
19 
20 // Returns program ID. Uses a 2D texture.
21 GLuint SetupSimpleTextureProgram();
22 
23 // Returns program ID. Uses two 2D textures.
24 GLuint SetupDoubleTextureProgram();
25 
26 // Returns program ID. The program is left in use and the uniforms are set to default values:
27 // uScale = 0.5, uOffset = -0.5
28 GLuint SetupSimpleScaleAndOffsetProgram();
29 
30 // Returns buffer ID filled with 2-component triangle coordinates. The buffer is left as bound.
31 // Generates triangles like this with 2-component coordinates:
32 //    A
33 //   / \.
34 //  /   \.
35 // B-----C
36 GLuint Create2DTriangleBuffer(size_t numTris, GLenum usage);
37 
38 // Creates an FBO with a texture color attachment. The texture is GL_RGBA and has dimensions
39 // width/height. The FBO and texture ids are written to the out parameters.
40 void CreateColorFBO(GLsizei width, GLsizei height, GLuint *fbo, GLuint *texture);
41 
42 #endif  // TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_
43