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

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

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