blob: b132cec33d11d56179d2444f5adb2bc89d014436 [file] [log] [blame]
ethannicholasd598f792016-07-25 10:08:54 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
Ethan Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasd598f792016-07-25 10:08:54 -07008#ifndef SKSL_CONTEXT
9#define SKSL_CONTEXT
10
11#include "ir/SkSLType.h"
ethannicholas22f939e2016-10-13 13:25:34 -070012#include "ir/SkSLExpression.h"
ethannicholasd598f792016-07-25 10:08:54 -070013
14namespace SkSL {
15
16/**
17 * Contains compiler-wide objects, which currently means the core types.
18 */
19class Context {
20public:
21 Context()
Ethan Nicholas0df1b042017-03-31 13:56:23 -040022 : fInvalid_Type(new Type(String("<INVALID>")))
23 , fVoid_Type(new Type(String("void")))
Ethan Nicholas93061b52017-08-01 13:41:59 -040024 , fDouble_Type(new Type(String("double"), Type::kFloat_NumberKind))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040025 , fDouble2_Type(new Type(String("double2"), *fDouble_Type, 2))
26 , fDouble3_Type(new Type(String("double3"), *fDouble_Type, 3))
27 , fDouble4_Type(new Type(String("double4"), *fDouble_Type, 4))
Ethan Nicholas93061b52017-08-01 13:41:59 -040028 , fFloat_Type(new Type(String("float"), Type::kFloat_NumberKind))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040029 , fFloat2_Type(new Type(String("float2"), *fFloat_Type, 2))
30 , fFloat3_Type(new Type(String("float3"), *fFloat_Type, 3))
31 , fFloat4_Type(new Type(String("float4"), *fFloat_Type, 4))
Ethan Nicholas93061b52017-08-01 13:41:59 -040032 , fHalf_Type(new Type(String("half"), Type::kFloat_NumberKind))
33 , fHalf2_Type(new Type(String("half2"), *fHalf_Type, 2))
34 , fHalf3_Type(new Type(String("half3"), *fHalf_Type, 3))
35 , fHalf4_Type(new Type(String("half4"), *fHalf_Type, 4))
36 , fUInt_Type(new Type(String("uint"), Type::kUnsigned_NumberKind))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040037 , fUInt2_Type(new Type(String("uint2"), *fUInt_Type, 2))
38 , fUInt3_Type(new Type(String("uint3"), *fUInt_Type, 3))
39 , fUInt4_Type(new Type(String("uint4"), *fUInt_Type, 4))
Ethan Nicholas93061b52017-08-01 13:41:59 -040040 , fInt_Type(new Type(String("int"), Type::kSigned_NumberKind))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040041 , fInt2_Type(new Type(String("int2"), *fInt_Type, 2))
42 , fInt3_Type(new Type(String("int3"), *fInt_Type, 3))
43 , fInt4_Type(new Type(String("int4"), *fInt_Type, 4))
Ethan Nicholas93061b52017-08-01 13:41:59 -040044 , fUShort_Type(new Type(String("ushort"), Type::kUnsigned_NumberKind))
45 , fUShort2_Type(new Type(String("ushort2"), *fUShort_Type, 2))
46 , fUShort3_Type(new Type(String("ushort3"), *fUShort_Type, 3))
47 , fUShort4_Type(new Type(String("ushort4"), *fUShort_Type, 4))
48 , fShort_Type(new Type(String("short"), Type::kSigned_NumberKind))
49 , fShort2_Type(new Type(String("short2"), *fShort_Type, 2))
50 , fShort3_Type(new Type(String("short3"), *fShort_Type, 3))
51 , fShort4_Type(new Type(String("short4"), *fShort_Type, 4))
52 , fBool_Type(new Type(String("bool"), Type::kNonnumeric_NumberKind))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040053 , fBool2_Type(new Type(String("bool2"), *fBool_Type, 2))
54 , fBool3_Type(new Type(String("bool3"), *fBool_Type, 3))
55 , fBool4_Type(new Type(String("bool4"), *fBool_Type, 4))
Ethan Nicholas93061b52017-08-01 13:41:59 -040056 , fFloat2x2_Type(new Type(String("float2x2"), *fFloat_Type, 2, 2))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040057 , fFloat2x3_Type(new Type(String("float2x3"), *fFloat_Type, 2, 3))
58 , fFloat2x4_Type(new Type(String("float2x4"), *fFloat_Type, 2, 4))
59 , fFloat3x2_Type(new Type(String("float3x2"), *fFloat_Type, 3, 2))
Ethan Nicholas93061b52017-08-01 13:41:59 -040060 , fFloat3x3_Type(new Type(String("float3x3"), *fFloat_Type, 3, 3))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -040061 , fFloat3x4_Type(new Type(String("float3x4"), *fFloat_Type, 3, 4))
62 , fFloat4x2_Type(new Type(String("float4x2"), *fFloat_Type, 4, 2))
63 , fFloat4x3_Type(new Type(String("float4x3"), *fFloat_Type, 4, 3))
Ethan Nicholas93061b52017-08-01 13:41:59 -040064 , fFloat4x4_Type(new Type(String("float4x4"), *fFloat_Type, 4, 4))
65 , fHalf2x2_Type(new Type(String("half2x2"), *fHalf_Type, 2, 2))
66 , fHalf2x3_Type(new Type(String("half2x3"), *fHalf_Type, 2, 3))
67 , fHalf2x4_Type(new Type(String("half2x4"), *fHalf_Type, 2, 4))
68 , fHalf3x2_Type(new Type(String("half3x2"), *fHalf_Type, 3, 2))
69 , fHalf3x3_Type(new Type(String("half3x3"), *fHalf_Type, 3, 3))
70 , fHalf3x4_Type(new Type(String("half3x4"), *fHalf_Type, 3, 4))
71 , fHalf4x2_Type(new Type(String("half4x2"), *fHalf_Type, 4, 2))
72 , fHalf4x3_Type(new Type(String("half4x3"), *fHalf_Type, 4, 3))
73 , fHalf4x4_Type(new Type(String("half4x4"), *fHalf_Type, 4, 4))
74 , fDouble2x2_Type(new Type(String("double2x2"), *fDouble_Type, 2, 2))
75 , fDouble2x3_Type(new Type(String("double2x3"), *fDouble_Type, 2, 3))
76 , fDouble2x4_Type(new Type(String("double2x4"), *fDouble_Type, 2, 4))
77 , fDouble3x2_Type(new Type(String("double3x2"), *fDouble_Type, 3, 2))
78 , fDouble3x3_Type(new Type(String("double3x3"), *fDouble_Type, 3, 3))
79 , fDouble3x4_Type(new Type(String("double3x4"), *fDouble_Type, 3, 4))
80 , fDouble4x2_Type(new Type(String("double4x2"), *fDouble_Type, 4, 2))
81 , fDouble4x3_Type(new Type(String("double4x3"), *fDouble_Type, 4, 3))
82 , fDouble4x4_Type(new Type(String("double4x4"), *fDouble_Type, 4, 4))
Ethan Nicholas0df1b042017-03-31 13:56:23 -040083 , fSampler1D_Type(new Type(String("sampler1D"), SpvDim1D, false, false, false, true))
84 , fSampler2D_Type(new Type(String("sampler2D"), SpvDim2D, false, false, false, true))
85 , fSampler3D_Type(new Type(String("sampler3D"), SpvDim3D, false, false, false, true))
86 , fSamplerExternalOES_Type(new Type(String("samplerExternalOES"), SpvDim2D, false, false,
Ethan Nicholas9e1138d2016-11-21 10:39:35 -050087 false, true))
Ethan Nicholas0df1b042017-03-31 13:56:23 -040088 , fSamplerCube_Type(new Type(String("samplerCube"), SpvDimCube, false, false, false, true))
Ethan Nicholas762466e2017-06-29 10:03:38 -040089 , fSampler2DRect_Type(new Type(String("sampler2DRect"), SpvDimRect, false, false, false, true))
Ethan Nicholas0df1b042017-03-31 13:56:23 -040090 , fSampler1DArray_Type(new Type(String("sampler1DArray")))
91 , fSampler2DArray_Type(new Type(String("sampler2DArray")))
92 , fSamplerCubeArray_Type(new Type(String("samplerCubeArray")))
Ethan Nicholas0187ae62017-05-03 11:03:44 -040093 , fSamplerBuffer_Type(new Type(String("samplerBuffer"), SpvDimBuffer, false, false, false,
94 true))
Ethan Nicholas0df1b042017-03-31 13:56:23 -040095 , fSampler2DMS_Type(new Type(String("sampler2DMS")))
96 , fSampler2DMSArray_Type(new Type(String("sampler2DMSArray")))
97 , fSampler1DShadow_Type(new Type(String("sampler1DShadow")))
98 , fSampler2DShadow_Type(new Type(String("sampler2DShadow")))
99 , fSamplerCubeShadow_Type(new Type(String("samplerCubeShadow")))
100 , fSampler2DRectShadow_Type(new Type(String("sampler2DRectShadow")))
101 , fSampler1DArrayShadow_Type(new Type(String("sampler1DArrayShadow")))
102 , fSampler2DArrayShadow_Type(new Type(String("sampler2DArrayShadow")))
103 , fSamplerCubeArrayShadow_Type(new Type(String("samplerCubeArrayShadow")))
Brian Salomon2a51de82016-11-16 12:06:01 -0500104
Brian Salomonbf7b6202016-11-11 16:08:03 -0500105 // Related to below FIXME, gsampler*s don't currently expand to cover integer case.
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400106 , fISampler2D_Type(new Type(String("isampler2D"), SpvDim2D, false, false, false, true))
Brian Salomon2a51de82016-11-16 12:06:01 -0500107
108 // FIXME express these as "gimage2D" that expand to image2D, iimage2D, and uimage2D.
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400109 , fImage2D_Type(new Type(String("image2D"), SpvDim2D, false, false, false, true))
110 , fIImage2D_Type(new Type(String("iimage2D"), SpvDim2D, false, false, false, true))
Brian Salomon2a51de82016-11-16 12:06:01 -0500111
Greg Daniel64773e62016-11-22 09:44:03 -0500112 // FIXME express these as "gsubpassInput" that expand to subpassInput, isubpassInput,
113 // and usubpassInput.
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400114 , fSubpassInput_Type(new Type(String("subpassInput"), SpvDimSubpassData, false, false,
Greg Daniel64773e62016-11-22 09:44:03 -0500115 false, false))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400116 , fSubpassInputMS_Type(new Type(String("subpassInputMS"), SpvDimSubpassData, false, false,
Greg Daniel64773e62016-11-22 09:44:03 -0500117 true, false))
118
ethannicholasd598f792016-07-25 10:08:54 -0700119 // FIXME figure out what we're supposed to do with the gsampler et al. types)
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400120 , fGSampler1D_Type(new Type(String("$gsampler1D"), static_type(*fSampler1D_Type)))
121 , fGSampler2D_Type(new Type(String("$gsampler2D"), static_type(*fSampler2D_Type)))
122 , fGSampler3D_Type(new Type(String("$gsampler3D"), static_type(*fSampler3D_Type)))
123 , fGSamplerCube_Type(new Type(String("$gsamplerCube"), static_type(*fSamplerCube_Type)))
124 , fGSampler2DRect_Type(new Type(String("$gsampler2DRect"), static_type(*fSampler2DRect_Type)))
125 , fGSampler1DArray_Type(new Type(String("$gsampler1DArray"),
Ethan Nicholas9e1138d2016-11-21 10:39:35 -0500126 static_type(*fSampler1DArray_Type)))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400127 , fGSampler2DArray_Type(new Type(String("$gsampler2DArray"),
Ethan Nicholas9e1138d2016-11-21 10:39:35 -0500128 static_type(*fSampler2DArray_Type)))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400129 , fGSamplerCubeArray_Type(new Type(String("$gsamplerCubeArray"),
Ethan Nicholas9e1138d2016-11-21 10:39:35 -0500130 static_type(*fSamplerCubeArray_Type)))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400131 , fGSamplerBuffer_Type(new Type(String("$gsamplerBuffer"), static_type(*fSamplerBuffer_Type)))
132 , fGSampler2DMS_Type(new Type(String("$gsampler2DMS"), static_type(*fSampler2DMS_Type)))
133 , fGSampler2DMSArray_Type(new Type(String("$gsampler2DMSArray"),
Ethan Nicholas9e1138d2016-11-21 10:39:35 -0500134 static_type(*fSampler2DMSArray_Type)))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400135 , fGSampler2DArrayShadow_Type(new Type(String("$gsampler2DArrayShadow"),
ethannicholasd598f792016-07-25 10:08:54 -0700136 static_type(*fSampler2DArrayShadow_Type)))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400137 , fGSamplerCubeArrayShadow_Type(new Type(String("$gsamplerCubeArrayShadow"),
ethannicholasd598f792016-07-25 10:08:54 -0700138 static_type(*fSamplerCubeArrayShadow_Type)))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400139 , fGenType_Type(new Type(String("$genType"), { fFloat_Type.get(), fFloat2_Type.get(),
140 fFloat3_Type.get(), fFloat4_Type.get() }))
Ethan Nicholas93061b52017-08-01 13:41:59 -0400141 , fGenHType_Type(new Type(String("$genHType"), { fHalf_Type.get(), fHalf2_Type.get(),
142 fHalf3_Type.get(), fHalf4_Type.get() }))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400143 , fGenDType_Type(new Type(String("$genDType"), { fDouble_Type.get(), fDouble2_Type.get(),
144 fDouble3_Type.get(), fDouble4_Type.get() }))
145 , fGenIType_Type(new Type(String("$genIType"), { fInt_Type.get(), fInt2_Type.get(),
146 fInt3_Type.get(), fInt4_Type.get() }))
147 , fGenUType_Type(new Type(String("$genUType"), { fUInt_Type.get(), fUInt2_Type.get(),
148 fUInt3_Type.get(), fUInt4_Type.get() }))
149 , fGenBType_Type(new Type(String("$genBType"), { fBool_Type.get(), fBool2_Type.get(),
150 fBool3_Type.get(), fBool4_Type.get() }))
151 , fMat_Type(new Type(String("$mat"), { fFloat2x2_Type.get(), fFloat2x3_Type.get(),
152 fFloat2x4_Type.get(), fFloat3x2_Type.get(),
153 fFloat3x3_Type.get(), fFloat3x4_Type.get(),
154 fFloat4x2_Type.get(), fFloat4x3_Type.get(),
Ethan Nicholas93061b52017-08-01 13:41:59 -0400155 fFloat4x4_Type.get(), fHalf2x2_Type.get(),
156 fHalf2x3_Type.get(), fHalf2x4_Type.get(),
157 fHalf3x2_Type.get(), fHalf3x3_Type.get(),
158 fHalf3x4_Type.get(), fHalf4x2_Type.get(),
159 fHalf4x3_Type.get(), fHalf4x4_Type.get(),
160 fDouble2x2_Type.get(), fDouble2x3_Type.get(),
161 fDouble2x4_Type.get(), fDouble3x2_Type.get(),
162 fDouble3x3_Type.get(), fDouble3x4_Type.get(),
163 fDouble4x2_Type.get(), fDouble4x3_Type.get(),
164 fDouble4x4_Type.get() }))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400165 , fVec_Type(new Type(String("$vec"), { fInvalid_Type.get(), fFloat2_Type.get(),
166 fFloat3_Type.get(), fFloat4_Type.get() }))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400167 , fGVec_Type(new Type(String("$gvec")))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400168 , fGVec2_Type(new Type(String("$gfloat2")))
169 , fGVec3_Type(new Type(String("$gfloat3")))
170 , fGVec4_Type(new Type(String("$gfloat4"), static_type(*fFloat4_Type)))
Ethan Nicholas93061b52017-08-01 13:41:59 -0400171 , fHVec_Type(new Type(String("$hvec"), { fInvalid_Type.get(), fHalf2_Type.get(),
172 fHalf3_Type.get(), fHalf4_Type.get() }))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400173 , fDVec_Type(new Type(String("$dvec"), { fInvalid_Type.get(), fDouble2_Type.get(),
174 fDouble3_Type.get(), fDouble4_Type.get() }))
175 , fIVec_Type(new Type(String("$ivec"), { fInvalid_Type.get(), fInt2_Type.get(),
176 fInt3_Type.get(), fInt4_Type.get() }))
177 , fUVec_Type(new Type(String("$uvec"), { fInvalid_Type.get(), fUInt2_Type.get(),
178 fUInt3_Type.get(), fUInt4_Type.get() }))
Ethan Nicholas93061b52017-08-01 13:41:59 -0400179 , fSVec_Type(new Type(String("$svec"), { fInvalid_Type.get(), fShort2_Type.get(),
180 fShort3_Type.get(), fShort4_Type.get() }))
181 , fUSVec_Type(new Type(String("$usvec"), { fInvalid_Type.get(), fUShort2_Type.get(),
182 fUShort3_Type.get(), fUShort4_Type.get() }))
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400183 , fBVec_Type(new Type(String("$bvec"), { fInvalid_Type.get(), fBool2_Type.get(),
184 fBool3_Type.get(), fBool4_Type.get() }))
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400185 , fSkCaps_Type(new Type(String("$sk_Caps")))
Ethan Nicholas762466e2017-06-29 10:03:38 -0400186 , fSkArgs_Type(new Type(String("$sk_Args")))
187 , fColorSpaceXform_Type(new Type(String("colorSpaceXform"), *fFloat_Type, 4, 4))
ethannicholas22f939e2016-10-13 13:25:34 -0700188 , fDefined_Expression(new Defined(*fInvalid_Type)) {}
ethannicholasd598f792016-07-25 10:08:54 -0700189
190 static std::vector<const Type*> static_type(const Type& t) {
Greg Daniel64773e62016-11-22 09:44:03 -0500191 return { &t, &t, &t, &t };
ethannicholasd598f792016-07-25 10:08:54 -0700192 }
193
ethannicholas471e8942016-10-28 09:02:46 -0700194 const std::unique_ptr<Type> fInvalid_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700195 const std::unique_ptr<Type> fVoid_Type;
196
197 const std::unique_ptr<Type> fDouble_Type;
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400198 const std::unique_ptr<Type> fDouble2_Type;
199 const std::unique_ptr<Type> fDouble3_Type;
200 const std::unique_ptr<Type> fDouble4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700201
202 const std::unique_ptr<Type> fFloat_Type;
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400203 const std::unique_ptr<Type> fFloat2_Type;
204 const std::unique_ptr<Type> fFloat3_Type;
205 const std::unique_ptr<Type> fFloat4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700206
Ethan Nicholas93061b52017-08-01 13:41:59 -0400207 const std::unique_ptr<Type> fHalf_Type;
208 const std::unique_ptr<Type> fHalf2_Type;
209 const std::unique_ptr<Type> fHalf3_Type;
210 const std::unique_ptr<Type> fHalf4_Type;
211
ethannicholasd598f792016-07-25 10:08:54 -0700212 const std::unique_ptr<Type> fUInt_Type;
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400213 const std::unique_ptr<Type> fUInt2_Type;
214 const std::unique_ptr<Type> fUInt3_Type;
215 const std::unique_ptr<Type> fUInt4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700216
217 const std::unique_ptr<Type> fInt_Type;
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400218 const std::unique_ptr<Type> fInt2_Type;
219 const std::unique_ptr<Type> fInt3_Type;
220 const std::unique_ptr<Type> fInt4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700221
Ethan Nicholas93061b52017-08-01 13:41:59 -0400222 const std::unique_ptr<Type> fUShort_Type;
223 const std::unique_ptr<Type> fUShort2_Type;
224 const std::unique_ptr<Type> fUShort3_Type;
225 const std::unique_ptr<Type> fUShort4_Type;
226
227 const std::unique_ptr<Type> fShort_Type;
228 const std::unique_ptr<Type> fShort2_Type;
229 const std::unique_ptr<Type> fShort3_Type;
230 const std::unique_ptr<Type> fShort4_Type;
231
ethannicholasd598f792016-07-25 10:08:54 -0700232 const std::unique_ptr<Type> fBool_Type;
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400233 const std::unique_ptr<Type> fBool2_Type;
234 const std::unique_ptr<Type> fBool3_Type;
235 const std::unique_ptr<Type> fBool4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700236
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400237 const std::unique_ptr<Type> fFloat2x2_Type;
238 const std::unique_ptr<Type> fFloat2x3_Type;
239 const std::unique_ptr<Type> fFloat2x4_Type;
240 const std::unique_ptr<Type> fFloat3x2_Type;
241 const std::unique_ptr<Type> fFloat3x3_Type;
242 const std::unique_ptr<Type> fFloat3x4_Type;
243 const std::unique_ptr<Type> fFloat4x2_Type;
244 const std::unique_ptr<Type> fFloat4x3_Type;
245 const std::unique_ptr<Type> fFloat4x4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700246
Ethan Nicholas93061b52017-08-01 13:41:59 -0400247 const std::unique_ptr<Type> fHalf2x2_Type;
248 const std::unique_ptr<Type> fHalf2x3_Type;
249 const std::unique_ptr<Type> fHalf2x4_Type;
250 const std::unique_ptr<Type> fHalf3x2_Type;
251 const std::unique_ptr<Type> fHalf3x3_Type;
252 const std::unique_ptr<Type> fHalf3x4_Type;
253 const std::unique_ptr<Type> fHalf4x2_Type;
254 const std::unique_ptr<Type> fHalf4x3_Type;
255 const std::unique_ptr<Type> fHalf4x4_Type;
256
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400257 const std::unique_ptr<Type> fDouble2x2_Type;
258 const std::unique_ptr<Type> fDouble2x3_Type;
259 const std::unique_ptr<Type> fDouble2x4_Type;
260 const std::unique_ptr<Type> fDouble3x2_Type;
261 const std::unique_ptr<Type> fDouble3x3_Type;
262 const std::unique_ptr<Type> fDouble3x4_Type;
263 const std::unique_ptr<Type> fDouble4x2_Type;
264 const std::unique_ptr<Type> fDouble4x3_Type;
265 const std::unique_ptr<Type> fDouble4x4_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700266
267 const std::unique_ptr<Type> fSampler1D_Type;
268 const std::unique_ptr<Type> fSampler2D_Type;
269 const std::unique_ptr<Type> fSampler3D_Type;
ethannicholas5961bc92016-10-12 06:39:56 -0700270 const std::unique_ptr<Type> fSamplerExternalOES_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700271 const std::unique_ptr<Type> fSamplerCube_Type;
272 const std::unique_ptr<Type> fSampler2DRect_Type;
273 const std::unique_ptr<Type> fSampler1DArray_Type;
274 const std::unique_ptr<Type> fSampler2DArray_Type;
275 const std::unique_ptr<Type> fSamplerCubeArray_Type;
276 const std::unique_ptr<Type> fSamplerBuffer_Type;
277 const std::unique_ptr<Type> fSampler2DMS_Type;
278 const std::unique_ptr<Type> fSampler2DMSArray_Type;
279 const std::unique_ptr<Type> fSampler1DShadow_Type;
280 const std::unique_ptr<Type> fSampler2DShadow_Type;
281 const std::unique_ptr<Type> fSamplerCubeShadow_Type;
282 const std::unique_ptr<Type> fSampler2DRectShadow_Type;
283 const std::unique_ptr<Type> fSampler1DArrayShadow_Type;
284 const std::unique_ptr<Type> fSampler2DArrayShadow_Type;
285 const std::unique_ptr<Type> fSamplerCubeArrayShadow_Type;
286
Brian Salomonbf7b6202016-11-11 16:08:03 -0500287 const std::unique_ptr<Type> fISampler2D_Type;
288
Brian Salomon2a51de82016-11-16 12:06:01 -0500289 const std::unique_ptr<Type> fImage2D_Type;
290 const std::unique_ptr<Type> fIImage2D_Type;
291
Greg Daniel64773e62016-11-22 09:44:03 -0500292 const std::unique_ptr<Type> fSubpassInput_Type;
293 const std::unique_ptr<Type> fSubpassInputMS_Type;
294
ethannicholasd598f792016-07-25 10:08:54 -0700295 const std::unique_ptr<Type> fGSampler1D_Type;
296 const std::unique_ptr<Type> fGSampler2D_Type;
297 const std::unique_ptr<Type> fGSampler3D_Type;
298 const std::unique_ptr<Type> fGSamplerCube_Type;
299 const std::unique_ptr<Type> fGSampler2DRect_Type;
300 const std::unique_ptr<Type> fGSampler1DArray_Type;
301 const std::unique_ptr<Type> fGSampler2DArray_Type;
302 const std::unique_ptr<Type> fGSamplerCubeArray_Type;
303 const std::unique_ptr<Type> fGSamplerBuffer_Type;
304 const std::unique_ptr<Type> fGSampler2DMS_Type;
305 const std::unique_ptr<Type> fGSampler2DMSArray_Type;
306 const std::unique_ptr<Type> fGSampler2DArrayShadow_Type;
307 const std::unique_ptr<Type> fGSamplerCubeArrayShadow_Type;
308
309 const std::unique_ptr<Type> fGenType_Type;
Ethan Nicholas93061b52017-08-01 13:41:59 -0400310 const std::unique_ptr<Type> fGenHType_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700311 const std::unique_ptr<Type> fGenDType_Type;
312 const std::unique_ptr<Type> fGenIType_Type;
313 const std::unique_ptr<Type> fGenUType_Type;
314 const std::unique_ptr<Type> fGenBType_Type;
315
316 const std::unique_ptr<Type> fMat_Type;
317
318 const std::unique_ptr<Type> fVec_Type;
319
320 const std::unique_ptr<Type> fGVec_Type;
321 const std::unique_ptr<Type> fGVec2_Type;
322 const std::unique_ptr<Type> fGVec3_Type;
323 const std::unique_ptr<Type> fGVec4_Type;
Ethan Nicholas93061b52017-08-01 13:41:59 -0400324 const std::unique_ptr<Type> fHVec_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700325 const std::unique_ptr<Type> fDVec_Type;
326 const std::unique_ptr<Type> fIVec_Type;
327 const std::unique_ptr<Type> fUVec_Type;
Ethan Nicholas93061b52017-08-01 13:41:59 -0400328 const std::unique_ptr<Type> fSVec_Type;
329 const std::unique_ptr<Type> fUSVec_Type;
ethannicholasd598f792016-07-25 10:08:54 -0700330
331 const std::unique_ptr<Type> fBVec_Type;
332
Ethan Nicholas3605ace2016-11-21 15:59:48 -0500333 const std::unique_ptr<Type> fSkCaps_Type;
Ethan Nicholas762466e2017-06-29 10:03:38 -0400334 const std::unique_ptr<Type> fSkArgs_Type;
335 const std::unique_ptr<Type> fColorSpaceXform_Type;
Ethan Nicholas3605ace2016-11-21 15:59:48 -0500336
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400337 // dummy expression used to mark that a variable has a value during dataflow analysis (when it
ethannicholas22f939e2016-10-13 13:25:34 -0700338 // could have several different values, or the analyzer is otherwise unable to assign it a
339 // specific expression)
340 const std::unique_ptr<Expression> fDefined_Expression;
341
Ethan Nicholas0df1b042017-03-31 13:56:23 -0400342private:
ethannicholas22f939e2016-10-13 13:25:34 -0700343 class Defined : public Expression {
344 public:
345 Defined(const Type& type)
346 : INHERITED(Position(), kDefined_Kind, type) {}
347
Ethan Nicholascb670962017-04-20 19:31:52 -0400348 bool hasSideEffects() const override {
349 return false;
350 }
ethannicholas22f939e2016-10-13 13:25:34 -0700351
Ethan Nicholas762466e2017-06-29 10:03:38 -0400352 String description() const override {
353 return String("<defined>");
354 }
355
ethannicholas22f939e2016-10-13 13:25:34 -0700356 typedef Expression INHERITED;
357 };
ethannicholasd598f792016-07-25 10:08:54 -0700358};
359
360} // namespace
361
362#endif