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"
23 struct GeometryBindingVertex
{
26 // Index of the vertex, divide by 4 to have the matrix for this quad.
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
,
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
);
69 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_