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

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

Issue 2143143002: Add Texture2D and Sampler GrSLTypes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits Created 4 years, 5 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
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 #include "SkRefCnt.h" 13 #include "SkRefCnt.h"
14 14
15 /** 15 /**
16 * Types of shader-language-specific boxed variables we can create. (Currently only GrGLShaderVars, 16 * Types of shader-language-specific boxed variables we can create. (Currently only GrGLShaderVars,
17 * but should be applicable to other shader languages.) 17 * but should be applicable to other shader languages.)
18 */ 18 */
19 enum GrSLType { 19 enum GrSLType {
20 kVoid_GrSLType, 20 kVoid_GrSLType,
21 kFloat_GrSLType, 21 kFloat_GrSLType,
22 kVec2f_GrSLType, 22 kVec2f_GrSLType,
23 kVec3f_GrSLType, 23 kVec3f_GrSLType,
24 kVec4f_GrSLType, 24 kVec4f_GrSLType,
25 kMat22f_GrSLType, 25 kMat22f_GrSLType,
26 kMat33f_GrSLType, 26 kMat33f_GrSLType,
27 kMat44f_GrSLType, 27 kMat44f_GrSLType,
28 kSampler2D_GrSLType, 28 kTexture2DSampler_GrSLType,
29 kSamplerExternal_GrSLType, 29 kTextureExternalSampler_GrSLType,
30 kSampler2DRect_GrSLType, 30 kTexture2DRectSampler_GrSLType,
31 kSamplerBuffer_GrSLType, 31 kTextureBufferSampler_GrSLType,
32 kBool_GrSLType, 32 kBool_GrSLType,
33 kInt_GrSLType, 33 kInt_GrSLType,
34 kUint_GrSLType, 34 kUint_GrSLType,
35 kTexture2D_GrSLType,
36 kSampler_GrSLType,
35 37
36 kLast_GrSLType = kUint_GrSLType 38 kLast_GrSLType = kSampler_GrSLType
37 }; 39 };
38 static const int kGrSLTypeCount = kLast_GrSLType + 1; 40 static const int kGrSLTypeCount = kLast_GrSLType + 1;
39 41
40 enum GrShaderType { 42 enum GrShaderType {
41 kVertex_GrShaderType, 43 kVertex_GrShaderType,
42 kGeometry_GrShaderType, 44 kGeometry_GrShaderType,
43 kFragment_GrShaderType, 45 kFragment_GrShaderType,
44 46
45 kLastkFragment_GrShaderType = kFragment_GrShaderType 47 kLastkFragment_GrShaderType = kFragment_GrShaderType
46 }; 48 };
(...skipping 24 matching lines...) Expand all
71 kLast_GrSLPrecision = kHigh_GrSLPrecision 73 kLast_GrSLPrecision = kHigh_GrSLPrecision
72 }; 74 };
73 75
74 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; 76 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
75 77
76 /** 78 /**
77 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample rs. 79 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample rs.
78 */ 80 */
79 static inline int GrSLTypeVectorCount(GrSLType type) { 81 static inline int GrSLTypeVectorCount(GrSLType type) {
80 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 82 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
81 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1 , 1, 1 }; 83 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1 , 1, 1, -1, -1 };
82 return kCounts[type]; 84 return kCounts[type];
83 85
84 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 86 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
85 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 87 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
86 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 88 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
87 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 89 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
88 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 90 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
89 GR_STATIC_ASSERT(5 == kMat22f_GrSLType); 91 GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
90 GR_STATIC_ASSERT(6 == kMat33f_GrSLType); 92 GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
91 GR_STATIC_ASSERT(7 == kMat44f_GrSLType); 93 GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
92 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 94 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
93 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 95 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
94 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 96 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
95 GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); 97 GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
96 GR_STATIC_ASSERT(12 == kBool_GrSLType); 98 GR_STATIC_ASSERT(12 == kBool_GrSLType);
97 GR_STATIC_ASSERT(13 == kInt_GrSLType); 99 GR_STATIC_ASSERT(13 == kInt_GrSLType);
98 GR_STATIC_ASSERT(14 == kUint_GrSLType); 100 GR_STATIC_ASSERT(14 == kUint_GrSLType);
101 GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
102 GR_STATIC_ASSERT(16 == kSampler_GrSLType);
99 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount); 103 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
100 } 104 }
101 105
102 /** Return the type enum for a vector of floats of length n (1..4), 106 /** Return the type enum for a vector of floats of length n (1..4),
103 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ 107 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */
104 static inline GrSLType GrSLFloatVectorType(int count) { 108 static inline GrSLType GrSLFloatVectorType(int count) {
105 SkASSERT(count > 0 && count <= 4); 109 SkASSERT(count > 0 && count <= 4);
106 return (GrSLType)(count); 110 return (GrSLType)(count);
107 111
108 GR_STATIC_ASSERT(kFloat_GrSLType == 1); 112 GR_STATIC_ASSERT(kFloat_GrSLType == 1);
109 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); 113 GR_STATIC_ASSERT(kVec2f_GrSLType == 2);
110 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); 114 GR_STATIC_ASSERT(kVec3f_GrSLType == 3);
111 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); 115 GR_STATIC_ASSERT(kVec4f_GrSLType == 4);
112 } 116 }
113 117
114 /** Is the shading language type float (including vectors/matrices)? */ 118 /** Is the shading language type float (including vectors/matrices)? */
115 static inline bool GrSLTypeIsFloatType(GrSLType type) { 119 static inline bool GrSLTypeIsFloatType(GrSLType type) {
116 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 120 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
117 return type >= kFloat_GrSLType && type <= kMat44f_GrSLType; 121 return type >= kFloat_GrSLType && type <= kMat44f_GrSLType;
118 122
119 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 123 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
120 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 124 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
121 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 125 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
122 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 126 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
123 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 127 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
124 GR_STATIC_ASSERT(5 == kMat22f_GrSLType); 128 GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
125 GR_STATIC_ASSERT(6 == kMat33f_GrSLType); 129 GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
126 GR_STATIC_ASSERT(7 == kMat44f_GrSLType); 130 GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
127 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 131 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
128 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 132 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
129 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 133 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
130 GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); 134 GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
131 GR_STATIC_ASSERT(12 == kBool_GrSLType); 135 GR_STATIC_ASSERT(12 == kBool_GrSLType);
132 GR_STATIC_ASSERT(13 == kInt_GrSLType); 136 GR_STATIC_ASSERT(13 == kInt_GrSLType);
133 GR_STATIC_ASSERT(14 == kUint_GrSLType); 137 GR_STATIC_ASSERT(14 == kUint_GrSLType);
134 GR_STATIC_ASSERT(15 == kGrSLTypeCount); 138 GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
139 GR_STATIC_ASSERT(16 == kSampler_GrSLType);
140 GR_STATIC_ASSERT(17 == kGrSLTypeCount);
135 } 141 }
136 142
137 /** Is the shading language type integral (including vectors/matrices)? */ 143 /** Is the shading language type integral (including vectors/matrices)? */
138 static inline bool GrSLTypeIsIntType(GrSLType type) { 144 static inline bool GrSLTypeIsIntType(GrSLType type) {
139 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 145 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
140 return type >= kInt_GrSLType; 146 return type >= kInt_GrSLType && type <= kUint_GrSLType;
141 147
142 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 148 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
143 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 149 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
144 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 150 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
145 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 151 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
146 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 152 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
147 GR_STATIC_ASSERT(5 == kMat22f_GrSLType); 153 GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
148 GR_STATIC_ASSERT(6 == kMat33f_GrSLType); 154 GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
149 GR_STATIC_ASSERT(7 == kMat44f_GrSLType); 155 GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
150 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 156 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
151 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 157 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
152 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 158 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
153 GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); 159 GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
154 GR_STATIC_ASSERT(12 == kBool_GrSLType); 160 GR_STATIC_ASSERT(12 == kBool_GrSLType);
155 GR_STATIC_ASSERT(13 == kInt_GrSLType); 161 GR_STATIC_ASSERT(13 == kInt_GrSLType);
156 GR_STATIC_ASSERT(14 == kUint_GrSLType); 162 GR_STATIC_ASSERT(14 == kUint_GrSLType);
157 GR_STATIC_ASSERT(15 == kGrSLTypeCount); 163 GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
164 GR_STATIC_ASSERT(16 == kSampler_GrSLType);
165 GR_STATIC_ASSERT(17 == kGrSLTypeCount);
158 } 166 }
159 167
160 /** Is the shading language type numeric (including vectors/matrices)? */ 168 /** Is the shading language type numeric (including vectors/matrices)? */
161 static inline bool GrSLTypeIsNumeric(GrSLType type) { 169 static inline bool GrSLTypeIsNumeric(GrSLType type) {
162 return GrSLTypeIsFloatType(type) || GrSLTypeIsIntType(type); 170 return GrSLTypeIsFloatType(type) || GrSLTypeIsIntType(type);
163 } 171 }
164 172
165 /** Returns the size in bytes for floating point GrSLTypes. For non floating poi nt type returns 0 */ 173 /** Returns the size in bytes for floating point GrSLTypes. For non floating poi nt type returns 0 */
166 static inline size_t GrSLTypeSize(GrSLType type) { 174 static inline size_t GrSLTypeSize(GrSLType type) {
167 SkASSERT(GrSLTypeIsFloatType(type)); 175 SkASSERT(GrSLTypeIsFloatType(type));
168 static const size_t kSizes[] = { 176 static const size_t kSizes[] = {
169 0, // kVoid_GrSLType 177 0, // kVoid_GrSLType
170 sizeof(float), // kFloat_GrSLType 178 sizeof(float), // kFloat_GrSLType
171 2 * sizeof(float), // kVec2f_GrSLType 179 2 * sizeof(float), // kVec2f_GrSLType
172 3 * sizeof(float), // kVec3f_GrSLType 180 3 * sizeof(float), // kVec3f_GrSLType
173 4 * sizeof(float), // kVec4f_GrSLType 181 4 * sizeof(float), // kVec4f_GrSLType
174 2 * 2 * sizeof(float), // kMat22f_GrSLType 182 2 * 2 * sizeof(float), // kMat22f_GrSLType
175 3 * 3 * sizeof(float), // kMat33f_GrSLType 183 3 * 3 * sizeof(float), // kMat33f_GrSLType
176 4 * 4 * sizeof(float), // kMat44f_GrSLType 184 4 * 4 * sizeof(float), // kMat44f_GrSLType
177 0, // kSampler2D_GrSLType 185 0, // kTexture2DSampler_GrSLType
178 0, // kSamplerExternal_GrSLType 186 0, // kTextureExternalSampler_GrSLType
179 0, // kSampler2DRect_GrSLType 187 0, // kTexture2DRectSampler_GrSLType
180 0, // kSamplerBuffer_GrSLType 188 0, // kTextureBufferSampler_GrSLType
181 0, // kBool_GrSLType 189 0, // kBool_GrSLType
182 0, // kInt_GrSLType 190 0, // kInt_GrSLType
183 0, // kUint_GrSLType 191 0, // kUint_GrSLType
192 0, // kTexture2D_GrSLType
193 0, // kSampler_GrSLType
184 }; 194 };
185 return kSizes[type]; 195 return kSizes[type];
186 196
187 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 197 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
188 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 198 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
189 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 199 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
190 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 200 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
191 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 201 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
192 GR_STATIC_ASSERT(5 == kMat22f_GrSLType); 202 GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
193 GR_STATIC_ASSERT(6 == kMat33f_GrSLType); 203 GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
194 GR_STATIC_ASSERT(7 == kMat44f_GrSLType); 204 GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
195 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 205 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
196 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 206 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
197 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 207 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
198 GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); 208 GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
199 GR_STATIC_ASSERT(12 == kBool_GrSLType); 209 GR_STATIC_ASSERT(12 == kBool_GrSLType);
200 GR_STATIC_ASSERT(13 == kInt_GrSLType); 210 GR_STATIC_ASSERT(13 == kInt_GrSLType);
201 GR_STATIC_ASSERT(14 == kUint_GrSLType); 211 GR_STATIC_ASSERT(14 == kUint_GrSLType);
202 GR_STATIC_ASSERT(15 == kGrSLTypeCount); 212 GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
213 GR_STATIC_ASSERT(16 == kSampler_GrSLType);
214 GR_STATIC_ASSERT(17 == kGrSLTypeCount);
203 } 215 }
204 216
205 static inline bool GrSLTypeIs2DTextureType(GrSLType type) { 217 static inline bool GrSLTypeIs2DCombinedSamplerType(GrSLType type) {
206 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 218 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
207 return type >= kSampler2D_GrSLType && type <= kSampler2DRect_GrSLType; 219 return type >= kTexture2DSampler_GrSLType && type <= kTexture2DRectSampler_G rSLType;
208 220
209 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 221 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
210 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 222 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
211 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 223 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
212 } 224 }
213 225
214 static inline bool GrSLTypeIsSamplerType(GrSLType type) { 226 static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) {
215 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 227 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
216 return type >= kSampler2D_GrSLType && type <= kSamplerBuffer_GrSLType; 228 return type >= kTexture2DSampler_GrSLType && type <= kTextureBufferSampler_G rSLType;
217 229
218 GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); 230 GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType);
219 GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); 231 GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType);
220 GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); 232 GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType);
221 GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); 233 GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType);
222 } 234 }
223 235
224 static inline bool GrSLTypeAcceptsPrecision(GrSLType type) { 236 static inline bool GrSLTypeAcceptsPrecision(GrSLType type) {
225 return GrSLTypeIsNumeric(type) || GrSLTypeIsSamplerType(type); 237 return type != kVoid_GrSLType && type != kBool_GrSLType;
226 } 238 }
227 239
228 ////////////////////////////////////////////////////////////////////////////// 240 //////////////////////////////////////////////////////////////////////////////
229 241
230 /** 242 /**
231 * Types used to describe format of vertices in arrays. 243 * Types used to describe format of vertices in arrays.
232 */ 244 */
233 enum GrVertexAttribType { 245 enum GrVertexAttribType {
234 kFloat_GrVertexAttribType = 0, 246 kFloat_GrVertexAttribType = 0,
235 kVec2f_GrVertexAttribType, 247 kVec2f_GrVertexAttribType,
236 kVec3f_GrVertexAttribType, 248 kVec3f_GrVertexAttribType,
237 kVec4f_GrVertexAttribType, 249 kVec4f_GrVertexAttribType,
238 250
239 kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage 251 kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage
240 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors 252 kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors
241 253
242 kVec2us_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinate s 254 kVec2us_GrVertexAttribType, // vector of 2 shorts, e.g. texture coordinate s
243 255
244 kInt_GrVertexAttribType, 256 kInt_GrVertexAttribType,
245 kUint_GrVertexAttribType, 257 kUint_GrVertexAttribType,
246 258
247 kLast_GrVertexAttribType = kUint_GrVertexAttribType 259 kLast_GrVertexAttribType = kUint_GrVertexAttribType
248 }; 260 };
249 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; 261 static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
250 262
251 /** 263 /**
252 * Returns the vector size of the type. 264 * Returns the vector size of the type.
253 */ 265 */
254 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) { 266 static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
255 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount); 267 SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
256 static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2, 1, 1 }; 268 static const int kCounts[] = { 1, 2, 3, 4, 1, 4, 2, 1, 1 };
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 /** Holder destroys the backend object. */ 488 /** Holder destroys the backend object. */
477 kOwned = true 489 kOwned = true
478 }; 490 };
479 491
480 template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> cons t * sp) { 492 template <typename T> T * const * sk_sp_address_as_pointer_address(sk_sp<T> cons t * sp) {
481 static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size."); 493 static_assert(sizeof(T*) == sizeof(sk_sp<T>), "sk_sp not expected size.");
482 return reinterpret_cast<T * const *>(sp); 494 return reinterpret_cast<T * const *>(sp);
483 } 495 }
484 496
485 #endif 497 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698