OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGLVertexArray_DEFINED | 8 #ifndef GrGLVertexArray_DEFINED |
9 #define GrGLVertexArray_DEFINED | 9 #define GrGLVertexArray_DEFINED |
10 | 10 |
11 #include "GrResource.h" | 11 #include "GrResource.h" |
12 #include "GrTypesPriv.h" | 12 #include "GrTypesPriv.h" |
13 #include "gl/GrGLDefines.h" | 13 #include "gl/GrGLDefines.h" |
14 #include "gl/GrGLFunctions.h" | 14 #include "gl/GrGLFunctions.h" |
15 | 15 |
16 #include "SkTArray.h" | 16 #include "SkTArray.h" |
17 | 17 |
18 class GrGLVertexBuffer; | 18 class GrGLVertexBuffer; |
19 class GrGLIndexBuffer; | 19 class GrGLIndexBuffer; |
20 class GrGpuGL; | 20 class GrGpuGL; |
21 | 21 |
22 struct GrGLAttribLayout { | 22 struct GrGLAttribLayout { |
23 GrGLint fCount; | 23 GrGLint fCount; |
24 GrGLenum fType; | 24 GrGLenum fType; |
25 GrGLboolean fNormalized; | 25 GrGLboolean fNormalized; |
26 }; | 26 }; |
27 | 27 |
28 static inline const GrGLAttribLayout& GrGLAttribTypeToLayout(GrVertexAttribType
type) { | 28 static inline const GrGLAttribLayout& GrGLAttribTypeToLayout(GrVertexAttribType
type) { |
29 GrAssert(type >= 0 && type < kGrVertexAttribTypeCount); | 29 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); |
30 static const GrGLAttribLayout kLayouts[kGrVertexAttribTypeCount] = { | 30 static const GrGLAttribLayout kLayouts[kGrVertexAttribTypeCount] = { |
31 {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType | 31 {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType |
32 {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType | 32 {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType |
33 {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType | 33 {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType |
34 {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType | 34 {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType |
35 {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType | 35 {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType |
36 }; | 36 }; |
37 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); | 37 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); |
38 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); | 38 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); |
39 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); | 39 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 private: | 165 private: |
166 GrGLuint fID; | 166 GrGLuint fID; |
167 GrGLAttribArrayState fAttribArrays; | 167 GrGLAttribArrayState fAttribArrays; |
168 GrGLuint fIndexBufferID; | 168 GrGLuint fIndexBufferID; |
169 bool fIndexBufferIDIsValid; | 169 bool fIndexBufferIDIsValid; |
170 | 170 |
171 typedef GrResource INHERITED; | 171 typedef GrResource INHERITED; |
172 }; | 172 }; |
173 | 173 |
174 #endif | 174 #endif |
OLD | NEW |