Chromium Code Reviews| 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 GrTypesPriv_DEFINED | 8 #ifndef GrTypesPriv_DEFINED |
| 9 #define GrTypesPriv_DEFINED | 9 #define GrTypesPriv_DEFINED |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Types of shader-language-specific boxed variables we can create. | 12 * Types of shader-language-specific boxed variables we can create. |
| 13 * (Currently only GrGLShaderVars, but should be applicable to other shader | 13 * (Currently only GrGLShaderVars, but should be applicable to other shader |
| 14 * languages.) | 14 * languages.) |
| 15 */ | 15 */ |
| 16 enum GrSLType { | 16 enum GrSLType { |
| 17 kVoid_GrSLType, | 17 kVoid_GrSLType, |
| 18 kFloat_GrSLType, | 18 kFloat_GrSLType, |
| 19 kVec2f_GrSLType, | 19 kVec2f_GrSLType, |
| 20 kVec3f_GrSLType, | 20 kVec3f_GrSLType, |
| 21 kVec4f_GrSLType, | 21 kVec4f_GrSLType, |
| 22 kMat33f_GrSLType, | 22 kMat33f_GrSLType, |
| 23 kMat44f_GrSLType, | 23 kMat44f_GrSLType, |
| 24 kSampler2D_GrSLType | 24 kSampler2D_GrSLType |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 /** | |
|
bsalomon
2013/03/27 15:45:47
This is moved from GrDrawState.h
| |
| 28 * Types used to describe format of vertices in arrays | |
| 29 */ | |
| 30 enum GrVertexAttribType { | |
| 31 kFloat_GrVertexAttribType = 0, | |
| 32 kVec2f_GrVertexAttribType, | |
| 33 kVec3f_GrVertexAttribType, | |
| 34 kVec4f_GrVertexAttribType, | |
| 35 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors | |
| 36 | |
| 37 kLast_GrVertexAttribType = kVec4ub_GrVertexAttribType | |
| 38 }; | |
| 39 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; | |
| 40 | |
| 41 struct GrVertexAttrib { | |
| 42 inline void set(GrVertexAttribType type, size_t offset) { | |
| 43 fType = type; fOffset = offset; | |
| 44 } | |
| 45 bool operator==(const GrVertexAttrib& other) const { | |
| 46 return fType == other.fType && fOffset == other.fOffset; | |
| 47 }; | |
| 48 bool operator!=(const GrVertexAttrib& other) const { return !(*this == other ); } | |
| 49 | |
| 50 GrVertexAttribType fType; | |
| 51 size_t fOffset; | |
| 52 }; | |
| 53 | |
| 54 template <int N> | |
| 55 class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {}; | |
| 56 | |
| 27 #endif | 57 #endif |
| OLD | NEW |