| 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 "base/basictypes.h" | 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" | 9 #include "third_party/khronos/GLES2/gl2.h" |
| 12 #include "third_party/khronos/GLES2/gl2ext.h" | |
| 13 #include "ui/gfx/geometry/rect_f.h" | |
| 14 | 10 |
| 15 namespace gfx { | 11 namespace gfx { |
| 16 class QuadF; | 12 class RectF; |
| 17 class Quad; | 13 } |
| 18 class QuadIndex; | 14 namespace gpu { |
| 19 class PointF; | 15 namespace gles2 { |
| 16 class GLES2Interface; |
| 17 } |
| 20 } | 18 } |
| 21 | 19 |
| 22 namespace cc { | 20 namespace cc { |
| 23 | 21 |
| 24 struct GeometryBindingVertex { | 22 class GeometryBinding { |
| 25 float a_position[3]; | 23 public: |
| 26 float a_texCoord[2]; | 24 GeometryBinding(gpu::gles2::GLES2Interface* gl, |
| 27 // Index of the vertex, divide by 4 to have the matrix for this quad. | 25 const gfx::RectF& quad_vertex_rect); |
| 28 float a_index; | 26 ~GeometryBinding(); |
| 29 }; | |
| 30 | 27 |
| 31 struct GeometryBindingQuad { | 28 void PrepareForDraw(); |
| 32 GeometryBindingVertex v0, v1, v2, v3; | |
| 33 }; | |
| 34 | 29 |
| 35 struct GeometryBindingQuadIndex { | |
| 36 uint16 data[6]; | |
| 37 }; | |
| 38 | |
| 39 class DrawQuad; | |
| 40 class DrawPolygon; | |
| 41 | |
| 42 struct GeometryBinding { | |
| 43 // All layer shaders share the same attribute locations for the vertex | 30 // All layer shaders share the same attribute locations for the vertex |
| 44 // positions and texture coordinates. This allows switching shaders without | 31 // positions and texture coordinates. This allows switching shaders without |
| 45 // rebinding attribute arrays. | 32 // rebinding attribute arrays. |
| 46 static int PositionAttribLocation() { return 0; } | 33 static int PositionAttribLocation() { return 0; } |
| 47 static int TexCoordAttribLocation() { return 1; } | 34 static int TexCoordAttribLocation() { return 1; } |
| 48 static int TriangleIndexAttribLocation() { return 2; } | 35 static int TriangleIndexAttribLocation() { return 2; } |
| 36 |
| 37 private: |
| 38 gpu::gles2::GLES2Interface* gl_; |
| 39 |
| 40 GLuint quad_vertices_vbo_; |
| 41 GLuint quad_elements_vbo_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(GeometryBinding); |
| 49 }; | 44 }; |
| 50 | 45 |
| 51 void SetupGLContext(gpu::gles2::GLES2Interface* gl, | |
| 52 GLuint quad_elements_vbo, | |
| 53 GLuint quad_vertices_vbo); | |
| 54 | |
| 55 } // namespace cc | 46 } // namespace cc |
| 56 | 47 |
| 57 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ | 48 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ |
| OLD | NEW |