Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / cc / output / geometry_binding.h
blobde7cfc90b62e416cc8c89c16276cffebd1c2338f
1 // Copyright 2011 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_OUTPUT_GEOMETRY_BINDING_H_
6 #define CC_OUTPUT_GEOMETRY_BINDING_H_
8 #include "base/basictypes.h"
9 #include "gpu/command_buffer/client/gles2_interface.h"
10 #include "third_party/khronos/GLES2/gl2.h"
11 #include "third_party/khronos/GLES2/gl2ext.h"
12 #include "ui/gfx/geometry/rect_f.h"
14 namespace gfx {
15 class QuadF;
16 class Quad;
17 class QuadIndex;
18 class PointF;
21 namespace cc {
23 struct GeometryBindingVertex {
24 float a_position[3];
25 float a_texCoord[2];
26 // Index of the vertex, divide by 4 to have the matrix for this quad.
27 float a_index;
30 struct GeometryBindingQuad {
31 GeometryBindingQuad();
32 GeometryBindingQuad(const GeometryBindingVertex& vert0,
33 const GeometryBindingVertex& vert1,
34 const GeometryBindingVertex& vert2,
35 const GeometryBindingVertex& vert3);
36 GeometryBindingVertex v0, v1, v2, v3;
39 struct GeometryBindingQuadIndex {
40 GeometryBindingQuadIndex();
41 GeometryBindingQuadIndex(uint16 index0,
42 uint16 index1,
43 uint16 index2,
44 uint16 index3,
45 uint16 index4,
46 uint16 index5);
48 uint16 data[6];
51 class DrawQuad;
52 class DrawPolygon;
54 struct GeometryBinding {
55 // All layer shaders share the same attribute locations for the vertex
56 // positions and texture coordinates. This allows switching shaders without
57 // rebinding attribute arrays.
58 static int PositionAttribLocation() { return 0; }
59 static int TexCoordAttribLocation() { return 1; }
60 static int TriangleIndexAttribLocation() { return 2; }
63 void SetupGLContext(gpu::gles2::GLES2Interface* gl,
64 GLuint quad_elements_vbo,
65 GLuint quad_vertices_vbo);
67 } // namespace cc
69 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_