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

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

Issue 1459323004: Revert of Initial version of external_oes texture support and unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@target
Patch Set: Created 5 years, 1 month 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 | include/gpu/gl/GrGLFunctions.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
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "SkTArray.h" 12 #include "SkTArray.h"
13 #include "SkRect.h" 13 #include "SkRect.h"
14 14
15 /** 15 /**
16 * Types of shader-language-specific boxed variables we can create. (Currently o nly GrGLShaderVars, 16 * Types of shader-language-specific boxed variables we can create. (Currently o nly 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 kMat33f_GrSLType, 25 kMat33f_GrSLType,
26 kMat44f_GrSLType, 26 kMat44f_GrSLType,
27 kSampler2D_GrSLType, 27 kSampler2D_GrSLType,
28 kSamplerExternal_GrSLType,
29 28
30 kLast_GrSLType = kSamplerExternal_GrSLType 29 kLast_GrSLType = kSampler2D_GrSLType
31 }; 30 };
32 static const int kGrSLTypeCount = kLast_GrSLType + 1; 31 static const int kGrSLTypeCount = kLast_GrSLType + 1;
33 32
34 enum GrShaderType { 33 enum GrShaderType {
35 kVertex_GrShaderType, 34 kVertex_GrShaderType,
36 kGeometry_GrShaderType, 35 kGeometry_GrShaderType,
37 kFragment_GrShaderType, 36 kFragment_GrShaderType,
38 37
39 kLastkFragment_GrShaderType = kFragment_GrShaderType 38 kLastkFragment_GrShaderType = kFragment_GrShaderType
40 }; 39 };
(...skipping 16 matching lines...) Expand all
57 kLast_GrSLPrecision = kHigh_GrSLPrecision 56 kLast_GrSLPrecision = kHigh_GrSLPrecision
58 }; 57 };
59 58
60 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; 59 static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
61 60
62 /** 61 /**
63 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample rs. 62 * Gets the vector size of the SLType. Returns -1 for void, matrices, and sample rs.
64 */ 63 */
65 static inline int GrSLTypeVectorCount(GrSLType type) { 64 static inline int GrSLTypeVectorCount(GrSLType type) {
66 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 65 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
67 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1 }; 66 static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1 };
68 return kCounts[type]; 67 return kCounts[type];
69 68
70 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 69 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
71 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 70 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
72 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 71 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
73 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 72 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
74 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 73 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
75 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); 74 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
76 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); 75 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
77 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); 76 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
78 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
79 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount); 77 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
80 } 78 }
81 79
82 /** Return the type enum for a vector of floats of length n (1..4), 80 /** Return the type enum for a vector of floats of length n (1..4),
83 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */ 81 e.g. 1 -> kFloat_GrSLType, 2 -> kVec2_GrSLType, ... */
84 static inline GrSLType GrSLFloatVectorType(int count) { 82 static inline GrSLType GrSLFloatVectorType(int count) {
85 SkASSERT(count > 0 && count <= 4); 83 SkASSERT(count > 0 && count <= 4);
86 return (GrSLType)(count); 84 return (GrSLType)(count);
87 85
88 GR_STATIC_ASSERT(kFloat_GrSLType == 1); 86 GR_STATIC_ASSERT(kFloat_GrSLType == 1);
89 GR_STATIC_ASSERT(kVec2f_GrSLType == 2); 87 GR_STATIC_ASSERT(kVec2f_GrSLType == 2);
90 GR_STATIC_ASSERT(kVec3f_GrSLType == 3); 88 GR_STATIC_ASSERT(kVec3f_GrSLType == 3);
91 GR_STATIC_ASSERT(kVec4f_GrSLType == 4); 89 GR_STATIC_ASSERT(kVec4f_GrSLType == 4);
92 } 90 }
93 91
94 /** Is the shading language type floating point (or vector/matrix of fp)? */ 92 /** Is the shading language type floating point (or vector/matrix of fp)? */
95 static inline bool GrSLTypeIsFloatType(GrSLType type) { 93 static inline bool GrSLTypeIsFloatType(GrSLType type) {
96 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); 94 SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
97 return type >= 1 && type <= 6; 95 return type >= 1 && type <= 6;
98 96
99 GR_STATIC_ASSERT(0 == kVoid_GrSLType); 97 GR_STATIC_ASSERT(0 == kVoid_GrSLType);
100 GR_STATIC_ASSERT(1 == kFloat_GrSLType); 98 GR_STATIC_ASSERT(1 == kFloat_GrSLType);
101 GR_STATIC_ASSERT(2 == kVec2f_GrSLType); 99 GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
102 GR_STATIC_ASSERT(3 == kVec3f_GrSLType); 100 GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
103 GR_STATIC_ASSERT(4 == kVec4f_GrSLType); 101 GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
104 GR_STATIC_ASSERT(5 == kMat33f_GrSLType); 102 GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
105 GR_STATIC_ASSERT(6 == kMat44f_GrSLType); 103 GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
106 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType); 104 GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
107 GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType); 105 GR_STATIC_ASSERT(8 == kGrSLTypeCount);
108 GR_STATIC_ASSERT(9 == kGrSLTypeCount);
109 } 106 }
110 ////////////////////////////////////////////////////////////////////////////// 107 //////////////////////////////////////////////////////////////////////////////
111 108
112 /** 109 /**
113 * Types used to describe format of vertices in arrays. 110 * Types used to describe format of vertices in arrays.
114 */ 111 */
115 enum GrVertexAttribType { 112 enum GrVertexAttribType {
116 kFloat_GrVertexAttribType = 0, 113 kFloat_GrVertexAttribType = 0,
117 kVec2f_GrVertexAttribType, 114 kVec2f_GrVertexAttribType,
118 kVec3f_GrVertexAttribType, 115 kVec3f_GrVertexAttribType,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // Takes a pointer to a GrCaps, and will suppress prints if required 268 // Takes a pointer to a GrCaps, and will suppress prints if required
272 #define GrCapsDebugf(caps, ...) \ 269 #define GrCapsDebugf(caps, ...) \
273 if (!caps->suppressPrints()) { \ 270 if (!caps->suppressPrints()) { \
274 SkDebugf(__VA_ARGS__); \ 271 SkDebugf(__VA_ARGS__); \
275 } 272 }
276 #else 273 #else
277 #define GrCapsDebugf(caps, ...) 274 #define GrCapsDebugf(caps, ...)
278 #endif 275 #endif
279 276
280 #endif 277 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/gl/GrGLFunctions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698