Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: include/gpu/GrTypesPriv.h

Issue 216503004: SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 27 matching lines...) Expand all
38 return kCounts[type]; 38 return kCounts[type];
39 39
40 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 40 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
41 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 41 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
42 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 42 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
43 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 43 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
44 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 44 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
45 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); 45 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
46 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); 46 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
47 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); 47 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
48 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrSLTypeCount); 48 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
49 } 49 }
50 50
51 /** Return the type enum for a vector of floats of length n (1..4), 51 /** Return the type enum for a vector of floats of length n (1..4),
52 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ 52 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */
53 static inline GrSLType GrSLFloatVectorType(int count) { 53 static inline GrSLType GrSLFloatVectorType(int count) {
54 SkASSERT(count > 0 && count <= 4); 54 SkASSERT(count > 0 && count <= 4);
55 return (GrSLType)(count); 55 return (GrSLType)(count);
56 56
57 GR_STATIC_ASSERT(kFloat_GrSLType == 1); 57 GR_STATIC_ASSERT(kFloat_GrSLType == 1);
58 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); 58 GR_STATIC_ASSERT(kVec2f_GrSLType == 2);
(...skipping 23 matching lines...) Expand all
82 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { 82 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
83 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); 83 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
84 static const int kCounts[] = { 1, 2, 3, 4, 4 }; 84 static const int kCounts[] = { 1, 2, 3, 4, 4 };
85 return kCounts[type]; 85 return kCounts[type];
86 86
87 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); 87 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
88 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); 88 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
89 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); 89 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
90 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); 90 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
91 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType); 91 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
92 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount); 92 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
93 } 93 }
94 94
95 /** 95 /**
96 * Returns the size of the attrib type in bytes. 96 * Returns the size of the attrib type in bytes.
97 */ 97 */
98 static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) { 98 static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
99 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); 99 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
100 static const size_t kSizes[] = { 100 static const size_t kSizes[] = {
101 sizeof(float), // kFloat_GrVertexAttribType 101 sizeof(float), // kFloat_GrVertexAttribType
102 2*sizeof(float), // kVec2f_GrVertexAttribType 102 2*sizeof(float), // kVec2f_GrVertexAttribType
103 3*sizeof(float), // kVec3f_GrVertexAttribType 103 3*sizeof(float), // kVec3f_GrVertexAttribType
104 4*sizeof(float), // kVec4f_GrVertexAttribType 104 4*sizeof(float), // kVec4f_GrVertexAttribType
105 4*sizeof(char) // kVec4ub_GrVertexAttribType 105 4*sizeof(char) // kVec4ub_GrVertexAttribType
106 }; 106 };
107 return kSizes[type]; 107 return kSizes[type];
108 108
109 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); 109 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
110 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); 110 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
111 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); 111 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
112 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); 112 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
113 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType); 113 GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
114 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount); 114 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
115 } 115 }
116 116
117 /** 117 /**
118 * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a GrEffect. 118 * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a GrEffect.
119 * Each binding other than kEffect may not appear more than once in the current set of attributes. 119 * Each binding other than kEffect may not appear more than once in the current set of attributes.
120 * kPosition must be appear for exactly one attribute. 120 * kPosition must be appear for exactly one attribute.
121 */ 121 */
122 enum GrVertexAttribBinding { 122 enum GrVertexAttribBinding {
123 kPosition_GrVertexAttribBinding, // required, must have vector count of 2 123 kPosition_GrVertexAttribBinding, // required, must have vector count of 2
124 kLocalCoord_GrVertexAttribBinding, // must have vector count of 2 124 kLocalCoord_GrVertexAttribBinding, // must have vector count of 2
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return kFillBW_GrEffectEdgeType; 211 return kFillBW_GrEffectEdgeType;
212 case kInverseFillAA_GrEffectEdgeType: 212 case kInverseFillAA_GrEffectEdgeType:
213 return kFillAA_GrEffectEdgeType; 213 return kFillAA_GrEffectEdgeType;
214 case kHairlineAA_GrEffectEdgeType: 214 case kHairlineAA_GrEffectEdgeType:
215 GrCrash("Hairline fill isn't invertible."); 215 GrCrash("Hairline fill isn't invertible.");
216 } 216 }
217 return kFillAA_GrEffectEdgeType; // suppress warning. 217 return kFillAA_GrEffectEdgeType; // suppress warning.
218 } 218 }
219 219
220 #endif 220 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698