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