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