OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_OUTPUT_GEOMETRY_BINDING_H_ | 5 #ifndef CC_OUTPUT_GEOMETRY_BINDING_H_ |
6 #define CC_OUTPUT_GEOMETRY_BINDING_H_ | 6 #define CC_OUTPUT_GEOMETRY_BINDING_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
11 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" |
12 #include "third_party/khronos/GLES2/gl2ext.h" | 12 #include "third_party/khronos/GLES2/gl2ext.h" |
13 #include "ui/gfx/geometry/rect_f.h" | 13 #include "ui/gfx/geometry/rect_f.h" |
14 | 14 |
15 namespace gfx { | |
16 class QuadF; | |
17 class Quad; | |
18 class QuadIndex; | |
19 class PointF; | |
20 } | |
21 | |
22 namespace cc { | 15 namespace cc { |
23 | 16 |
24 struct GeometryBindingVertex { | 17 struct GeometryBindingVertex { |
25 float a_position[3]; | 18 float a_position[3]; |
26 float a_texCoord[2]; | 19 float a_texCoord[2]; |
27 // Index of the vertex, divide by 4 to have the matrix for this quad. | 20 // Index of the vertex, divide by 4 to have the matrix for this quad. |
28 float a_index; | 21 float a_index; |
29 }; | 22 }; |
30 | 23 |
31 struct GeometryBindingQuad { | 24 struct GeometryBindingQuad { |
(...skipping 10 matching lines...) Expand all Loading... |
42 GeometryBindingQuadIndex(uint16_t index0, | 35 GeometryBindingQuadIndex(uint16_t index0, |
43 uint16_t index1, | 36 uint16_t index1, |
44 uint16_t index2, | 37 uint16_t index2, |
45 uint16_t index3, | 38 uint16_t index3, |
46 uint16_t index4, | 39 uint16_t index4, |
47 uint16_t index5); | 40 uint16_t index5); |
48 | 41 |
49 uint16_t data[6]; | 42 uint16_t data[6]; |
50 }; | 43 }; |
51 | 44 |
52 class DrawQuad; | |
53 class DrawPolygon; | |
54 | |
55 struct GeometryBinding { | 45 struct GeometryBinding { |
56 // All layer shaders share the same attribute locations for the vertex | 46 // All layer shaders share the same attribute locations for the vertex |
57 // positions and texture coordinates. This allows switching shaders without | 47 // positions and texture coordinates. This allows switching shaders without |
58 // rebinding attribute arrays. | 48 // rebinding attribute arrays. |
59 static int PositionAttribLocation() { return 0; } | 49 static int PositionAttribLocation() { return 0; } |
60 static int TexCoordAttribLocation() { return 1; } | 50 static int TexCoordAttribLocation() { return 1; } |
61 static int TriangleIndexAttribLocation() { return 2; } | 51 static int TriangleIndexAttribLocation() { return 2; } |
62 }; | 52 }; |
63 | 53 |
64 void SetupGLContext(gpu::gles2::GLES2Interface* gl, | 54 void SetupGLContext(gpu::gles2::GLES2Interface* gl, |
65 GLuint quad_elements_vbo, | 55 GLuint quad_elements_vbo, |
66 GLuint quad_vertices_vbo); | 56 GLuint quad_vertices_vbo); |
67 | 57 |
68 } // namespace cc | 58 } // namespace cc |
69 | 59 |
70 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ | 60 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ |
OLD | NEW |