1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES Utilities
3 * ------------------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Shader utilities.
22 *//*--------------------------------------------------------------------*/
23
24 #include "gluShaderUtil.hpp"
25 #include "glwEnums.hpp"
26
27 namespace glu
28 {
29
30 // ShadingLanguageVersion
31
getGLSLVersionName(GLSLVersion version)32 const char* getGLSLVersionName (GLSLVersion version)
33 {
34 static const char* s_names[] =
35 {
36 "GLSL ES 1.0",
37 "GLSL ES 3.0",
38 "GLSL ES 3.1",
39 "GLSL 1.3",
40 "GLSL 1.4",
41 "GLSL 1.5",
42 "GLSL 3.3",
43 "GLSL 4.0",
44 "GLSL 4.1",
45 "GLSL 4.2",
46 "GLSL 4.3",
47 "GLSL 4.4",
48 };
49
50 return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_names, version);
51 }
52
getGLSLVersionDeclaration(GLSLVersion version)53 const char* getGLSLVersionDeclaration (GLSLVersion version)
54 {
55 static const char* s_decl[] =
56 {
57 "#version 100",
58 "#version 300 es",
59 "#version 310 es",
60 "#version 130",
61 "#version 140",
62 "#version 150",
63 "#version 330",
64 "#version 400",
65 "#version 410",
66 "#version 420",
67 "#version 430",
68 "#version 440",
69 };
70
71 return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_decl, version);
72 }
73
glslVersionUsesInOutQualifiers(GLSLVersion version)74 bool glslVersionUsesInOutQualifiers (GLSLVersion version)
75 {
76 return de::inRange<int>(version, GLSL_VERSION_300_ES, GLSL_VERSION_310_ES) || de::inRange<int>(version, GLSL_VERSION_330, GLSL_VERSION_430);
77 }
78
glslVersionIsES(GLSLVersion version)79 bool glslVersionIsES (GLSLVersion version)
80 {
81 DE_ASSERT(version != GLSL_VERSION_LAST);
82
83 if (version == GLSL_VERSION_100_ES ||
84 version == GLSL_VERSION_300_ES ||
85 version == GLSL_VERSION_310_ES)
86 return true;
87 else
88 return false;
89 }
90
91 // \todo [2014-10-06 pyry] Export this.
getMinAPIForGLSLVersion(GLSLVersion version)92 static ApiType getMinAPIForGLSLVersion (GLSLVersion version)
93 {
94 static const ApiType s_minApi[] =
95 {
96 ApiType::es(2,0),
97 ApiType::es(3,0),
98 ApiType::es(3,1),
99 ApiType::core(3,0),
100 ApiType::core(3,1),
101 ApiType::core(3,2),
102 ApiType::core(3,3),
103 ApiType::core(4,0),
104 ApiType::core(4,1),
105 ApiType::core(4,2),
106 ApiType::core(4,3),
107 ApiType::core(4,4),
108 };
109
110 return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_minApi, version);
111 }
112
isGLSLVersionSupported(ContextType type,GLSLVersion version)113 bool isGLSLVersionSupported (ContextType type, GLSLVersion version)
114 {
115 return contextSupports(type, getMinAPIForGLSLVersion(version));
116 }
117
getContextTypeGLSLVersion(ContextType type)118 GLSLVersion getContextTypeGLSLVersion (ContextType type)
119 {
120 // \note From newer to older
121 for (int version = GLSL_VERSION_LAST-1; version >= 0; version--)
122 {
123 if (isGLSLVersionSupported(type, GLSLVersion(version)))
124 return GLSLVersion(version);
125 }
126
127 DE_ASSERT(false);
128 return GLSL_VERSION_LAST;
129 }
130
131 // ShaderType
132
getShaderTypeName(ShaderType shaderType)133 const char* getShaderTypeName (ShaderType shaderType)
134 {
135 const char* s_names[] =
136 {
137 "vertex",
138 "fragment",
139 "geometry",
140 "tess_control",
141 "tess_eval",
142 "compute",
143 };
144
145 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == SHADERTYPE_LAST);
146 DE_ASSERT(deInBounds32((int)shaderType, 0, SHADERTYPE_LAST));
147 return s_names[(int)shaderType];
148 }
149
150 // Precision
151
getPrecisionName(Precision precision)152 const char* getPrecisionName (Precision precision)
153 {
154 const char* s_names[] =
155 {
156 "lowp",
157 "mediump",
158 "highp"
159 };
160
161 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == PRECISION_LAST);
162 DE_ASSERT(deInBounds32((int)precision, 0, PRECISION_LAST));
163 return s_names[(int)precision];
164 }
165
166 // DataType
167
getDataTypeName(DataType dataType)168 const char* getDataTypeName (DataType dataType)
169 {
170 const char* s_names[] =
171 {
172 "invalid",
173 "float",
174 "vec2",
175 "vec3",
176 "vec4",
177 "mat2",
178 "mat2x3",
179 "mat2x4",
180 "mat3x2",
181 "mat3",
182 "mat3x4",
183 "mat4x2",
184 "mat4x3",
185 "mat4",
186 "int",
187 "ivec2",
188 "ivec3",
189 "ivec4",
190 "uint",
191 "uvec2",
192 "uvec3",
193 "uvec4",
194 "bool",
195 "bvec2",
196 "bvec3",
197 "bvec4",
198 "sampler1D",
199 "sampler2D",
200 "samplerCube",
201 "sampler2DArray",
202 "sampler3D",
203 "samplerCubeArray",
204 "sampler1DShadow",
205 "sampler2DShadow",
206 "samplerCubeShadow",
207 "sampler2DArrayShadow",
208 "samplerCubeArrayShadow",
209 "isampler1D",
210 "isampler2D",
211 "isamplerCube",
212 "isampler2DArray",
213 "isampler3D",
214 "isamplerCubeArray",
215 "usampler1D",
216 "usampler2D",
217 "usamplerCube",
218 "usampler2DArray",
219 "usampler3D",
220 "usamplerCubeArray",
221 "sampler2DMS",
222 "isampler2DMS",
223 "usampler2DMS",
224 "image2D",
225 "imageCube",
226 "image2DArray",
227 "image3D",
228 "imageCubeArray",
229 "iimage2D",
230 "iimageCube",
231 "iimage2DArray",
232 "iimage3D",
233 "iimageCubeArray",
234 "uimage2D",
235 "uimageCube",
236 "uimage2DArray",
237 "uimage3D",
238 "uimageCubeArray",
239 "atomic_uint",
240 };
241
242 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == TYPE_LAST);
243 DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_names)));
244 return s_names[(int)dataType];
245 }
246
getDataTypeScalarSize(DataType dataType)247 int getDataTypeScalarSize (DataType dataType)
248 {
249 const int s_sizes[] =
250 {
251 -1, // invalid
252 1, // float
253 2, // vec2
254 3, // vec3
255 4, // vec4
256 4, // mat2
257 6, // mat2x3
258 8, // mat2x4
259 6, // mat3x2
260 9, // mat3
261 12, // mat3x4
262 8, // mat4x2
263 12, // mat4x3
264 16, // mat4
265 1, // int
266 2, // ivec2
267 3, // ivec3
268 4, // ivec4
269 1, // uint
270 2, // uvec2
271 3, // uvec3
272 4, // uvec4
273 1, // bool
274 2, // bvec2
275 3, // bvec3
276 4, // bvec4
277 1, // sampler1D
278 1, // sampler2D
279 1, // samplerCube
280 1, // sampler2DArray
281 1, // sampler3D
282 1, // samplerCubeArray
283 1, // sampler1DShadow
284 1, // sampler2DShadow
285 1, // samplerCubeShadow
286 1, // sampler2DArrayShadow
287 1, // samplerCubeArrayShadow
288 1, // isampler1D
289 1, // isampler2D
290 1, // isamplerCube
291 1, // isampler2DArray
292 1, // isampler3D
293 1, // isamplerCubeArray
294 1, // usampler1D
295 1, // usampler2D
296 1, // usamplerCube
297 1, // usampler2DArray
298 1, // usampler3D
299 1, // usamplerCubeArray
300 1, // sampler2DMS
301 1, // isampler2DMS
302 1, // usampler2DMS
303 1, // image2D
304 1, // imageCube
305 1, // image2DArray
306 1, // image3D
307 1, // imageCubeArray
308 1, // iimage2D
309 1, // iimageCube
310 1, // iimage2DArray
311 1, // iimage3D
312 1, // iimageCubeArray
313 1, // uimage2D
314 1, // uimageCube
315 1, // uimage2DArray
316 1, // uimage3D
317 1, // uimageCubeArray
318 1, // atomic_uint
319 };
320
321 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_sizes) == TYPE_LAST);
322 DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_sizes)));
323 return s_sizes[(int)dataType];
324 }
325
getDataTypeScalarType(DataType dataType)326 DataType getDataTypeScalarType (DataType dataType)
327 {
328 const DataType s_scalarTypes[] =
329 {
330 TYPE_INVALID, // invalid
331 TYPE_FLOAT, // float
332 TYPE_FLOAT, // vec2
333 TYPE_FLOAT, // vec3
334 TYPE_FLOAT, // vec4
335 TYPE_FLOAT, // mat2
336 TYPE_FLOAT, // mat2x3
337 TYPE_FLOAT, // mat2x4
338 TYPE_FLOAT, // mat3x2
339 TYPE_FLOAT, // mat3
340 TYPE_FLOAT, // mat3x4
341 TYPE_FLOAT, // mat4x2
342 TYPE_FLOAT, // mat4x3
343 TYPE_FLOAT, // mat4
344 TYPE_INT, // int
345 TYPE_INT, // ivec2
346 TYPE_INT, // ivec3
347 TYPE_INT, // ivec4
348 TYPE_UINT, // uint
349 TYPE_UINT, // uvec2
350 TYPE_UINT, // uvec3
351 TYPE_UINT, // uvec4
352 TYPE_BOOL, // bool
353 TYPE_BOOL, // bvec2
354 TYPE_BOOL, // bvec3
355 TYPE_BOOL, // bvec4
356 TYPE_SAMPLER_1D, // sampler1D
357 TYPE_SAMPLER_2D, // sampler2D
358 TYPE_SAMPLER_CUBE, // samplerCube
359 TYPE_SAMPLER_2D_ARRAY, // sampler2DArray
360 TYPE_SAMPLER_3D, // sampler3D
361 TYPE_SAMPLER_CUBE_ARRAY, // samplerCubeArray
362 TYPE_SAMPLER_1D_SHADOW, // sampler1DShadow
363 TYPE_SAMPLER_2D_SHADOW, // sampler2DShadow
364 TYPE_SAMPLER_CUBE_SHADOW, // samplerCubeShadow
365 TYPE_SAMPLER_2D_ARRAY_SHADOW, // sampler2DArrayShadow
366 TYPE_SAMPLER_CUBE_ARRAY_SHADOW, // samplerCubeArrayShadow
367 TYPE_INT_SAMPLER_1D, // isampler1D
368 TYPE_INT_SAMPLER_2D, // isampler2D
369 TYPE_INT_SAMPLER_CUBE, // isamplerCube
370 TYPE_INT_SAMPLER_2D_ARRAY, // isampler2DArray
371 TYPE_INT_SAMPLER_3D, // isampler3D
372 TYPE_INT_SAMPLER_CUBE_ARRAY, // isamplerCubeArray
373 TYPE_UINT_SAMPLER_1D, // usampler1D
374 TYPE_UINT_SAMPLER_2D, // usampler2D
375 TYPE_UINT_SAMPLER_CUBE, // usamplerCube
376 TYPE_UINT_SAMPLER_2D_ARRAY, // usampler2DArray
377 TYPE_UINT_SAMPLER_3D, // usampler3D
378 TYPE_UINT_SAMPLER_CUBE_ARRAY, // usamplerCubeArray
379 TYPE_SAMPLER_2D_MULTISAMPLE, // sampler2DMS
380 TYPE_INT_SAMPLER_2D_MULTISAMPLE, // isampler2DMS
381 TYPE_UINT_SAMPLER_2D_MULTISAMPLE, // usampler2DMS
382 TYPE_IMAGE_2D, // image2D
383 TYPE_IMAGE_CUBE, // imageCube
384 TYPE_IMAGE_2D_ARRAY, // image2DArray
385 TYPE_IMAGE_3D, // image3D
386 TYPE_IMAGE_CUBE_ARRAY, // imageCubeArray
387 TYPE_INT_IMAGE_2D, // iimage2D
388 TYPE_INT_IMAGE_CUBE, // iimageCube
389 TYPE_INT_IMAGE_2D_ARRAY, // iimage2DArray
390 TYPE_INT_IMAGE_3D, // iimage3D
391 TYPE_INT_IMAGE_CUBE_ARRAY, // iimageCubeArray
392 TYPE_UINT_IMAGE_2D, // uimage2D
393 TYPE_UINT_IMAGE_CUBE, // uimageCube
394 TYPE_UINT_IMAGE_2D_ARRAY, // uimage2DArray
395 TYPE_UINT_IMAGE_3D, // uimage3D
396 TYPE_UINT_IMAGE_CUBE_ARRAY, // uimageCubeArray
397 TYPE_UINT_ATOMIC_COUNTER, // atomic_uint
398 };
399
400 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_scalarTypes) == TYPE_LAST);
401 DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_scalarTypes)));
402 return s_scalarTypes[(int)dataType];
403 }
404
getDataTypeFloatScalars(DataType dataType)405 DataType getDataTypeFloatScalars (DataType dataType)
406 {
407 const DataType s_floatTypes[] =
408 {
409 TYPE_INVALID, // invalid
410 TYPE_FLOAT, // float
411 TYPE_FLOAT_VEC2, // vec2
412 TYPE_FLOAT_VEC3, // vec3
413 TYPE_FLOAT_VEC4, // vec4
414 TYPE_FLOAT_MAT2, // mat2
415 TYPE_FLOAT_MAT2X3, // mat2x3
416 TYPE_FLOAT_MAT2X4, // mat2x4
417 TYPE_FLOAT_MAT3X2, // mat3x2
418 TYPE_FLOAT_MAT3, // mat3
419 TYPE_FLOAT_MAT3X4, // mat3x4
420 TYPE_FLOAT_MAT4X2, // mat4x2
421 TYPE_FLOAT_MAT4X3, // mat4x3
422 TYPE_FLOAT_MAT4, // mat4
423 TYPE_FLOAT, // int
424 TYPE_FLOAT_VEC2, // ivec2
425 TYPE_FLOAT_VEC3, // ivec3
426 TYPE_FLOAT_VEC4, // ivec4
427 TYPE_FLOAT, // uint
428 TYPE_FLOAT_VEC2, // uvec2
429 TYPE_FLOAT_VEC3, // uvec3
430 TYPE_FLOAT_VEC4, // uvec4
431 TYPE_FLOAT, // bool
432 TYPE_FLOAT_VEC2, // bvec2
433 TYPE_FLOAT_VEC3, // bvec3
434 TYPE_FLOAT_VEC4, // bvec4
435 TYPE_INVALID, // sampler1D
436 TYPE_INVALID, // sampler2D
437 TYPE_INVALID, // samplerCube
438 TYPE_INVALID, // sampler2DArray
439 TYPE_INVALID, // sampler3D
440 TYPE_INVALID, // samplerCubeArray
441 TYPE_INVALID, // sampler1DShadow
442 TYPE_INVALID, // sampler2DShadow
443 TYPE_INVALID, // samplerCubeShadow
444 TYPE_INVALID, // sampler2DArrayShadow
445 TYPE_INVALID, // samplerCubeArrayShadow
446 TYPE_INVALID, // isampler1D
447 TYPE_INVALID, // isampler2D
448 TYPE_INVALID, // isamplerCube
449 TYPE_INVALID, // isampler2DArray
450 TYPE_INVALID, // isampler3D
451 TYPE_INVALID, // isamplerCubeArray
452 TYPE_INVALID, // usampler1D
453 TYPE_INVALID, // usampler2D
454 TYPE_INVALID, // usamplerCube
455 TYPE_INVALID, // usampler2DArray
456 TYPE_INVALID, // usampler3D
457 TYPE_INVALID, // usamplerCubeArray
458 TYPE_INVALID, // sampler2DMS
459 TYPE_INVALID, // isampler2DMS
460 TYPE_INVALID, // usampler2DMS
461 TYPE_INVALID, // image2D
462 TYPE_INVALID, // imageCube
463 TYPE_INVALID, // image2DArray
464 TYPE_INVALID, // image3D
465 TYPE_INVALID, // imageCubeArray
466 TYPE_INVALID, // iimage2D
467 TYPE_INVALID, // iimageCube
468 TYPE_INVALID, // iimage2DArray
469 TYPE_INVALID, // iimage3D
470 TYPE_INVALID, // iimageCubeArray
471 TYPE_INVALID, // uimage2D
472 TYPE_INVALID, // uimageCube
473 TYPE_INVALID, // uimage2DArray
474 TYPE_INVALID, // uimage3D
475 TYPE_INVALID, // uimageCubeArray
476 TYPE_INVALID, // atomic_uint
477 };
478
479 DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == TYPE_LAST);
480 DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_floatTypes)));
481 return s_floatTypes[(int)dataType];
482 }
483
getDataTypeVector(DataType scalarType,int size)484 DataType getDataTypeVector (DataType scalarType, int size)
485 {
486 DE_ASSERT(deInRange32(size, 1, 4));
487 switch (scalarType)
488 {
489 case TYPE_FLOAT:
490 case TYPE_INT:
491 case TYPE_UINT:
492 case TYPE_BOOL:
493 return (DataType)((int)scalarType + size - 1);
494 default:
495 return TYPE_INVALID;
496 }
497 }
498
getDataTypeFloatVec(int vecSize)499 DataType getDataTypeFloatVec (int vecSize)
500 {
501 return getDataTypeVector(TYPE_FLOAT, vecSize);
502 }
503
getDataTypeIntVec(int vecSize)504 DataType getDataTypeIntVec (int vecSize)
505 {
506 return getDataTypeVector(TYPE_INT, vecSize);
507 }
508
getDataTypeUintVec(int vecSize)509 DataType getDataTypeUintVec (int vecSize)
510 {
511 return getDataTypeVector(TYPE_UINT, vecSize);
512 }
513
getDataTypeBoolVec(int vecSize)514 DataType getDataTypeBoolVec (int vecSize)
515 {
516 return getDataTypeVector(TYPE_BOOL, vecSize);
517 }
518
getDataTypeMatrix(int numCols,int numRows)519 DataType getDataTypeMatrix (int numCols, int numRows)
520 {
521 DE_ASSERT(de::inRange(numCols, 2, 4) && de::inRange(numRows, 2, 4));
522 return (DataType)((int)TYPE_FLOAT_MAT2 + (numCols-2)*3 + (numRows-2));
523 }
524
getDataTypeMatrixNumRows(DataType dataType)525 int getDataTypeMatrixNumRows (DataType dataType)
526 {
527 switch (dataType)
528 {
529 case TYPE_FLOAT_MAT2: return 2;
530 case TYPE_FLOAT_MAT2X3: return 3;
531 case TYPE_FLOAT_MAT2X4: return 4;
532 case TYPE_FLOAT_MAT3X2: return 2;
533 case TYPE_FLOAT_MAT3: return 3;
534 case TYPE_FLOAT_MAT3X4: return 4;
535 case TYPE_FLOAT_MAT4X2: return 2;
536 case TYPE_FLOAT_MAT4X3: return 3;
537 case TYPE_FLOAT_MAT4: return 4;
538 default:
539 DE_ASSERT(false);
540 return 0;
541 }
542 }
543
getDataTypeMatrixNumColumns(DataType dataType)544 int getDataTypeMatrixNumColumns (DataType dataType)
545 {
546 switch (dataType)
547 {
548 case TYPE_FLOAT_MAT2: return 2;
549 case TYPE_FLOAT_MAT2X3: return 2;
550 case TYPE_FLOAT_MAT2X4: return 2;
551 case TYPE_FLOAT_MAT3X2: return 3;
552 case TYPE_FLOAT_MAT3: return 3;
553 case TYPE_FLOAT_MAT3X4: return 3;
554 case TYPE_FLOAT_MAT4X2: return 4;
555 case TYPE_FLOAT_MAT4X3: return 4;
556 case TYPE_FLOAT_MAT4: return 4;
557 default:
558 DE_ASSERT(false);
559 return 0;
560 }
561 }
562
getDataTypeNumLocations(DataType dataType)563 int getDataTypeNumLocations (DataType dataType)
564 {
565 if (isDataTypeScalarOrVector(dataType))
566 return 1;
567 else if (isDataTypeMatrix(dataType))
568 return getDataTypeMatrixNumColumns(dataType);
569
570 DE_ASSERT(!"Illegal datatype.");
571 return 0;
572 }
573
getDataTypeNumComponents(DataType dataType)574 int getDataTypeNumComponents (DataType dataType)
575 {
576 if (isDataTypeScalarOrVector(dataType))
577 return getDataTypeScalarSize(dataType);
578 else if (isDataTypeMatrix(dataType))
579 return getDataTypeMatrixNumRows(dataType);
580
581 DE_ASSERT(!"Illegal datatype.");
582 return 0;
583 }
584
getDataTypeFromGLType(deUint32 glType)585 DataType getDataTypeFromGLType (deUint32 glType)
586 {
587 switch (glType)
588 {
589 case GL_FLOAT: return TYPE_FLOAT;
590 case GL_FLOAT_VEC2: return TYPE_FLOAT_VEC2;
591 case GL_FLOAT_VEC3: return TYPE_FLOAT_VEC3;
592 case GL_FLOAT_VEC4: return TYPE_FLOAT_VEC4;
593
594 case GL_FLOAT_MAT2: return TYPE_FLOAT_MAT2;
595 case GL_FLOAT_MAT2x3: return TYPE_FLOAT_MAT2X3;
596 case GL_FLOAT_MAT2x4: return TYPE_FLOAT_MAT2X4;
597
598 case GL_FLOAT_MAT3x2: return TYPE_FLOAT_MAT3X2;
599 case GL_FLOAT_MAT3: return TYPE_FLOAT_MAT3;
600 case GL_FLOAT_MAT3x4: return TYPE_FLOAT_MAT3X4;
601
602 case GL_FLOAT_MAT4x2: return TYPE_FLOAT_MAT4X2;
603 case GL_FLOAT_MAT4x3: return TYPE_FLOAT_MAT4X3;
604 case GL_FLOAT_MAT4: return TYPE_FLOAT_MAT4;
605
606 case GL_INT: return TYPE_INT;
607 case GL_INT_VEC2: return TYPE_INT_VEC2;
608 case GL_INT_VEC3: return TYPE_INT_VEC3;
609 case GL_INT_VEC4: return TYPE_INT_VEC4;
610
611 case GL_UNSIGNED_INT: return TYPE_UINT;
612 case GL_UNSIGNED_INT_VEC2: return TYPE_UINT_VEC2;
613 case GL_UNSIGNED_INT_VEC3: return TYPE_UINT_VEC3;
614 case GL_UNSIGNED_INT_VEC4: return TYPE_UINT_VEC4;
615
616 case GL_BOOL: return TYPE_BOOL;
617 case GL_BOOL_VEC2: return TYPE_BOOL_VEC2;
618 case GL_BOOL_VEC3: return TYPE_BOOL_VEC3;
619 case GL_BOOL_VEC4: return TYPE_BOOL_VEC4;
620
621 case GL_SAMPLER_1D: return TYPE_SAMPLER_1D;
622 case GL_SAMPLER_2D: return TYPE_SAMPLER_2D;
623 case GL_SAMPLER_CUBE: return TYPE_SAMPLER_CUBE;
624 case GL_SAMPLER_2D_ARRAY: return TYPE_SAMPLER_2D_ARRAY;
625 case GL_SAMPLER_3D: return TYPE_SAMPLER_3D;
626 case GL_SAMPLER_CUBE_MAP_ARRAY: return TYPE_SAMPLER_CUBE_ARRAY;
627
628 case GL_SAMPLER_1D_SHADOW: return TYPE_SAMPLER_1D_SHADOW;
629 case GL_SAMPLER_2D_SHADOW: return TYPE_SAMPLER_2D_SHADOW;
630 case GL_SAMPLER_CUBE_SHADOW: return TYPE_SAMPLER_CUBE_SHADOW;
631 case GL_SAMPLER_2D_ARRAY_SHADOW: return TYPE_SAMPLER_2D_ARRAY_SHADOW;
632 case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW: return TYPE_SAMPLER_CUBE_ARRAY_SHADOW;
633
634 case GL_INT_SAMPLER_1D: return TYPE_INT_SAMPLER_1D;
635 case GL_INT_SAMPLER_2D: return TYPE_INT_SAMPLER_2D;
636 case GL_INT_SAMPLER_CUBE: return TYPE_INT_SAMPLER_CUBE;
637 case GL_INT_SAMPLER_2D_ARRAY: return TYPE_INT_SAMPLER_2D_ARRAY;
638 case GL_INT_SAMPLER_3D: return TYPE_INT_SAMPLER_3D;
639 case GL_INT_SAMPLER_CUBE_MAP_ARRAY: return TYPE_INT_SAMPLER_CUBE_ARRAY;
640
641 case GL_UNSIGNED_INT_SAMPLER_1D: return TYPE_UINT_SAMPLER_1D;
642 case GL_UNSIGNED_INT_SAMPLER_2D: return TYPE_UINT_SAMPLER_2D;
643 case GL_UNSIGNED_INT_SAMPLER_CUBE: return TYPE_UINT_SAMPLER_CUBE;
644 case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: return TYPE_UINT_SAMPLER_2D_ARRAY;
645 case GL_UNSIGNED_INT_SAMPLER_3D: return TYPE_UINT_SAMPLER_3D;
646 case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY: return TYPE_UINT_SAMPLER_CUBE_ARRAY;
647
648 case GL_SAMPLER_2D_MULTISAMPLE: return TYPE_SAMPLER_2D_MULTISAMPLE;
649 case GL_INT_SAMPLER_2D_MULTISAMPLE: return TYPE_INT_SAMPLER_2D_MULTISAMPLE;
650 case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: return TYPE_UINT_SAMPLER_2D_MULTISAMPLE;
651
652 case GL_IMAGE_2D: return TYPE_IMAGE_2D;
653 case GL_IMAGE_CUBE: return TYPE_IMAGE_CUBE;
654 case GL_IMAGE_2D_ARRAY: return TYPE_IMAGE_2D_ARRAY;
655 case GL_IMAGE_3D: return TYPE_IMAGE_3D;
656 case GL_INT_IMAGE_2D: return TYPE_INT_IMAGE_2D;
657 case GL_INT_IMAGE_CUBE: return TYPE_INT_IMAGE_CUBE;
658 case GL_INT_IMAGE_2D_ARRAY: return TYPE_INT_IMAGE_2D_ARRAY;
659 case GL_INT_IMAGE_3D: return TYPE_INT_IMAGE_3D;
660 case GL_UNSIGNED_INT_IMAGE_2D: return TYPE_UINT_IMAGE_2D;
661 case GL_UNSIGNED_INT_IMAGE_CUBE: return TYPE_UINT_IMAGE_CUBE;
662 case GL_UNSIGNED_INT_IMAGE_2D_ARRAY: return TYPE_UINT_IMAGE_2D_ARRAY;
663 case GL_UNSIGNED_INT_IMAGE_3D: return TYPE_UINT_IMAGE_3D;
664
665 case GL_UNSIGNED_INT_ATOMIC_COUNTER: return TYPE_UINT_ATOMIC_COUNTER;
666
667 default:
668 return TYPE_LAST;
669 }
670 }
671
672 } // glu
673