Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
SkSLTypeShared.h File Reference
#include "include/core/SkTypes.h"

Go to the source code of this file.

Enumerations

enum class  SkSLType : char {
  kVoid , kBool , kBool2 , kBool3 ,
  kBool4 , kShort , kShort2 , kShort3 ,
  kShort4 , kUShort , kUShort2 , kUShort3 ,
  kUShort4 , kFloat , kFloat2 , kFloat3 ,
  kFloat4 , kFloat2x2 , kFloat3x3 , kFloat4x4 ,
  kHalf , kHalf2 , kHalf3 , kHalf4 ,
  kHalf2x2 , kHalf3x3 , kHalf4x4 , kInt ,
  kInt2 , kInt3 , kInt4 , kUInt ,
  kUInt2 , kUInt3 , kUInt4 , kTexture2DSampler ,
  kTextureExternalSampler , kTexture2DRectSampler , kTexture2D , kSampler ,
  kInput , kLast = kInput
}
 

Functions

const char * SkSLTypeString (SkSLType t)
 
static constexpr bool SkSLTypeIsFloatType (SkSLType type)
 
static constexpr bool SkSLTypeIsIntegralType (SkSLType type)
 
static constexpr int SkSLTypeVecLength (SkSLType type)
 
static constexpr bool SkSLTypeCanBeUniformValue (SkSLType type)
 
bool SkSLTypeIsFullPrecisionNumericType (SkSLType type)
 
int SkSLTypeMatrixSize (SkSLType type)
 
bool SkSLTypeIsCombinedSamplerType (SkSLType type)
 

Variables

static const int kSkSLTypeCount = static_cast<int>(SkSLType::kLast) + 1
 

Enumeration Type Documentation

◆ SkSLType

enum class SkSLType : char
strong

Types of shader-language-specific boxed variables we can create.

Enumerator
kVoid 
kBool 
kBool2 
kBool3 
kBool4 
kShort 
kShort2 
kShort3 
kShort4 
kUShort 
kUShort2 
kUShort3 
kUShort4 
kFloat 
kFloat2 
kFloat3 
kFloat4 
kFloat2x2 
kFloat3x3 
kFloat4x4 
kHalf 
kHalf2 
kHalf3 
kHalf4 
kHalf2x2 
kHalf3x3 
kHalf4x4 
kInt 
kInt2 
kInt3 
kInt4 
kUInt 
kUInt2 
kUInt3 
kUInt4 
kTexture2DSampler 
kTextureExternalSampler 
kTexture2DRectSampler 
kTexture2D 
kSampler 
kInput 
kLast 

Definition at line 16 of file SkSLTypeShared.h.

16 : char {
17 kVoid,
18 kBool,
19 kBool2,
20 kBool3,
21 kBool4,
22 kShort,
23 kShort2,
24 kShort3,
25 kShort4,
26 kUShort,
30 kFloat,
31 kFloat2,
32 kFloat3,
33 kFloat4,
37 kHalf,
38 kHalf2,
39 kHalf3,
40 kHalf4,
44 kInt,
45 kInt2,
46 kInt3,
47 kInt4,
48 kUInt,
49 kUInt2,
50 kUInt3,
51 kUInt4,
57 kInput,
58
60};
@ kTextureExternalSampler
@ kTexture2DSampler
@ kTexture2DRectSampler

Function Documentation

◆ SkSLTypeCanBeUniformValue()

static constexpr bool SkSLTypeCanBeUniformValue ( SkSLType  type)
staticconstexpr

Is the shading language type supported as a uniform (ie, does it have a corresponding set function on GrGLSLProgramDataManager)?

Definition at line 229 of file SkSLTypeShared.h.

229 {
230 // This is almost "IsFloatType || IsIntegralType" but excludes non-full precision int types.
231 switch(type) {
232 case SkSLType::kFloat:
239 case SkSLType::kHalf:
240 case SkSLType::kHalf2:
241 case SkSLType::kHalf3:
242 case SkSLType::kHalf4:
246
247 case SkSLType::kInt:
248 case SkSLType::kInt2:
249 case SkSLType::kInt3:
250 case SkSLType::kInt4:
251 case SkSLType::kUInt:
252 case SkSLType::kUInt2:
253 case SkSLType::kUInt3:
254 case SkSLType::kUInt4:
255 return true;
256
257 default:
258 return false;
259 }
260}

