1 #ifndef _GLUSHADERUTIL_HPP
2 #define _GLUSHADERUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES Utilities
5 * ------------------------------------------------
6 *
7 * Copyright 2014 The Android Open Source Project
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \file
23 * \brief Shader utilities.
24 *//*--------------------------------------------------------------------*/
25
26 #include "tcuDefs.hpp"
27 #include "deInt32.h"
28 #include "gluRenderContext.hpp"
29 #include "tcuVector.hpp"
30 #include "tcuVector.hpp"
31 #include "tcuMatrix.hpp"
32
33 namespace glu
34 {
35
36 // ShadingLanguageVersion
37
38 enum GLSLVersion
39 {
40 GLSL_VERSION_100_ES = 0, //!< GLSL ES 1.0
41 GLSL_VERSION_300_ES, //!< GLSL ES 3.0
42 GLSL_VERSION_310_ES, //!< GLSL ES 3.1
43 GLSL_VERSION_320_ES, //!< GLSL ES 3.2
44
45 GLSL_VERSION_130, //!< GLSL 1.3
46 GLSL_VERSION_140, //!< GLSL 1.4
47 GLSL_VERSION_150, //!< GLSL 1.5
48 GLSL_VERSION_330, //!< GLSL 3.0
49 GLSL_VERSION_400, //!< GLSL 4.0
50 GLSL_VERSION_410, //!< GLSL 4.1
51 GLSL_VERSION_420, //!< GLSL 4.2
52 GLSL_VERSION_430, //!< GLSL 4.3
53 GLSL_VERSION_440, //!< GLSL 4.4
54 GLSL_VERSION_450, //!< GLSL 4.5
55 GLSL_VERSION_460, //!< GLSL 4.6
56
57 GLSL_VERSION_LAST
58 };
59
60 const char* getGLSLVersionName (GLSLVersion version);
61 const char* getGLSLVersionDeclaration (GLSLVersion version);
62 bool glslVersionUsesInOutQualifiers (GLSLVersion version);
63 bool glslVersionIsES (GLSLVersion version);
64 bool isGLSLVersionSupported (ContextType type, GLSLVersion version);
65 GLSLVersion getContextTypeGLSLVersion (ContextType type);
66
67 // ShaderType
68
69 enum ShaderType
70 {
71 SHADERTYPE_VERTEX = 0,
72 SHADERTYPE_FRAGMENT,
73 SHADERTYPE_GEOMETRY,
74 SHADERTYPE_TESSELLATION_CONTROL,
75 SHADERTYPE_TESSELLATION_EVALUATION,
76 SHADERTYPE_COMPUTE,
77
78 SHADERTYPE_RAYGEN,
79 SHADERTYPE_ANY_HIT,
80 SHADERTYPE_CLOSEST_HIT,
81 SHADERTYPE_MISS,
82 SHADERTYPE_INTERSECTION,
83 SHADERTYPE_CALLABLE,
84
85 SHADERTYPE_TASK,
86 SHADERTYPE_MESH,
87
88 SHADERTYPE_LAST
89 };
90
91 const char* getShaderTypeName (ShaderType shaderType);
92 std::string getShaderTypePostfix (ShaderType shaderType);
93
94 // Precision
95
96 enum Precision
97 {
98 PRECISION_LOWP = 0,
99 PRECISION_MEDIUMP,
100 PRECISION_HIGHP,
101
102 PRECISION_LAST
103 };
104
105 const char* getPrecisionName (Precision precision);
106 std::string getPrecisionPostfix (Precision precision);
107
108 // DataType
109
110 enum DataType
111 {
112 TYPE_INVALID = 0,
113
114 TYPE_FLOAT,
115 TYPE_FLOAT_VEC2,
116 TYPE_FLOAT_VEC3,
117 TYPE_FLOAT_VEC4,
118 TYPE_FLOAT_MAT2,
119 TYPE_FLOAT_MAT2X3,
120 TYPE_FLOAT_MAT2X4,
121 TYPE_FLOAT_MAT3X2,
122 TYPE_FLOAT_MAT3,
123 TYPE_FLOAT_MAT3X4,
124 TYPE_FLOAT_MAT4X2,
125 TYPE_FLOAT_MAT4X3,
126 TYPE_FLOAT_MAT4,
127
128 TYPE_DOUBLE,
129 TYPE_DOUBLE_VEC2,
130 TYPE_DOUBLE_VEC3,
131 TYPE_DOUBLE_VEC4,
132 TYPE_DOUBLE_MAT2,
133 TYPE_DOUBLE_MAT2X3,
134 TYPE_DOUBLE_MAT2X4,
135 TYPE_DOUBLE_MAT3X2,
136 TYPE_DOUBLE_MAT3,
137 TYPE_DOUBLE_MAT3X4,
138 TYPE_DOUBLE_MAT4X2,
139 TYPE_DOUBLE_MAT4X3,
140 TYPE_DOUBLE_MAT4,
141
142 TYPE_INT,
143 TYPE_INT_VEC2,
144 TYPE_INT_VEC3,
145 TYPE_INT_VEC4,
146
147 TYPE_UINT,
148 TYPE_UINT_VEC2,
149 TYPE_UINT_VEC3,
150 TYPE_UINT_VEC4,
151
152 TYPE_BOOL,
153 TYPE_BOOL_VEC2,
154 TYPE_BOOL_VEC3,
155 TYPE_BOOL_VEC4,
156
157 TYPE_SAMPLER_1D,
158 TYPE_SAMPLER_2D,
159 TYPE_SAMPLER_CUBE,
160 TYPE_SAMPLER_1D_ARRAY,
161 TYPE_SAMPLER_2D_ARRAY,
162 TYPE_SAMPLER_3D,
163 TYPE_SAMPLER_CUBE_ARRAY,
164
165 TYPE_SAMPLER_1D_SHADOW,
166 TYPE_SAMPLER_2D_SHADOW,
167 TYPE_SAMPLER_CUBE_SHADOW,
168 TYPE_SAMPLER_1D_ARRAY_SHADOW,
169 TYPE_SAMPLER_2D_ARRAY_SHADOW,
170 TYPE_SAMPLER_CUBE_ARRAY_SHADOW,
171
172 TYPE_INT_SAMPLER_1D,
173 TYPE_INT_SAMPLER_2D,
174 TYPE_INT_SAMPLER_CUBE,
175 TYPE_INT_SAMPLER_1D_ARRAY,
176 TYPE_INT_SAMPLER_2D_ARRAY,
177 TYPE_INT_SAMPLER_3D,
178 TYPE_INT_SAMPLER_CUBE_ARRAY,
179
180 TYPE_UINT_SAMPLER_1D,
181 TYPE_UINT_SAMPLER_2D,
182 TYPE_UINT_SAMPLER_CUBE,
183 TYPE_UINT_SAMPLER_1D_ARRAY,
184 TYPE_UINT_SAMPLER_2D_ARRAY,
185 TYPE_UINT_SAMPLER_3D,
186 TYPE_UINT_SAMPLER_CUBE_ARRAY,
187
188 TYPE_SAMPLER_2D_MULTISAMPLE,
189 TYPE_INT_SAMPLER_2D_MULTISAMPLE,
190 TYPE_UINT_SAMPLER_2D_MULTISAMPLE,
191
192 TYPE_IMAGE_2D,
193 TYPE_IMAGE_CUBE,
194 TYPE_IMAGE_2D_ARRAY,
195 TYPE_IMAGE_3D,
196 TYPE_IMAGE_CUBE_ARRAY,
197
198 TYPE_INT_IMAGE_2D,
199 TYPE_INT_IMAGE_CUBE,
200 TYPE_INT_IMAGE_2D_ARRAY,
201 TYPE_INT_IMAGE_3D,
202 TYPE_INT_IMAGE_CUBE_ARRAY,
203
204 TYPE_UINT_IMAGE_2D,
205 TYPE_UINT_IMAGE_CUBE,
206 TYPE_UINT_IMAGE_2D_ARRAY,
207 TYPE_UINT_IMAGE_3D,
208 TYPE_UINT_IMAGE_CUBE_ARRAY,
209
210 TYPE_UINT_ATOMIC_COUNTER,
211
212 TYPE_SAMPLER_BUFFER,
213 TYPE_INT_SAMPLER_BUFFER,
214 TYPE_UINT_SAMPLER_BUFFER,
215
216 TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY,
217 TYPE_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
218 TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY,
219
220 TYPE_IMAGE_BUFFER,
221 TYPE_INT_IMAGE_BUFFER,
222 TYPE_UINT_IMAGE_BUFFER,
223
224 TYPE_UINT8,
225 TYPE_UINT8_VEC2,
226 TYPE_UINT8_VEC3,
227 TYPE_UINT8_VEC4,
228
229 TYPE_INT8,
230 TYPE_INT8_VEC2,
231 TYPE_INT8_VEC3,
232 TYPE_INT8_VEC4,
233
234 TYPE_UINT16,
235 TYPE_UINT16_VEC2,
236 TYPE_UINT16_VEC3,
237 TYPE_UINT16_VEC4,
238
239 TYPE_INT16,
240 TYPE_INT16_VEC2,
241 TYPE_INT16_VEC3,
242 TYPE_INT16_VEC4,
243
244 TYPE_FLOAT16,
245 TYPE_FLOAT16_VEC2,
246 TYPE_FLOAT16_VEC3,
247 TYPE_FLOAT16_VEC4,
248 TYPE_FLOAT16_MAT2,
249 TYPE_FLOAT16_MAT2X3,
250 TYPE_FLOAT16_MAT2X4,
251 TYPE_FLOAT16_MAT3X2,
252 TYPE_FLOAT16_MAT3,
253 TYPE_FLOAT16_MAT3X4,
254 TYPE_FLOAT16_MAT4X2,
255 TYPE_FLOAT16_MAT4X3,
256 TYPE_FLOAT16_MAT4,
257
258 TYPE_LAST
259 };
260
261 const char* getDataTypeName (DataType dataType);
262 int getDataTypeScalarSize (DataType dataType);
263 DataType getDataTypeScalarType (DataType dataType);
264 DataType getDataTypeFloat16Scalars (DataType dataType);
265 DataType getDataTypeFloatScalars (DataType dataType);
266 DataType getDataTypeDoubleScalars (DataType dataType);
267 DataType getDataTypeVector (DataType scalarType, int size);
268 DataType getDataTypeFloatVec (int vecSize);
269 DataType getDataTypeIntVec (int vecSize);
270 DataType getDataTypeUintVec (int vecSize);
271 DataType getDataTypeBoolVec (int vecSize);
272 DataType getDataTypeMatrix (int numCols, int numRows);
273 DataType getDataTypeFromGLType (deUint32 glType);
274
isDataTypeFloat16OrVec(DataType dataType)275 inline bool isDataTypeFloat16OrVec (DataType dataType) { return (dataType >= TYPE_FLOAT16) && (dataType <= TYPE_FLOAT16_MAT4); }
isDataTypeFloatOrVec(DataType dataType)276 inline bool isDataTypeFloatOrVec (DataType dataType) { return (dataType >= TYPE_FLOAT) && (dataType <= TYPE_FLOAT_VEC4); }
isDataTypeFloatType(DataType dataType)277 inline bool isDataTypeFloatType (DataType dataType) { return (dataType >= TYPE_FLOAT) && (dataType <= TYPE_FLOAT_MAT4); }
isDataTypeDoubleType(DataType dataType)278 inline bool isDataTypeDoubleType (DataType dataType) { return (dataType >= TYPE_DOUBLE) && (dataType <= TYPE_DOUBLE_MAT4); }
isDataTypeDoubleOrDVec(DataType dataType)279 inline bool isDataTypeDoubleOrDVec (DataType dataType) { return (dataType >= TYPE_DOUBLE) && (dataType <= TYPE_DOUBLE_VEC4); }
isDataTypeMatrix(DataType dataType)280 inline bool isDataTypeMatrix (DataType dataType) {
281 return ((dataType >= TYPE_FLOAT_MAT2) && (dataType <= TYPE_FLOAT_MAT4))
282 || ((dataType >= TYPE_DOUBLE_MAT2) && (dataType <= TYPE_DOUBLE_MAT4))
283 || ((dataType >= TYPE_FLOAT16_MAT2) && (dataType <= TYPE_FLOAT16_MAT4))
284 ;
285 }
isDataTypeIntOrIVec(DataType dataType)286 inline bool isDataTypeIntOrIVec (DataType dataType) { return (dataType >= TYPE_INT) && (dataType <= TYPE_INT_VEC4); }
isDataTypeUintOrUVec(DataType dataType)287 inline bool isDataTypeUintOrUVec (DataType dataType) { return (dataType >= TYPE_UINT) && (dataType <= TYPE_UINT_VEC4); }
isDataTypeIntOrIVec8Bit(DataType dataType)288 inline bool isDataTypeIntOrIVec8Bit (DataType dataType) { return (dataType >= TYPE_INT8) && (dataType <= TYPE_INT8_VEC4); }
isDataTypeUintOrUVec8Bit(DataType dataType)289 inline bool isDataTypeUintOrUVec8Bit (DataType dataType) { return (dataType >= TYPE_UINT8) && (dataType <= TYPE_UINT8_VEC4); }
isDataTypeIntOrIVec16Bit(DataType dataType)290 inline bool isDataTypeIntOrIVec16Bit (DataType dataType) { return (dataType >= TYPE_INT16) && (dataType <= TYPE_INT16_VEC4); }
isDataTypeUintOrUVec16Bit(DataType dataType)291 inline bool isDataTypeUintOrUVec16Bit (DataType dataType) { return (dataType >= TYPE_UINT16) && (dataType <= TYPE_UINT16_VEC4); }
isDataTypeBoolOrBVec(DataType dataType)292 inline bool isDataTypeBoolOrBVec (DataType dataType) { return (dataType >= TYPE_BOOL) && (dataType <= TYPE_BOOL_VEC4); }
isDataTypeScalar(DataType dataType)293 inline bool isDataTypeScalar (DataType dataType) {
294 return (dataType == TYPE_FLOAT)
295 || (dataType == TYPE_DOUBLE)
296 || (dataType == TYPE_INT)
297 || (dataType == TYPE_UINT)
298 || (dataType == TYPE_BOOL)
299 || (dataType == TYPE_UINT8)
300 || (dataType == TYPE_INT8)
301 || (dataType == TYPE_UINT16)
302 || (dataType == TYPE_INT16)
303 || (dataType == TYPE_FLOAT16)
304 ;
305 }
isDataTypeVector(DataType dataType)306 inline bool isDataTypeVector (DataType dataType) {
307 return deInRange32(dataType, TYPE_FLOAT_VEC2, TYPE_FLOAT_VEC4)
308 || deInRange32(dataType, TYPE_DOUBLE_VEC2, TYPE_DOUBLE_VEC4)
309 || deInRange32(dataType, TYPE_INT_VEC2, TYPE_INT_VEC4)
310 || deInRange32(dataType, TYPE_UINT_VEC2, TYPE_UINT_VEC4)
311 || deInRange32(dataType, TYPE_BOOL_VEC2, TYPE_BOOL_VEC4)
312 || deInRange32(dataType, TYPE_UINT8_VEC2, TYPE_UINT8_VEC4)
313 || deInRange32(dataType, TYPE_INT8_VEC2, TYPE_INT8_VEC4)
314 || deInRange32(dataType, TYPE_UINT16_VEC2, TYPE_UINT16_VEC4)
315 || deInRange32(dataType, TYPE_INT16_VEC2, TYPE_INT16_VEC4)
316 || deInRange32(dataType, TYPE_FLOAT16_VEC2, TYPE_FLOAT16_VEC4)
317 ;
318 }
isDataTypeScalarOrVector(DataType dataType)319 inline bool isDataTypeScalarOrVector (DataType dataType) {
320 return deInRange32(dataType, TYPE_FLOAT, TYPE_FLOAT_VEC4)
321 || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_VEC4)
322 || deInRange32(dataType, TYPE_INT, TYPE_INT_VEC4)
323 || deInRange32(dataType, TYPE_UINT, TYPE_UINT_VEC4)
324 || deInRange32(dataType, TYPE_BOOL, TYPE_BOOL_VEC4)
325 || deInRange32(dataType, TYPE_UINT8, TYPE_UINT8_VEC4)
326 || deInRange32(dataType, TYPE_INT8, TYPE_INT8_VEC4)
327 || deInRange32(dataType, TYPE_UINT16, TYPE_UINT16_VEC4)
328 || deInRange32(dataType, TYPE_INT16, TYPE_INT16_VEC4)
329 || deInRange32(dataType, TYPE_FLOAT16, TYPE_FLOAT16_VEC4)
330 ;
331 }
isDataTypeSampler(DataType dataType)332 inline bool isDataTypeSampler (DataType dataType) { return (dataType >= TYPE_SAMPLER_1D) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
isDataTypeImage(DataType dataType)333 inline bool isDataTypeImage (DataType dataType) { return (dataType >= TYPE_IMAGE_2D) && (dataType <= TYPE_UINT_IMAGE_3D); }
isDataTypeSamplerMultisample(DataType dataType)334 inline bool isDataTypeSamplerMultisample (DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
isDataTypeAtomicCounter(DataType dataType)335 inline bool isDataTypeAtomicCounter (DataType dataType) { return dataType == TYPE_UINT_ATOMIC_COUNTER; }
isDataTypeSamplerBuffer(DataType dataType)336 inline bool isDataTypeSamplerBuffer (DataType dataType) { return (dataType >= TYPE_SAMPLER_BUFFER) && (dataType <= TYPE_UINT_SAMPLER_BUFFER); }
isDataTypeSamplerMSArray(DataType dataType)337 inline bool isDataTypeSamplerMSArray (DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY); }
isDataTypeImageBuffer(DataType dataType)338 inline bool isDataTypeImageBuffer (DataType dataType) { return (dataType >= TYPE_IMAGE_BUFFER) && (dataType <= TYPE_UINT_IMAGE_BUFFER); }
isDataTypeExplicitPrecision(DataType dataType)339 inline bool isDataTypeExplicitPrecision (DataType dataType) {
340 return deInRange32(dataType, TYPE_UINT8, TYPE_UINT8_VEC4)
341 || deInRange32(dataType, TYPE_INT8, TYPE_INT8_VEC4)
342 || deInRange32(dataType, TYPE_UINT16, TYPE_UINT16_VEC4)
343 || deInRange32(dataType, TYPE_INT16, TYPE_INT16_VEC4)
344 || deInRange32(dataType, TYPE_FLOAT16, TYPE_FLOAT16_MAT4)
345 || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_MAT4)
346 ;
347 }
dataTypeSupportsPrecisionModifier(DataType dataType)348 inline bool dataTypeSupportsPrecisionModifier (DataType dataType) { return !isDataTypeBoolOrBVec(dataType) && !isDataTypeExplicitPrecision(dataType); }
349
350 int getDataTypeMatrixNumRows (DataType dataType);
351 int getDataTypeMatrixNumColumns (DataType dataType);
352 DataType getDataTypeMatrixColumnType (DataType dataType);
353
354 int getDataTypeNumLocations (DataType dataType);
355 int getDataTypeNumComponents (DataType dataType);
356
357 template <typename T>
358 struct DataTypeTraits;
359
360 template <> struct DataTypeTraits<deUint16> { enum { DATATYPE = TYPE_FLOAT16 }; };
361 template <> struct DataTypeTraits<float> { enum { DATATYPE = TYPE_FLOAT }; };
362 template <> struct DataTypeTraits<double> { enum { DATATYPE = TYPE_DOUBLE }; };
363 template <> struct DataTypeTraits<bool> { enum { DATATYPE = TYPE_BOOL }; };
364 template <> struct DataTypeTraits<int> { enum { DATATYPE = TYPE_INT }; };
365 template <> struct DataTypeTraits<deUint32> { enum { DATATYPE = TYPE_UINT }; };
366 template <> struct DataTypeTraits<tcu::Mat2> { enum { DATATYPE = TYPE_FLOAT_MAT2 }; };
367 template <> struct DataTypeTraits<tcu::Mat2x3> { enum { DATATYPE = TYPE_FLOAT_MAT2X3 }; };
368 template <> struct DataTypeTraits<tcu::Mat2x4> { enum { DATATYPE = TYPE_FLOAT_MAT2X4 }; };
369 template <> struct DataTypeTraits<tcu::Mat3x2> { enum { DATATYPE = TYPE_FLOAT_MAT3X2 }; };
370 template <> struct DataTypeTraits<tcu::Mat3> { enum { DATATYPE = TYPE_FLOAT_MAT3 }; };
371 template <> struct DataTypeTraits<tcu::Mat3x4> { enum { DATATYPE = TYPE_FLOAT_MAT3X4 }; };
372 template <> struct DataTypeTraits<tcu::Mat4x2> { enum { DATATYPE = TYPE_FLOAT_MAT4X2 }; };
373 template <> struct DataTypeTraits<tcu::Mat4x3> { enum { DATATYPE = TYPE_FLOAT_MAT4X3 }; };
374 template <> struct DataTypeTraits<tcu::Mat4> { enum { DATATYPE = TYPE_FLOAT_MAT4 }; };
375 template <> struct DataTypeTraits<tcu::Mat2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2 }; };
376 template <> struct DataTypeTraits<tcu::Mat2x3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2X3 }; };
377 template <> struct DataTypeTraits<tcu::Mat2x4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2X4 }; };
378 template <> struct DataTypeTraits<tcu::Mat3x2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3X2 }; };
379 template <> struct DataTypeTraits<tcu::Mat3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3 }; };
380 template <> struct DataTypeTraits<tcu::Mat3x4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3X4 }; };
381 template <> struct DataTypeTraits<tcu::Mat4x2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4X2 }; };
382 template <> struct DataTypeTraits<tcu::Mat4x3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4X3 }; };
383 template <> struct DataTypeTraits<tcu::Mat4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4 }; };
384 template <> struct DataTypeTraits<tcu::Matrix2d> { enum { DATATYPE = TYPE_DOUBLE_MAT2 }; };
385 template <> struct DataTypeTraits<tcu::Matrix3d> { enum { DATATYPE = TYPE_DOUBLE_MAT3 }; };
386 template <> struct DataTypeTraits<tcu::Matrix4d> { enum { DATATYPE = TYPE_DOUBLE_MAT4 }; };
387 template <> struct DataTypeTraits<tcu::Mat2x3d> { enum { DATATYPE = TYPE_DOUBLE_MAT2X3 }; };
388 template <> struct DataTypeTraits<tcu::Mat2x4d> { enum { DATATYPE = TYPE_DOUBLE_MAT2X4 }; };
389 template <> struct DataTypeTraits<tcu::Mat3x2d> { enum { DATATYPE = TYPE_DOUBLE_MAT3X2 }; };
390 template <> struct DataTypeTraits<tcu::Mat3x4d> { enum { DATATYPE = TYPE_DOUBLE_MAT3X4 }; };
391 template <> struct DataTypeTraits<tcu::Mat4x2d> { enum { DATATYPE = TYPE_DOUBLE_MAT4X2 }; };
392 template <> struct DataTypeTraits<tcu::Mat4x3d> { enum { DATATYPE = TYPE_DOUBLE_MAT4X3 }; };
393
394 template <typename T, int Size>
395 struct DataTypeTraits<tcu::Vector<T, Size> >
396 {
397 DE_STATIC_ASSERT(TYPE_FLOAT_VEC4 == TYPE_FLOAT + 3);
398 DE_STATIC_ASSERT(TYPE_INT_VEC4 == TYPE_INT + 3);
399 DE_STATIC_ASSERT(TYPE_UINT_VEC4 == TYPE_UINT + 3);
400 DE_STATIC_ASSERT(TYPE_BOOL_VEC4 == TYPE_BOOL + 3);
401 DE_STATIC_ASSERT(TYPE_DOUBLE_VEC4 == TYPE_DOUBLE + 3);
402 enum { DATATYPE = DataTypeTraits<T>::DATATYPE + Size - 1 };
403 };
404
405 template <typename T>
dataTypeOf(void)406 inline DataType dataTypeOf (void) { return DataType(DataTypeTraits<T>::DATATYPE); }
407
408 } // glu
409
410 #endif // _GLUSHADERUTIL_HPP
411