| 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. | 9 #include "cc/output/gl_renderer.h" // For the GLC() macro. |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 struct GeometryBindingVertex { | 24 struct GeometryBindingVertex { |
| 25 float a_position[3]; | 25 float a_position[3]; |
| 26 float a_texCoord[2]; | 26 float a_texCoord[2]; |
| 27 // Index of the vertex, divide by 4 to have the matrix for this quad. | 27 // Index of the vertex, divide by 4 to have the matrix for this quad. |
| 28 float a_index; | 28 float a_index; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 struct GeometryBindingQuad { | 31 struct GeometryBindingQuad { |
| 32 GeometryBindingQuad(); |
| 33 GeometryBindingQuad(const GeometryBindingVertex& vert0, |
| 34 const GeometryBindingVertex& vert1, |
| 35 const GeometryBindingVertex& vert2, |
| 36 const GeometryBindingVertex& vert3); |
| 32 GeometryBindingVertex v0, v1, v2, v3; | 37 GeometryBindingVertex v0, v1, v2, v3; |
| 33 }; | 38 }; |
| 34 | 39 |
| 35 struct GeometryBindingQuadIndex { | 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 |
| 36 uint16 data[6]; | 49 uint16 data[6]; |
| 37 }; | 50 }; |
| 38 | 51 |
| 39 class DrawQuad; | 52 class DrawQuad; |
| 40 class DrawPolygon; | 53 class DrawPolygon; |
| 41 | 54 |
| 42 struct GeometryBinding { | 55 struct GeometryBinding { |
| 43 // All layer shaders share the same attribute locations for the vertex | 56 // All layer shaders share the same attribute locations for the vertex |
| 44 // positions and texture coordinates. This allows switching shaders without | 57 // positions and texture coordinates. This allows switching shaders without |
| 45 // rebinding attribute arrays. | 58 // rebinding attribute arrays. |
| 46 static int PositionAttribLocation() { return 0; } | 59 static int PositionAttribLocation() { return 0; } |
| 47 static int TexCoordAttribLocation() { return 1; } | 60 static int TexCoordAttribLocation() { return 1; } |
| 48 static int TriangleIndexAttribLocation() { return 2; } | 61 static int TriangleIndexAttribLocation() { return 2; } |
| 49 }; | 62 }; |
| 50 | 63 |
| 51 void SetupGLContext(gpu::gles2::GLES2Interface* gl, | 64 void SetupGLContext(gpu::gles2::GLES2Interface* gl, |
| 52 GLuint quad_elements_vbo, | 65 GLuint quad_elements_vbo, |
| 53 GLuint quad_vertices_vbo); | 66 GLuint quad_vertices_vbo); |
| 54 | 67 |
| 55 } // namespace cc | 68 } // namespace cc |
| 56 | 69 |
| 57 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ | 70 #endif // CC_OUTPUT_GEOMETRY_BINDING_H_ |
| OLD | NEW |