◆ SkSLTypeIsCombinedSamplerType()

bool SkSLTypeIsCombinedSamplerType ( SkSLType  type)

If the type represents a square matrix, return its size; otherwise, -1.

Definition at line 165 of file SkSLTypeShared.cpp.

165 {
166 switch (type) {
170 return true;
171
172 case SkSLType::kVoid:
173 case SkSLType::kFloat:
180 case SkSLType::kHalf:
181 case SkSLType::kHalf2:
182 case SkSLType::kHalf3:
183 case SkSLType::kHalf4:
187 case SkSLType::kInt:
188 case SkSLType::kInt2:
189 case SkSLType::kInt3:
190 case SkSLType::kInt4:
191 case SkSLType::kUInt:
192 case SkSLType::kUInt2:
193 case SkSLType::kUInt3:
194 case SkSLType::kUInt4:
195 case SkSLType::kBool:
196 case SkSLType::kBool2:
197 case SkSLType::kBool3:
198 case SkSLType::kBool4:
199 case SkSLType::kShort:
209 case SkSLType::kInput:
210 return false;
211 }
213}
#define SkUNREACHABLE
Definition SkAssert.h:135

◆ SkSLTypeIsFloatType()

static constexpr bool SkSLTypeIsFloatType ( SkSLType  type)
staticconstexpr

Is the shading language type float (including vectors/matrices)?

Definition at line 67 of file SkSLTypeShared.h.

67 {
68 switch (type) {
76 case SkSLType::kHalf:
83 return true;
84
85 case SkSLType::kVoid:
89 case SkSLType::kBool:
101 case SkSLType::kInt:
102 case SkSLType::kInt2:
103 case SkSLType::kInt3:
104 case SkSLType::kInt4:
105 case SkSLType::kUInt:
106 case SkSLType::kUInt2:
107 case SkSLType::kUInt3:
108 case SkSLType::kUInt4:
111 case SkSLType::kInput:
112 return false;
113 }
115}

◆ SkSLTypeIsFullPrecisionNumericType()

bool SkSLTypeIsFullPrecisionNumericType ( SkSLType  type)

Is the shading language type full precision?

Definition at line 58 of file SkSLTypeShared.cpp.

58 {
59 switch (type) {
60 // Half-precision types:
69 case SkSLType::kHalf:
76 // Non-numeric types:
77 case SkSLType::kVoid:
84 case SkSLType::kBool:
88 return false;
89
90 // Full-precision numeric types:
91 case SkSLType::kInt:
92 case SkSLType::kInt2:
93 case SkSLType::kInt3:
94 case SkSLType::kInt4:
95 case SkSLType::kUInt:
106 return true;
107 }
109}

◆ SkSLTypeIsIntegralType()

static constexpr bool SkSLTypeIsIntegralType ( SkSLType  type)
staticconstexpr

Is the shading language type integral (including vectors)?

Definition at line 118 of file SkSLTypeShared.h.

118 {
119 switch (type) {
120 case SkSLType::kShort:
128 case SkSLType::kInt:
129 case SkSLType::kInt2:
130 case SkSLType::kInt3:
131 case SkSLType::kInt4:
132 case SkSLType::kUInt:
133 case SkSLType::kUInt2:
134 case SkSLType::kUInt3:
135 case SkSLType::kUInt4:
136 return true;
137
138 case SkSLType::kFloat:
145 case SkSLType::kHalf:
146 case SkSLType::kHalf2:
147 case SkSLType::kHalf3:
148 case SkSLType::kHalf4:
152 case SkSLType::kVoid:
156 case SkSLType::kBool:
157 case SkSLType::kBool2:
158 case SkSLType::kBool3:
159 case SkSLType::kBool4:
162 case SkSLType::kInput:
163 return false;
164 }
166}

◆ SkSLTypeMatrixSize()

int SkSLTypeMatrixSize ( SkSLType  type)

If the type represents a square matrix, return its size; otherwise, -1.

Definition at line 111 of file SkSLTypeShared.cpp.

