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

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

Issue 1535603006: Move some program building utils from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix build Created 4 years, 11 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/GrGLProgram.h » ('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
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 100 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
101 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 101 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
102 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 102 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
103 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 103 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
104 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); 104 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
105 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); 105 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
106 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); 106 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
107 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); 107 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
108 GR_STATIC_ASSERT(9 == kGrSLTypeCount); 108 GR_STATIC_ASSERT(9 == kGrSLTypeCount);
109 } 109 }
110
111 /** Returns the size in bytes for floating point GrSLTypes. For non floating poi nt type returns 0 */
112 static inline size_t GrSLTypeSize(GrSLType type) {
113 SkASSERT(GrSLTypeIsFloatType(type));
114 static const size_t kSizes[] = {
115 0, // kVoid_GrSLType
116 sizeof(float), // kFloat_GrSLType
117 2 * sizeof(float), // kVec2f_GrSLType
118 3 * sizeof(float), // kVec3f_GrSLType
119 4 * sizeof(float), // kVec4f_GrSLType
120 9 * sizeof(float), // kMat33f_GrSLType
121 16 * sizeof(float), // kMat44f_GrSLType
122 0, // kSampler2D_GrSLType
123 0 // kSamplerExternal_GrSLType
124 };
125 return kSizes[type];
126
127 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
128 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
129 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
130 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
131 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
132 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
133 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
134 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
135 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
136 GR_STATIC_ASSERT(9 == kGrSLTypeCount);
137 }
138
110 ////////////////////////////////////////////////////////////////////////////// 139 //////////////////////////////////////////////////////////////////////////////
111 140
112 /** 141 /**
113 * Types used to describe format of vertices in arrays. 142 * Types used to describe format of vertices in arrays.
114 */ 143 */
115 enum GrVertexAttribType { 144 enum GrVertexAttribType {
116 kFloat_GrVertexAttribType = 0, 145 kFloat_GrVertexAttribType = 0,
117 kVec2f_GrVertexAttribType, 146 kVec2f_GrVertexAttribType,
118 kVec3f_GrVertexAttribType, 147 kVec3f_GrVertexAttribType,
119 kVec4f_GrVertexAttribType, 148 kVec4f_GrVertexAttribType,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Takes a pointer to a GrCaps, and will suppress prints if required 312 // Takes a pointer to a GrCaps, and will suppress prints if required
284 #define GrCapsDebugf(caps, ...) \ 313 #define GrCapsDebugf(caps, ...) \
285 if (!caps->suppressPrints()) { \ 314 if (!caps->suppressPrints()) { \
286 SkDebugf(__VA_ARGS__); \ 315 SkDebugf(__VA_ARGS__); \
287 } 316 }
288 #else 317 #else
289 #define GrCapsDebugf(caps, ...) 318 #define GrCapsDebugf(caps, ...)
290 #endif 319 #endif
291 320
292 #endif 321 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698