Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkSLTypeShared.cpp File Reference
#include "src/core/SkSLTypeShared.h"

Go to the source code of this file.

Functions

const char * SkSLTypeString (SkSLType t)
 
bool SkSLTypeIsFullPrecisionNumericType (SkSLType type)
 
int SkSLTypeMatrixSize (SkSLType type)
 
bool SkSLTypeIsCombinedSamplerType (SkSLType type)
 

Function Documentation

◆ 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
@ kTextureExternalSampler
@ kTexture2DSampler
@ kTexture2DRectSampler

◆ 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}

◆ 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}