1 // Copyright 2012 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.
5 #ifndef CC_GL_RENDERER_DRAW_CACHE_H_
6 #define CC_GL_RENDERER_DRAW_CACHE_H_
11 // Collects 4 floats at a time for easy upload to GL.
12 struct Float4
{ float data
[4]; };
14 // Collects 16 floats at a time for easy upload to GL.
15 struct Float16
{ float data
[16]; };
17 // A cache for storing textured quads to be drawn. Stores the minimum required
18 // data to tell if two back to back draws only differ in their transform. Quads
19 // that only differ by transform may be coalesced into a single draw call.
20 struct TexturedQuadDrawCache
{
21 TexturedQuadDrawCache();
22 ~TexturedQuadDrawCache();
24 // Values tracked to determine if textured quads may be coalesced.
27 bool use_premultiplied_alpha
;
30 // Information about the program binding that is required to draw.
31 int uv_xform_location
;
32 int vertex_opacity_location
;
36 // A cache for the coalesced quad data.
37 std::vector
<Float4
> uv_xform_data
;
38 std::vector
<float> vertex_opacity_data
;
39 std::vector
<Float16
> matrix_data
;
42 #endif // CC_GL_RENDERER_DRAW_CACHE_H_