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_LAST
86 };
87
88 const char* getShaderTypeName (ShaderType shaderType);
89 std::string getShaderTypePostfix (ShaderType shaderType);
90
91 // Precision
92
93 enum Precision
94 {
95 PRECISION_LOWP = 0,
96 PRECISION_MEDIUMP,
97 PRECISION_HIGHP,
98
99 PRECISION_LAST
100 };
101
102 const char* getPrecisionName (Precision precision);
103 std::string getPrecisionPostfix (Precision precision);
104
105 // DataType
106
107 enum DataType
108 {
109 TYPE_INVALID = 0,
110
111 TYPE_FLOAT,
112 TYPE_FLOAT_VEC2,
113 TYPE_FLOAT_VEC3,
114 TYPE_FLOAT_VEC4,
115 TYPE_FLOAT_MAT2,
116 TYPE_FLOAT_MAT2X3,
117 TYPE_FLOAT_MAT2X4,
118 TYPE_FLOAT_MAT3X2,
119 TYPE_FLOAT_MAT3,
120 TYPE_FLOAT_MAT3X4,
121 TYPE_FLOAT_MAT4X2,
122 TYPE_FLOAT_MAT4X3,
123 TYPE_FLOAT_MAT4,
124
125 TYPE_DOUBLE,
126 TYPE_DOUBLE_VEC2,
127 TYPE_DOUBLE_VEC3,
128 TYPE_DOUBLE_VEC4,
129 TYPE_DOUBLE_MAT2,
130 TYPE_DOUBLE_MAT2X3,
131 TYPE_DOUBLE_MAT2X4,
132 TYPE_DOUBLE_MAT3X2,
133 TYPE_DOUBLE_MAT3,
134 TYPE_DOUBLE_MAT3X4,
135 TYPE_DOUBLE_MAT4X2,
136 TYPE_DOUBLE_MAT4X3,
137 TYPE_DOUBLE_MAT4,
138
139 TYPE_INT,
140 TYPE_INT_VEC2,
141 TYPE_INT_VEC3,
142 TYPE_INT_VEC4,
143
144 TYPE_UINT,
145 TYPE_UINT_VEC2,
146 TYPE_UINT_VEC3,
147 TYPE_UINT_VEC4,
148
149 TYPE_BOOL,
150 TYPE_BOOL_VEC2,
151 TYPE_BOOL_VEC3,
152 TYPE_BOOL_VEC4,
153
154 TYPE_SAMPLER_1D,
155 TYPE_SAMPLER_2D,
156 TYPE_SAMPLER_CUBE,
157 TYPE_SAMPLER_1D_ARRAY,
158 TYPE_SAMPLER_2D_ARRAY,
159 TYPE_SAMPLER_3D,
160 TYPE_SAMPLER_CUBE_ARRAY,
161
162 TYPE_SAMPLER_1D_SHADOW,
163 TYPE_SAMPLER_2D_SHADOW,
164 TYPE_SAMPLER_CUBE_SHADOW,
165 TYPE_SAMPLER_1D_ARRAY_SHADOW,
166 TYPE_SAMPLER_2D_ARRAY_SHADOW,
167 TYPE_SAMPLER_CUBE_ARRAY_SHADOW,
168
169 TYPE_INT_SAMPLER_1D,
170 TYPE_INT_SAMPLER_2D,
171 TYPE_INT_SAMPLER_CUBE,
172 TYPE_INT_SAMPLER_1D_ARRAY,
173 TYPE_INT_SAMPLER_2D_ARRAY,
174 TYPE_INT_SAMPLER_3D,
175 TYPE_INT_SAMPLER_CUBE_ARRAY,
176
177 TYPE_UINT_SAMPLER_1D,
178 TYPE_UINT_SAMPLER_2D,
179 TYPE_UINT_SAMPLER_CUBE,
180 TYPE_UINT_SAMPLER_1D_ARRAY,
181 TYPE_UINT_SAMPLER_2D_ARRAY,
182 TYPE_UINT_SAMPLER_3D,
183 TYPE_UINT_SAMPLER_CUBE_ARRAY,
184
185 TYPE_SAMPLER_2D_MULTISAMPLE,
186 TYPE_INT_SAMPLER_2D_MULTISAMPLE,
187 TYPE_UINT_SAMPLER_2D_MULTISAMPLE,
188
189 TYPE_IMAGE_2D,
190 TYPE_IMAGE_CUBE,
191 TYPE_IMAGE_2D_ARRAY,
192 TYPE_IMAGE_3D,
193 TYPE_IMAGE_CUBE_ARRAY,
194
195 TYPE_INT_IMAGE_2D,
196 TYPE_INT_IMAGE_CUBE,
197 TYPE_INT_IMAGE_2D_ARRAY,
198 TYPE_INT_IMAGE_3D,
199 TYPE_INT_IMAGE_CUBE_ARRAY,
200
201 TYPE_UINT_IMAGE_2D,
202 TYPE_UINT_IMAGE_CUBE,
203 TYPE_UINT_IMAGE_2D_ARRAY,
204 TYPE_UINT_IMAGE_3D,
205 TYPE_UINT_IMAGE_CUBE_ARRAY,
206
207 TYPE_UINT_ATOMIC_COUNTER,
208
209 TYPE_SAMPLER_BUFFER,
210 TYPE_INT_SAMPLER_BUFFER,
211 TYPE_UINT_SAMPLER_BUFFER,
212
213 TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY,
214 TYPE_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,
215 TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY,
216
217 TYPE_IMAGE_BUFFER,
218 TYPE_INT_IMAGE_BUFFER,
219 TYPE_UINT_IMAGE_BUFFER,
220
221 TYPE_UINT8,
222 TYPE_UINT8_VEC2,
223 TYPE_UINT8_VEC3,
224 TYPE_UINT8_VEC4,
225
226 TYPE_INT8,
227 TYPE_INT8_VEC2,
228 TYPE_INT8_VEC3,
229 TYPE_INT8_VEC4,
230
231 TYPE_UINT16,
232 TYPE_UINT16_VEC2,
233 TYPE_UINT16_VEC3,
234 TYPE_UINT16_VEC4,
235
236 TYPE_INT16,
237 TYPE_INT16_VEC2,
238 TYPE_INT16_VEC3,
239 TYPE_INT16_VEC4,
240
241 TYPE_FLOAT16,
242 TYPE_FLOAT16_VEC2,
243 TYPE_FLOAT16_VEC3,
244 TYPE_FLOAT16_VEC4,
245 TYPE_FLOAT16_MAT2,
246 TYPE_FLOAT16_MAT2X3,
247 TYPE_FLOAT16_MAT2X4,
248 TYPE_FLOAT16_MAT3X2,
249 TYPE_FLOAT16_MAT3,
250 TYPE_FLOAT16_MAT3X4,
251 TYPE_FLOAT16_MAT4X2,
252 TYPE_FLOAT16_MAT4X3,
253 TYPE_FLOAT16_MAT4,
254
255 TYPE_LAST
256 };
257
258 const char* getDataTypeName (DataType dataType);
259 int getDataTypeScalarSize (DataType dataType);
260 DataType getDataTypeScalarType (DataType dataType);
261 DataType getDataTypeFloat16Scalars (DataType dataType);
262 DataType getDataTypeFloatScalars (DataType dataType);
263 DataType getDataTypeDoubleScalars (DataType dataType);
264 DataType getDataTypeVector (DataType scalarType, int size);
265 DataType getDataTypeFloatVec (int vecSize);
266 DataType getDataTypeIntVec (int vecSize);
267 DataType getDataTypeUintVec (int vecSize);
268 DataType getDataTypeBoolVec (int vecSize);
269 DataType getDataTypeMatrix (int numCols, int numRows);
270 DataType getDataTypeFromGLType (deUint32 glType);
271
isDataTypeFloat16OrVec(DataType dataType)272 inline bool isDataTypeFloat16OrVec (DataType dataType) { return (dataType >= TYPE_FLOAT16) && (dataType <= TYPE_FLOAT16_MAT4); }
isDataTypeFloatOrVec(DataType dataType)273 inline bool isDataTypeFloatOrVec (DataType dataType) { return (dataType >= TYPE_FLOAT) && (dataType <= TYPE_FLOAT_VEC4); }
isDataTypeFloatType(DataType dataType)274 inline bool isDataTypeFloatType (DataType dataType) { return (dataType >= TYPE_FLOAT) && (dataType <= TYPE_FLOAT_MAT4); }
isDataTypeDoubleType(DataType dataType)275 inline bool isDataTypeDoubleType (DataType dataType) { return (dataType >= TYPE_DOUBLE) && (dataType <= TYPE_DOUBLE_MAT4); }
isDataTypeDoubleOrDVec(DataType dataType)276 inline bool isDataTypeDoubleOrDVec (DataType dataType) { return (dataType >= TYPE_DOUBLE) && (dataType <= TYPE_DOUBLE_VEC4); }
isDataTypeMatrix(DataType dataType)277 inline bool isDataTypeMatrix (DataType dataType) {
278 return ((dataType >= TYPE_FLOAT_MAT2) && (dataType <= TYPE_FLOAT_MAT4))
279 || ((dataType >= TYPE_DOUBLE_MAT2) && (dataType <= TYPE_DOUBLE_MAT4))
280 || ((dataType >= TYPE_FLOAT16_MAT2) && (dataType <= TYPE_FLOAT16_MAT4))
281 ;
282 }
isDataTypeIntOrIVec(DataType dataType)283 inline bool isDataTypeIntOrIVec (DataType dataType) { return (dataType >= TYPE_INT) && (dataType <= TYPE_INT_VEC4); }
isDataTypeUintOrUVec(DataType dataType)284 inline bool isDataTypeUintOrUVec (DataType dataType) { return (dataType >= TYPE_UINT) && (dataType <= TYPE_UINT_VEC4); }
isDataTypeIntOrIVec8Bit(DataType dataType)285 inline bool isDataTypeIntOrIVec8Bit (DataType dataType) { return (dataType >= TYPE_INT8) && (dataType <= TYPE_INT8_VEC4); }
isDataTypeUintOrUVec8Bit(DataType dataType)286 inline bool isDataTypeUintOrUVec8Bit (DataType dataType) { return (dataType >= TYPE_UINT8) && (dataType <= TYPE_UINT8_VEC4); }
isDataTypeIntOrIVec16Bit(DataType dataType)287 inline bool isDataTypeIntOrIVec16Bit (DataType dataType) { return (dataType >= TYPE_INT16) && (dataType <= TYPE_INT16_VEC4); }
isDataTypeUintOrUVec16Bit(DataType dataType)288 inline bool isDataTypeUintOrUVec16Bit (DataType dataType) { return (dataType >= TYPE_UINT16) && (dataType <= TYPE_UINT16_VEC4); }
isDataTypeBoolOrBVec(DataType dataType)289 inline bool isDataTypeBoolOrBVec (DataType dataType) { return (dataType >= TYPE_BOOL) && (dataType <= TYPE_BOOL_VEC4); }
isDataTypeScalar(DataType dataType)290 inline bool isDataTypeScalar (DataType dataType) {
291 return (dataType == TYPE_FLOAT)
292 || (dataType == TYPE_DOUBLE)
293 || (dataType == TYPE_INT)
294 || (dataType == TYPE_UINT)
295 || (dataType == TYPE_BOOL)
296 || (dataType == TYPE_UINT8)
297 || (dataType == TYPE_INT8)
298 || (dataType == TYPE_UINT16)
299 || (dataType == TYPE_INT16)
300 || (dataType == TYPE_FLOAT16)
301 ;
302 }
isDataTypeVector(DataType dataType)303 inline bool isDataTypeVector (DataType dataType) {
304 return deInRange32(dataType, TYPE_FLOAT_VEC2, TYPE_FLOAT_VEC4)
305 || deInRange32(dataType, TYPE_DOUBLE_VEC2, TYPE_DOUBLE_VEC4)
306 || deInRange32(dataType, TYPE_INT_VEC2, TYPE_INT_VEC4)
307 || deInRange32(dataType, TYPE_UINT_VEC2, TYPE_UINT_VEC4)
308 || deInRange32(dataType, TYPE_BOOL_VEC2, TYPE_BOOL_VEC4)
309 || deInRange32(dataType, TYPE_UINT8_VEC2, TYPE_UINT8_VEC4)
310 || deInRange32(dataType, TYPE_INT8_VEC2, TYPE_INT8_VEC4)
311 || deInRange32(dataType, TYPE_UINT16_VEC2, TYPE_UINT16_VEC4)
312 || deInRange32(dataType, TYPE_INT16_VEC2, TYPE_INT16_VEC4)
313 || deInRange32(dataType, TYPE_FLOAT16_VEC2, TYPE_FLOAT16_VEC4)
314 ;
315 }
isDataTypeScalarOrVector(DataType dataType)316 inline bool isDataTypeScalarOrVector (DataType dataType) {
317 return deInRange32(dataType, TYPE_FLOAT, TYPE_FLOAT_VEC4)
318 || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_VEC4)
319 || deInRange32(dataType, TYPE_INT, TYPE_INT_VEC4)
320 || deInRange32(dataType, TYPE_UINT, TYPE_UINT_VEC4)
321 || deInRange32(dataType, TYPE_BOOL, TYPE_BOOL_VEC4)
322 || deInRange32(dataType, TYPE_UINT8, TYPE_UINT8_VEC4)
323 || deInRange32(dataType, TYPE_INT8, TYPE_INT8_VEC4)
324 || deInRange32(dataType, TYPE_UINT16, TYPE_UINT16_VEC4)
325 || deInRange32(dataType, TYPE_INT16, TYPE_INT16_VEC4)
326 || deInRange32(dataType, TYPE_FLOAT16, TYPE_FLOAT16_VEC4)
327 ;
328 }
isDataTypeSampler(DataType dataType)329 inline bool isDataTypeSampler (DataType dataType) { return (dataType >= TYPE_SAMPLER_1D) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
isDataTypeImage(DataType dataType)330 inline bool isDataTypeImage (DataType dataType) { return (dataType >= TYPE_IMAGE_2D) && (dataType <= TYPE_UINT_IMAGE_3D); }
isDataTypeSamplerMultisample(DataType dataType)331 inline bool isDataTypeSamplerMultisample (DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
isDataTypeAtomicCounter(DataType dataType)332 inline bool isDataTypeAtomicCounter (DataType dataType) { return dataType == TYPE_UINT_ATOMIC_COUNTER; }
isDataTypeSamplerBuffer(DataType dataType)333 inline bool isDataTypeSamplerBuffer (DataType dataType) { return (dataType >= TYPE_SAMPLER_BUFFER) && (dataType <= TYPE_UINT_SAMPLER_BUFFER); }
isDataTypeSamplerMSArray(DataType dataType)334 inline bool isDataTypeSamplerMSArray (DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY); }
isDataTypeImageBuffer(DataType dataType)335 inline bool isDataTypeImageBuffer (DataType dataType) { return (dataType >= TYPE_IMAGE_BUFFER) && (dataType <= TYPE_UINT_IMAGE_BUFFER); }
isDataTypeExplicitPrecision(DataType dataType)336 inline bool isDataTypeExplicitPrecision (DataType dataType) {
337 return deInRange32(dataType, TYPE_UINT8, TYPE_UINT8_VEC4)
338 || deInRange32(dataType, TYPE_INT8, TYPE_INT8_VEC4)
339 || deInRange32(dataType, TYPE_UINT16, TYPE_UINT16_VEC4)
340 || deInRange32(dataType, TYPE_INT16, TYPE_INT16_VEC4)
341 || deInRange32(dataType, TYPE_FLOAT16, TYPE_FLOAT16_MAT4)
342 || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_MAT4)
343 ;
344 }
dataTypeSupportsPrecisionModifier(DataType dataType)345 inline bool dataTypeSupportsPrecisionModifier (DataType dataType) { return !isDataTypeBoolOrBVec(dataType) && !isDataTypeExplicitPrecision(dataType); }
346
347 int getDataTypeMatrixNumRows (DataType dataType);
348 int getDataTypeMatrixNumColumns (DataType dataType);
349 DataType getDataTypeMatrixColumnType (DataType dataType);
350
351 int getDataTypeNumLocations (DataType dataType);
352 int getDataTypeNumComponents (DataType dataType);
353
354 template <typename T>
355 struct DataTypeTraits;
356
357 template <> struct DataTypeTraits<deUint16> { enum { DATATYPE = TYPE_FLOAT16 }; };
358 template <> struct DataTypeTraits<float> { enum { DATATYPE = TYPE_FLOAT }; };
359 template <> struct DataTypeTraits<double> { enum { DATATYPE = TYPE_DOUBLE }; };
360 template <> struct DataTypeTraits<bool> { enum { DATATYPE = TYPE_BOOL }; };
361 template <> struct DataTypeTraits<int> { enum { DATATYPE = TYPE_INT }; };
362 template <> struct DataTypeTraits<deUint32> { enum { DATATYPE = TYPE_UINT }; };
363 template <> struct DataTypeTraits<tcu::Mat2> { enum { DATATYPE = TYPE_FLOAT_MAT2 }; };
364 template <> struct DataTypeTraits<tcu::Mat2x3> { enum { DATATYPE = TYPE_FLOAT_MAT2X3 }; };
365 template <> struct DataTypeTraits<tcu::Mat2x4> { enum { DATATYPE = TYPE_FLOAT_MAT2X4 }; };
366 template <> struct DataTypeTraits<tcu::Mat3x2> { enum { DATATYPE = TYPE_FLOAT_MAT3X2 }; };
367 template <> struct DataTypeTraits<tcu::Mat3> { enum { DATATYPE = TYPE_FLOAT_MAT3 }; };
368 template <> struct DataTypeTraits<tcu::Mat3x4> { enum { DATATYPE = TYPE_FLOAT_MAT3X4 }; };
369 template <> struct DataTypeTraits<tcu::Mat4x2> { enum { DATATYPE = TYPE_FLOAT_MAT4X2 }; };
370 template <> struct DataTypeTraits<tcu::Mat4x3> { enum { DATATYPE = TYPE_FLOAT_MAT4X3 }; };
371 template <> struct DataTypeTraits<tcu::Mat4> { enum { DATATYPE = TYPE_FLOAT_MAT4 }; };
372 template <> struct DataTypeTraits<tcu::Mat2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2 }; };
373 template <> struct DataTypeTraits<tcu::Mat2x3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2X3 }; };
374 template <> struct DataTypeTraits<tcu::Mat2x4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT2X4 }; };
375 template <> struct DataTypeTraits<tcu::Mat3x2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3X2 }; };
376 template <> struct DataTypeTraits<tcu::Mat3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3 }; };
377 template <> struct DataTypeTraits<tcu::Mat3x4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT3X4 }; };
378 template <> struct DataTypeTraits<tcu::Mat4x2_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4X2 }; };
379 template <> struct DataTypeTraits<tcu::Mat4x3_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4X3 }; };
380 template <> struct DataTypeTraits<tcu::Mat4_16b> { enum { DATATYPE = TYPE_FLOAT16_MAT4 }; };
381 template <> struct DataTypeTraits<tcu::Matrix2d> { enum { DATATYPE = TYPE_DOUBLE_MAT2 }; };
382 template <> struct DataTypeTraits<tcu::Matrix3d> { enum { DATATYPE = TYPE_DOUBLE_MAT3 }; };
383 template <> struct DataTypeTraits<tcu::Matrix4d> { enum { DATATYPE = TYPE_DOUBLE_MAT4 }; };
384 template <> struct DataTypeTraits<tcu::Mat2x3d> { enum { DATATYPE = TYPE_DOUBLE_MAT2X3 }; };
385 template <> struct DataTypeTraits<tcu::Mat2x4d> { enum { DATATYPE = TYPE_DOUBLE_MAT2X4 }; };
386 template <> struct DataTypeTraits<tcu::Mat3x2d> { enum { DATATYPE = TYPE_DOUBLE_MAT3X2 }; };
387 template <> struct DataTypeTraits<tcu::Mat3x4d> { enum { DATATYPE = TYPE_DOUBLE_MAT3X4 }; };
388 template <> struct DataTypeTraits<tcu::Mat4x2d> { enum { DATATYPE = TYPE_DOUBLE_MAT4X2 }; };
389 template <> struct DataTypeTraits<tcu::Mat4x3d> { enum { DATATYPE = TYPE_DOUBLE_MAT4X3 }; };
390
391 template <typename T, int Size>
392 struct DataTypeTraits<tcu::Vector<T, Size> >
393 {
394 DE_STATIC_ASSERT(TYPE_FLOAT_VEC4 == TYPE_FLOAT + 3);
395 DE_STATIC_ASSERT(TYPE_INT_VEC4 == TYPE_INT + 3);
396 DE_STATIC_ASSERT(TYPE_UINT_VEC4 == TYPE_UINT + 3);
397 DE_STATIC_ASSERT(TYPE_BOOL_VEC4 == TYPE_BOOL + 3);
398 DE_STATIC_ASSERT(TYPE_DOUBLE_VEC4 == TYPE_DOUBLE + 3);
399 enum { DATATYPE = DataTypeTraits<T>::DATATYPE + Size - 1 };
400 };
401
402 template <typename T>
dataTypeOf(void)403 inline DataType dataTypeOf (void) { return DataType(DataTypeTraits<T>::DATATYPE); }
404
405 } // glu
406
407 #endif // _GLUSHADERUTIL_HPP
408