111 {
112 switch (type) {
115 return 2;
116
119 return 3;
120
123 return 4;
124
125 case SkSLType::kFloat:
126 case SkSLType::kHalf:
127 case SkSLType::kBool:
128 case SkSLType::kShort:
130 case SkSLType::kInt:
131 case SkSLType::kUInt:
133 case SkSLType::kHalf2:
134 case SkSLType::kBool2:
137 case SkSLType::kInt2:
138 case SkSLType::kUInt2:
140 case SkSLType::kHalf3:
141 case SkSLType::kBool3:
144 case SkSLType::kInt3:
145 case SkSLType::kUInt3:
147 case SkSLType::kHalf4:
148 case SkSLType::kBool4:
151 case SkSLType::kInt4:
152 case SkSLType::kUInt4:
153 case SkSLType::kVoid:
159 case SkSLType::kInput:
160 return -1;
161 }
163}

◆ SkSLTypeString()

const char * SkSLTypeString ( SkSLType  t)

Returns the SkSL typename for this type.

Definition at line 10 of file SkSLTypeShared.cpp.

10 {
11 switch (t) {
12 case SkSLType::kVoid: return "void";
13 case SkSLType::kBool: return "bool";
14 case SkSLType::kBool2: return "bool2";
15 case SkSLType::kBool3: return "bool3";
16 case SkSLType::kBool4: return "bool4";
17 case SkSLType::kShort: return "short";
18 case SkSLType::kShort2: return "short2";
19 case SkSLType::kShort3: return "short3";
20 case SkSLType::kShort4: return "short4";
21 case SkSLType::kUShort: return "ushort";
22 case SkSLType::kUShort2: return "ushort2";
23 case SkSLType::kUShort3: return "ushort3";
24 case SkSLType::kUShort4: return "ushort4";
25 case SkSLType::kFloat: return "float";
26 case SkSLType::kFloat2: return "float2";
27 case SkSLType::kFloat3: return "float3";
28 case SkSLType::kFloat4: return "float4";
29 case SkSLType::kFloat2x2: return "float2x2";
30 case SkSLType::kFloat3x3: return "float3x3";
31 case SkSLType::kFloat4x4: return "float4x4";
32 case SkSLType::kHalf: return "half";
33 case SkSLType::kHalf2: return "half2";
34 case SkSLType::kHalf3: return "half3";
35 case SkSLType::kHalf4: return "half4";
36 case SkSLType::kHalf2x2: return "half2x2";
37 case SkSLType::kHalf3x3: return "half3x3";
38 case SkSLType::kHalf4x4: return "half4x4";
39 case SkSLType::kInt: return "int";
40 case SkSLType::kInt2: return "int2";
41 case SkSLType::kInt3: return "int3";
42 case SkSLType::kInt4: return "int4";
43 case SkSLType::kUInt: return "uint";
44 case SkSLType::kUInt2: return "uint2";
45 case SkSLType::kUInt3: return "uint3";
46 case SkSLType::kUInt4: return "uint4";
47 case SkSLType::kTexture2DSampler: return "sampler2D";
48 case SkSLType::kTextureExternalSampler: return "samplerExternalOES";
49 case SkSLType::kTexture2DRectSampler: return "sampler2DRect";
50 case SkSLType::kTexture2D: return "texture2D";
51 case SkSLType::kSampler: return "sampler";
52 case SkSLType::kInput: return "subpassInput";
53 }
55}

◆ SkSLTypeVecLength()

static constexpr int SkSLTypeVecLength ( SkSLType  type)
staticconstexpr

If the type represents a single value or vector return the vector length; otherwise, -1.

Definition at line 169 of file SkSLTypeShared.h.

169 {
170 switch (type) {
171 case SkSLType::kFloat:
172 case SkSLType::kHalf:
173 case SkSLType::kBool:
174 case SkSLType::kShort:
176 case SkSLType::kInt:
177 case SkSLType::kUInt:
178 return 1;
179
181 case SkSLType::kHalf2:
182 case SkSLType::kBool2:
185 case SkSLType::kInt2:
186 case SkSLType::kUInt2:
187 return 2;
188
190 case SkSLType::kHalf3:
191 case SkSLType::kBool3:
194 case SkSLType::kInt3:
195 case SkSLType::kUInt3:
196 return 3;
197
199 case SkSLType::kHalf4:
200 case SkSLType::kBool4:
203 case SkSLType::kInt4:
204 case SkSLType::kUInt4:
205 return 4;
206
213 case SkSLType::kVoid:
219 case SkSLType::kInput:
220 return -1;
221 }
223}

Variable Documentation

◆ kSkSLTypeCount

const int kSkSLTypeCount = static_cast<int>(SkSLType::kLast) + 1
static

Definition at line 61 of file SkSLTypeShared.h.