1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL ES Utilities
3e5c31af7Sopenharmony_ci * ------------------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief Shader utilities.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "gluShaderUtil.hpp"
25e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
26e5c31af7Sopenharmony_ci#include "deArrayUtil.hpp"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_cinamespace glu
29e5c31af7Sopenharmony_ci{
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ci// ShadingLanguageVersion
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_ciconst char* getGLSLVersionName (GLSLVersion version)
34e5c31af7Sopenharmony_ci{
35e5c31af7Sopenharmony_ci	static const char* s_names[] =
36e5c31af7Sopenharmony_ci	{
37e5c31af7Sopenharmony_ci		"GLSL ES 1.0",
38e5c31af7Sopenharmony_ci		"GLSL ES 3.0",
39e5c31af7Sopenharmony_ci		"GLSL ES 3.1",
40e5c31af7Sopenharmony_ci		"GLSL ES 3.2",
41e5c31af7Sopenharmony_ci		"GLSL 1.3",
42e5c31af7Sopenharmony_ci		"GLSL 1.4",
43e5c31af7Sopenharmony_ci		"GLSL 1.5",
44e5c31af7Sopenharmony_ci		"GLSL 3.3",
45e5c31af7Sopenharmony_ci		"GLSL 4.0",
46e5c31af7Sopenharmony_ci		"GLSL 4.1",
47e5c31af7Sopenharmony_ci		"GLSL 4.2",
48e5c31af7Sopenharmony_ci		"GLSL 4.3",
49e5c31af7Sopenharmony_ci		"GLSL 4.4",
50e5c31af7Sopenharmony_ci		"GLSL 4.5",
51e5c31af7Sopenharmony_ci		"GLSL 4.6",
52e5c31af7Sopenharmony_ci	};
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_ci	return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_names, version);
55e5c31af7Sopenharmony_ci}
56e5c31af7Sopenharmony_ci
57e5c31af7Sopenharmony_ciconst char* getGLSLVersionDeclaration (GLSLVersion version)
58e5c31af7Sopenharmony_ci{
59e5c31af7Sopenharmony_ci	static const char* s_decl[] =
60e5c31af7Sopenharmony_ci	{
61e5c31af7Sopenharmony_ci		"#version 100",
62e5c31af7Sopenharmony_ci		"#version 300 es",
63e5c31af7Sopenharmony_ci		"#version 310 es",
64e5c31af7Sopenharmony_ci		"#version 320 es",
65e5c31af7Sopenharmony_ci		"#version 130",
66e5c31af7Sopenharmony_ci		"#version 140",
67e5c31af7Sopenharmony_ci		"#version 150",
68e5c31af7Sopenharmony_ci		"#version 330",
69e5c31af7Sopenharmony_ci		"#version 400",
70e5c31af7Sopenharmony_ci		"#version 410",
71e5c31af7Sopenharmony_ci		"#version 420",
72e5c31af7Sopenharmony_ci		"#version 430",
73e5c31af7Sopenharmony_ci		"#version 440",
74e5c31af7Sopenharmony_ci		"#version 450",
75e5c31af7Sopenharmony_ci		"#version 460",
76e5c31af7Sopenharmony_ci	};
77e5c31af7Sopenharmony_ci
78e5c31af7Sopenharmony_ci	return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_decl, version);
79e5c31af7Sopenharmony_ci}
80e5c31af7Sopenharmony_ci
81e5c31af7Sopenharmony_cibool glslVersionUsesInOutQualifiers (GLSLVersion version)
82e5c31af7Sopenharmony_ci{
83e5c31af7Sopenharmony_ci	return de::inRange<int>(version, GLSL_VERSION_300_ES, GLSL_VERSION_320_ES) || de::inRange<int>(version, GLSL_VERSION_330, GLSL_VERSION_460);
84e5c31af7Sopenharmony_ci}
85e5c31af7Sopenharmony_ci
86e5c31af7Sopenharmony_cibool glslVersionIsES (GLSLVersion version)
87e5c31af7Sopenharmony_ci{
88e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(GLSL_VERSION_LAST == 15);
89e5c31af7Sopenharmony_ci	DE_ASSERT(version != GLSL_VERSION_LAST);
90e5c31af7Sopenharmony_ci
91e5c31af7Sopenharmony_ci	if (version == GLSL_VERSION_100_ES	||
92e5c31af7Sopenharmony_ci		version == GLSL_VERSION_300_ES	||
93e5c31af7Sopenharmony_ci		version == GLSL_VERSION_310_ES	||
94e5c31af7Sopenharmony_ci		version == GLSL_VERSION_320_ES)
95e5c31af7Sopenharmony_ci		return true;
96e5c31af7Sopenharmony_ci	else
97e5c31af7Sopenharmony_ci		return false;
98e5c31af7Sopenharmony_ci}
99e5c31af7Sopenharmony_ci
100e5c31af7Sopenharmony_ci// \todo [2014-10-06 pyry] Export this.
101e5c31af7Sopenharmony_cistatic ApiType getMinAPIForGLSLVersion (GLSLVersion version)
102e5c31af7Sopenharmony_ci{
103e5c31af7Sopenharmony_ci	static const ApiType s_minApi[] =
104e5c31af7Sopenharmony_ci	{
105e5c31af7Sopenharmony_ci		ApiType::es(2,0),
106e5c31af7Sopenharmony_ci		ApiType::es(3,0),
107e5c31af7Sopenharmony_ci		ApiType::es(3,1),
108e5c31af7Sopenharmony_ci		ApiType::es(3,2),
109e5c31af7Sopenharmony_ci		ApiType::core(3,0),
110e5c31af7Sopenharmony_ci		ApiType::core(3,1),
111e5c31af7Sopenharmony_ci		ApiType::core(3,2),
112e5c31af7Sopenharmony_ci		ApiType::core(3,3),
113e5c31af7Sopenharmony_ci		ApiType::core(4,0),
114e5c31af7Sopenharmony_ci		ApiType::core(4,1),
115e5c31af7Sopenharmony_ci		ApiType::core(4,2),
116e5c31af7Sopenharmony_ci		ApiType::core(4,3),
117e5c31af7Sopenharmony_ci		ApiType::core(4,4),
118e5c31af7Sopenharmony_ci		ApiType::core(4,5),
119e5c31af7Sopenharmony_ci		ApiType::core(4,6),
120e5c31af7Sopenharmony_ci	};
121e5c31af7Sopenharmony_ci
122e5c31af7Sopenharmony_ci	return de::getSizedArrayElement<GLSL_VERSION_LAST>(s_minApi, version);
123e5c31af7Sopenharmony_ci}
124e5c31af7Sopenharmony_ci
125e5c31af7Sopenharmony_cibool isGLSLVersionSupported (ContextType type, GLSLVersion version)
126e5c31af7Sopenharmony_ci{
127e5c31af7Sopenharmony_ci	return contextSupports(type, getMinAPIForGLSLVersion(version));
128e5c31af7Sopenharmony_ci}
129e5c31af7Sopenharmony_ci
130e5c31af7Sopenharmony_ciGLSLVersion getContextTypeGLSLVersion (ContextType type)
131e5c31af7Sopenharmony_ci{
132e5c31af7Sopenharmony_ci	// \note From newer to older
133e5c31af7Sopenharmony_ci	for (int version = GLSL_VERSION_LAST-1; version >= 0; version--)
134e5c31af7Sopenharmony_ci	{
135e5c31af7Sopenharmony_ci		if (isGLSLVersionSupported(type, GLSLVersion(version)))
136e5c31af7Sopenharmony_ci			return GLSLVersion(version);
137e5c31af7Sopenharmony_ci	}
138e5c31af7Sopenharmony_ci
139e5c31af7Sopenharmony_ci	DE_ASSERT(false);
140e5c31af7Sopenharmony_ci	return GLSL_VERSION_LAST;
141e5c31af7Sopenharmony_ci}
142e5c31af7Sopenharmony_ci
143e5c31af7Sopenharmony_ci// ShaderType
144e5c31af7Sopenharmony_ci
145e5c31af7Sopenharmony_ciconst char* getShaderTypeName (ShaderType shaderType)
146e5c31af7Sopenharmony_ci{
147e5c31af7Sopenharmony_ci	static const char* s_names[] =
148e5c31af7Sopenharmony_ci	{
149e5c31af7Sopenharmony_ci		"vertex",
150e5c31af7Sopenharmony_ci		"fragment",
151e5c31af7Sopenharmony_ci		"geometry",
152e5c31af7Sopenharmony_ci		"tess_control",
153e5c31af7Sopenharmony_ci		"tess_eval",
154e5c31af7Sopenharmony_ci		"compute",
155e5c31af7Sopenharmony_ci		"ray_gen",
156e5c31af7Sopenharmony_ci		"any_hit",
157e5c31af7Sopenharmony_ci		"closest_hit",
158e5c31af7Sopenharmony_ci		"miss",
159e5c31af7Sopenharmony_ci		"intersection",
160e5c31af7Sopenharmony_ci		"callable",
161e5c31af7Sopenharmony_ci		"task",
162e5c31af7Sopenharmony_ci		"mesh",
163e5c31af7Sopenharmony_ci	};
164e5c31af7Sopenharmony_ci
165e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == SHADERTYPE_LAST);
166e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)shaderType, 0, SHADERTYPE_LAST));
167e5c31af7Sopenharmony_ci	return s_names[(int)shaderType];
168e5c31af7Sopenharmony_ci}
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_cistd::string getShaderTypePostfix (ShaderType shaderType)
171e5c31af7Sopenharmony_ci{
172e5c31af7Sopenharmony_ci	return "_" + std::string(getShaderTypeName(shaderType));
173e5c31af7Sopenharmony_ci}
174e5c31af7Sopenharmony_ci
175e5c31af7Sopenharmony_ci// Precision
176e5c31af7Sopenharmony_ci
177e5c31af7Sopenharmony_ciconst char* getPrecisionName (Precision precision)
178e5c31af7Sopenharmony_ci{
179e5c31af7Sopenharmony_ci	static const char* s_names[] =
180e5c31af7Sopenharmony_ci	{
181e5c31af7Sopenharmony_ci		"lowp",
182e5c31af7Sopenharmony_ci		"mediump",
183e5c31af7Sopenharmony_ci		"highp"
184e5c31af7Sopenharmony_ci	};
185e5c31af7Sopenharmony_ci
186e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == PRECISION_LAST);
187e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)precision, 0, PRECISION_LAST));
188e5c31af7Sopenharmony_ci	return s_names[(int)precision];
189e5c31af7Sopenharmony_ci}
190e5c31af7Sopenharmony_ci
191e5c31af7Sopenharmony_cistd::string getPrecisionPostfix (Precision precision)
192e5c31af7Sopenharmony_ci{
193e5c31af7Sopenharmony_ci	return "_" + std::string(getPrecisionName(precision));
194e5c31af7Sopenharmony_ci}
195e5c31af7Sopenharmony_ci
196e5c31af7Sopenharmony_ci// DataType
197e5c31af7Sopenharmony_ci
198e5c31af7Sopenharmony_ciconst char* getDataTypeName (DataType dataType)
199e5c31af7Sopenharmony_ci{
200e5c31af7Sopenharmony_ci	static const char* s_names[] =
201e5c31af7Sopenharmony_ci	{
202e5c31af7Sopenharmony_ci		"invalid",
203e5c31af7Sopenharmony_ci		"float",
204e5c31af7Sopenharmony_ci		"vec2",
205e5c31af7Sopenharmony_ci		"vec3",
206e5c31af7Sopenharmony_ci		"vec4",
207e5c31af7Sopenharmony_ci		"mat2",
208e5c31af7Sopenharmony_ci		"mat2x3",
209e5c31af7Sopenharmony_ci		"mat2x4",
210e5c31af7Sopenharmony_ci		"mat3x2",
211e5c31af7Sopenharmony_ci		"mat3",
212e5c31af7Sopenharmony_ci		"mat3x4",
213e5c31af7Sopenharmony_ci		"mat4x2",
214e5c31af7Sopenharmony_ci		"mat4x3",
215e5c31af7Sopenharmony_ci		"mat4",
216e5c31af7Sopenharmony_ci		"double",
217e5c31af7Sopenharmony_ci		"dvec2",
218e5c31af7Sopenharmony_ci		"dvec3",
219e5c31af7Sopenharmony_ci		"dvec4",
220e5c31af7Sopenharmony_ci		"dmat2",
221e5c31af7Sopenharmony_ci		"dmat2x3",
222e5c31af7Sopenharmony_ci		"dmat2x4",
223e5c31af7Sopenharmony_ci		"dmat3x2",
224e5c31af7Sopenharmony_ci		"dmat3",
225e5c31af7Sopenharmony_ci		"dmat3x4",
226e5c31af7Sopenharmony_ci		"dmat4x2",
227e5c31af7Sopenharmony_ci		"dmat4x3",
228e5c31af7Sopenharmony_ci		"dmat4",
229e5c31af7Sopenharmony_ci		"int",
230e5c31af7Sopenharmony_ci		"ivec2",
231e5c31af7Sopenharmony_ci		"ivec3",
232e5c31af7Sopenharmony_ci		"ivec4",
233e5c31af7Sopenharmony_ci		"uint",
234e5c31af7Sopenharmony_ci		"uvec2",
235e5c31af7Sopenharmony_ci		"uvec3",
236e5c31af7Sopenharmony_ci		"uvec4",
237e5c31af7Sopenharmony_ci		"bool",
238e5c31af7Sopenharmony_ci		"bvec2",
239e5c31af7Sopenharmony_ci		"bvec3",
240e5c31af7Sopenharmony_ci		"bvec4",
241e5c31af7Sopenharmony_ci		"sampler1D",
242e5c31af7Sopenharmony_ci		"sampler2D",
243e5c31af7Sopenharmony_ci		"samplerCube",
244e5c31af7Sopenharmony_ci		"sampler1DArray",
245e5c31af7Sopenharmony_ci		"sampler2DArray",
246e5c31af7Sopenharmony_ci		"sampler3D",
247e5c31af7Sopenharmony_ci		"samplerCubeArray",
248e5c31af7Sopenharmony_ci		"sampler1DShadow",
249e5c31af7Sopenharmony_ci		"sampler2DShadow",
250e5c31af7Sopenharmony_ci		"samplerCubeShadow",
251e5c31af7Sopenharmony_ci		"sampler1DArrayShadow",
252e5c31af7Sopenharmony_ci		"sampler2DArrayShadow",
253e5c31af7Sopenharmony_ci		"samplerCubeArrayShadow",
254e5c31af7Sopenharmony_ci		"isampler1D",
255e5c31af7Sopenharmony_ci		"isampler2D",
256e5c31af7Sopenharmony_ci		"isamplerCube",
257e5c31af7Sopenharmony_ci		"isampler1DArray",
258e5c31af7Sopenharmony_ci		"isampler2DArray",
259e5c31af7Sopenharmony_ci		"isampler3D",
260e5c31af7Sopenharmony_ci		"isamplerCubeArray",
261e5c31af7Sopenharmony_ci		"usampler1D",
262e5c31af7Sopenharmony_ci		"usampler2D",
263e5c31af7Sopenharmony_ci		"usamplerCube",
264e5c31af7Sopenharmony_ci		"usampler1DArray",
265e5c31af7Sopenharmony_ci		"usampler2DArray",
266e5c31af7Sopenharmony_ci		"usampler3D",
267e5c31af7Sopenharmony_ci		"usamplerCubeArray",
268e5c31af7Sopenharmony_ci		"sampler2DMS",
269e5c31af7Sopenharmony_ci		"isampler2DMS",
270e5c31af7Sopenharmony_ci		"usampler2DMS",
271e5c31af7Sopenharmony_ci		"image2D",
272e5c31af7Sopenharmony_ci		"imageCube",
273e5c31af7Sopenharmony_ci		"image2DArray",
274e5c31af7Sopenharmony_ci		"image3D",
275e5c31af7Sopenharmony_ci		"imageCubeArray",
276e5c31af7Sopenharmony_ci		"iimage2D",
277e5c31af7Sopenharmony_ci		"iimageCube",
278e5c31af7Sopenharmony_ci		"iimage2DArray",
279e5c31af7Sopenharmony_ci		"iimage3D",
280e5c31af7Sopenharmony_ci		"iimageCubeArray",
281e5c31af7Sopenharmony_ci		"uimage2D",
282e5c31af7Sopenharmony_ci		"uimageCube",
283e5c31af7Sopenharmony_ci		"uimage2DArray",
284e5c31af7Sopenharmony_ci		"uimage3D",
285e5c31af7Sopenharmony_ci		"uimageCubeArray",
286e5c31af7Sopenharmony_ci		"atomic_uint",
287e5c31af7Sopenharmony_ci		"samplerBuffer",
288e5c31af7Sopenharmony_ci		"isamplerBuffer",
289e5c31af7Sopenharmony_ci		"usamplerBuffer",
290e5c31af7Sopenharmony_ci		"sampler2DMSArray",
291e5c31af7Sopenharmony_ci		"isampler2DMSArray",
292e5c31af7Sopenharmony_ci		"usampler2DMSArray",
293e5c31af7Sopenharmony_ci		"imageBuffer",
294e5c31af7Sopenharmony_ci		"iimageBuffer",
295e5c31af7Sopenharmony_ci		"uimageBuffer",
296e5c31af7Sopenharmony_ci		"uint8_t",
297e5c31af7Sopenharmony_ci		"u8vec2",
298e5c31af7Sopenharmony_ci		"u8vec3",
299e5c31af7Sopenharmony_ci		"u8vec4",
300e5c31af7Sopenharmony_ci		"int8_t",
301e5c31af7Sopenharmony_ci		"i8vec2",
302e5c31af7Sopenharmony_ci		"i8vec3",
303e5c31af7Sopenharmony_ci		"i8vec4",
304e5c31af7Sopenharmony_ci		"uint16_t",
305e5c31af7Sopenharmony_ci		"u16vec2",
306e5c31af7Sopenharmony_ci		"u16vec3",
307e5c31af7Sopenharmony_ci		"u16vec4",
308e5c31af7Sopenharmony_ci		"int16_t",
309e5c31af7Sopenharmony_ci		"i16vec2",
310e5c31af7Sopenharmony_ci		"i16vec3",
311e5c31af7Sopenharmony_ci		"i16vec4",
312e5c31af7Sopenharmony_ci		"float16_t",
313e5c31af7Sopenharmony_ci		"f16vec2",
314e5c31af7Sopenharmony_ci		"f16vec3",
315e5c31af7Sopenharmony_ci		"f16vec4",
316e5c31af7Sopenharmony_ci		"f16mat2",
317e5c31af7Sopenharmony_ci		"f16mat2x3",
318e5c31af7Sopenharmony_ci		"f16mat2x4",
319e5c31af7Sopenharmony_ci		"f16mat3x2",
320e5c31af7Sopenharmony_ci		"f16mat3",
321e5c31af7Sopenharmony_ci		"f16mat3x4",
322e5c31af7Sopenharmony_ci		"f16mat4x2",
323e5c31af7Sopenharmony_ci		"f16mat4x3",
324e5c31af7Sopenharmony_ci		"f16mat4",
325e5c31af7Sopenharmony_ci	};
326e5c31af7Sopenharmony_ci
327e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == TYPE_LAST);
328e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_names)));
329e5c31af7Sopenharmony_ci	return s_names[(int)dataType];
330e5c31af7Sopenharmony_ci}
331e5c31af7Sopenharmony_ci
332e5c31af7Sopenharmony_ciint getDataTypeScalarSize (DataType dataType)
333e5c31af7Sopenharmony_ci{
334e5c31af7Sopenharmony_ci	static const int s_sizes[] =
335e5c31af7Sopenharmony_ci	{
336e5c31af7Sopenharmony_ci		-1,		// invalid
337e5c31af7Sopenharmony_ci		1,		// float
338e5c31af7Sopenharmony_ci		2,		// vec2
339e5c31af7Sopenharmony_ci		3,		// vec3
340e5c31af7Sopenharmony_ci		4,		// vec4
341e5c31af7Sopenharmony_ci		4,		// mat2
342e5c31af7Sopenharmony_ci		6,		// mat2x3
343e5c31af7Sopenharmony_ci		8,		// mat2x4
344e5c31af7Sopenharmony_ci		6,		// mat3x2
345e5c31af7Sopenharmony_ci		9,		// mat3
346e5c31af7Sopenharmony_ci		12,		// mat3x4
347e5c31af7Sopenharmony_ci		8,		// mat4x2
348e5c31af7Sopenharmony_ci		12,		// mat4x3
349e5c31af7Sopenharmony_ci		16,		// mat4
350e5c31af7Sopenharmony_ci		1,		// double
351e5c31af7Sopenharmony_ci		2,		// dvec2
352e5c31af7Sopenharmony_ci		3,		// dvec3
353e5c31af7Sopenharmony_ci		4,		// dvec4
354e5c31af7Sopenharmony_ci		4,		// dmat2
355e5c31af7Sopenharmony_ci		6,		// dmat2x3
356e5c31af7Sopenharmony_ci		8,		// dmat2x4
357e5c31af7Sopenharmony_ci		6,		// dmat3x2
358e5c31af7Sopenharmony_ci		9,		// dmat3
359e5c31af7Sopenharmony_ci		12,		// dmat3x4
360e5c31af7Sopenharmony_ci		8,		// dmat4x2
361e5c31af7Sopenharmony_ci		12,		// dmat4x3
362e5c31af7Sopenharmony_ci		16,		// dmat4
363e5c31af7Sopenharmony_ci		1,		// int
364e5c31af7Sopenharmony_ci		2,		// ivec2
365e5c31af7Sopenharmony_ci		3,		// ivec3
366e5c31af7Sopenharmony_ci		4,		// ivec4
367e5c31af7Sopenharmony_ci		1,		// uint
368e5c31af7Sopenharmony_ci		2,		// uvec2
369e5c31af7Sopenharmony_ci		3,		// uvec3
370e5c31af7Sopenharmony_ci		4,		// uvec4
371e5c31af7Sopenharmony_ci		1,		// bool
372e5c31af7Sopenharmony_ci		2,		// bvec2
373e5c31af7Sopenharmony_ci		3,		// bvec3
374e5c31af7Sopenharmony_ci		4,		// bvec4
375e5c31af7Sopenharmony_ci		1,		// sampler1D
376e5c31af7Sopenharmony_ci		1,		// sampler2D
377e5c31af7Sopenharmony_ci		1,		// samplerCube
378e5c31af7Sopenharmony_ci		1,		// sampler1DArray
379e5c31af7Sopenharmony_ci		1,		// sampler2DArray
380e5c31af7Sopenharmony_ci		1,		// sampler3D
381e5c31af7Sopenharmony_ci		1,		// samplerCubeArray
382e5c31af7Sopenharmony_ci		1,		// sampler1DShadow
383e5c31af7Sopenharmony_ci		1,		// sampler2DShadow
384e5c31af7Sopenharmony_ci		1,		// samplerCubeShadow
385e5c31af7Sopenharmony_ci		1,		// sampler1DArrayShadow
386e5c31af7Sopenharmony_ci		1,		// sampler2DArrayShadow
387e5c31af7Sopenharmony_ci		1,		// samplerCubeArrayShadow
388e5c31af7Sopenharmony_ci		1,		// isampler1D
389e5c31af7Sopenharmony_ci		1,		// isampler2D
390e5c31af7Sopenharmony_ci		1,		// isamplerCube
391e5c31af7Sopenharmony_ci		1,		// isampler1DArray
392e5c31af7Sopenharmony_ci		1,		// isampler2DArray
393e5c31af7Sopenharmony_ci		1,		// isampler3D
394e5c31af7Sopenharmony_ci		1,		// isamplerCubeArray
395e5c31af7Sopenharmony_ci		1,		// usampler1D
396e5c31af7Sopenharmony_ci		1,		// usampler2D
397e5c31af7Sopenharmony_ci		1,		// usamplerCube
398e5c31af7Sopenharmony_ci		1,		// usampler1DArray
399e5c31af7Sopenharmony_ci		1,		// usampler2DArray
400e5c31af7Sopenharmony_ci		1,		// usampler3D
401e5c31af7Sopenharmony_ci		1,		// usamplerCubeArray
402e5c31af7Sopenharmony_ci		1,		// sampler2DMS
403e5c31af7Sopenharmony_ci		1,		// isampler2DMS
404e5c31af7Sopenharmony_ci		1,		// usampler2DMS
405e5c31af7Sopenharmony_ci		1,		// image2D
406e5c31af7Sopenharmony_ci		1,		// imageCube
407e5c31af7Sopenharmony_ci		1,		// image2DArray
408e5c31af7Sopenharmony_ci		1,		// image3D
409e5c31af7Sopenharmony_ci		1,		// imageCubeArray
410e5c31af7Sopenharmony_ci		1,		// iimage2D
411e5c31af7Sopenharmony_ci		1,		// iimageCube
412e5c31af7Sopenharmony_ci		1,		// iimage2DArray
413e5c31af7Sopenharmony_ci		1,		// iimage3D
414e5c31af7Sopenharmony_ci		1,		// iimageCubeArray
415e5c31af7Sopenharmony_ci		1,		// uimage2D
416e5c31af7Sopenharmony_ci		1,		// uimageCube
417e5c31af7Sopenharmony_ci		1,		// uimage2DArray
418e5c31af7Sopenharmony_ci		1,		// uimage3D
419e5c31af7Sopenharmony_ci		1,		// uimageCubeArray
420e5c31af7Sopenharmony_ci		1,		// atomic_uint
421e5c31af7Sopenharmony_ci		1,		// samplerBuffer
422e5c31af7Sopenharmony_ci		1,		// isamplerBuffer
423e5c31af7Sopenharmony_ci		1,		// usamplerBuffer
424e5c31af7Sopenharmony_ci		1,		// sampler2DMSArray
425e5c31af7Sopenharmony_ci		1,		// isampler2DMSArray
426e5c31af7Sopenharmony_ci		1,		// usampler2DMSArray
427e5c31af7Sopenharmony_ci		1,		// imageBuffer
428e5c31af7Sopenharmony_ci		1,		// iimageBuffer
429e5c31af7Sopenharmony_ci		1,		// uimageBuffer
430e5c31af7Sopenharmony_ci		1,		// uint8_t
431e5c31af7Sopenharmony_ci		2,		// u8vec2
432e5c31af7Sopenharmony_ci		3,		// u8vec3
433e5c31af7Sopenharmony_ci		4,		// u8vec4
434e5c31af7Sopenharmony_ci		1,		// int8_t
435e5c31af7Sopenharmony_ci		2,		// i8vec2
436e5c31af7Sopenharmony_ci		3,		// i8vec3
437e5c31af7Sopenharmony_ci		4,		// i8vec4
438e5c31af7Sopenharmony_ci		1,		// uint16_t
439e5c31af7Sopenharmony_ci		2,		// u16vec2
440e5c31af7Sopenharmony_ci		3,		// u16vec3
441e5c31af7Sopenharmony_ci		4,		// u16vec4
442e5c31af7Sopenharmony_ci		1,		// int16_t
443e5c31af7Sopenharmony_ci		2,		// i16vec2
444e5c31af7Sopenharmony_ci		3,		// i16vec3
445e5c31af7Sopenharmony_ci		4,		// i16vec4
446e5c31af7Sopenharmony_ci		1,		// float16_t
447e5c31af7Sopenharmony_ci		2,		// f16vec2
448e5c31af7Sopenharmony_ci		3,		// f16vec3
449e5c31af7Sopenharmony_ci		4,		// f16vec4
450e5c31af7Sopenharmony_ci		4,		// f16mat2
451e5c31af7Sopenharmony_ci		6,		// f16mat2x3
452e5c31af7Sopenharmony_ci		8,		// f16mat2x4
453e5c31af7Sopenharmony_ci		6,		// f16mat3x2
454e5c31af7Sopenharmony_ci		9,		// f16mat3
455e5c31af7Sopenharmony_ci		12,		// f16mat3x4
456e5c31af7Sopenharmony_ci		8,		// f16mat4x2
457e5c31af7Sopenharmony_ci		12,		// f16mat4x3
458e5c31af7Sopenharmony_ci		16,		// f16mat4
459e5c31af7Sopenharmony_ci	};
460e5c31af7Sopenharmony_ci
461e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_sizes) == TYPE_LAST);
462e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_sizes)));
463e5c31af7Sopenharmony_ci	return s_sizes[(int)dataType];
464e5c31af7Sopenharmony_ci}
465e5c31af7Sopenharmony_ci
466e5c31af7Sopenharmony_ciDataType getDataTypeScalarType (DataType dataType)
467e5c31af7Sopenharmony_ci{
468e5c31af7Sopenharmony_ci	static const DataType s_scalarTypes[] =
469e5c31af7Sopenharmony_ci	{
470e5c31af7Sopenharmony_ci		TYPE_INVALID,							// invalid
471e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// float
472e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// vec2
473e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// vec3
474e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// vec4
475e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat2
476e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat2x3
477e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat2x4
478e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat3x2
479e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat3
480e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat3x4
481e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat4x2
482e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat4x3
483e5c31af7Sopenharmony_ci		TYPE_FLOAT,								// mat4
484e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// double
485e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dvec2
486e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dvec3
487e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dvec4
488e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat2
489e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat2x3
490e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat2x4
491e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat3x2
492e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat3
493e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat3x4
494e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat4x2
495e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat4x3
496e5c31af7Sopenharmony_ci		TYPE_DOUBLE,							// dmat4
497e5c31af7Sopenharmony_ci		TYPE_INT,								// int
498e5c31af7Sopenharmony_ci		TYPE_INT,								// ivec2
499e5c31af7Sopenharmony_ci		TYPE_INT,								// ivec3
500e5c31af7Sopenharmony_ci		TYPE_INT,								// ivec4
501e5c31af7Sopenharmony_ci		TYPE_UINT,								// uint
502e5c31af7Sopenharmony_ci		TYPE_UINT,								// uvec2
503e5c31af7Sopenharmony_ci		TYPE_UINT,								// uvec3
504e5c31af7Sopenharmony_ci		TYPE_UINT,								// uvec4
505e5c31af7Sopenharmony_ci		TYPE_BOOL,								// bool
506e5c31af7Sopenharmony_ci		TYPE_BOOL,								// bvec2
507e5c31af7Sopenharmony_ci		TYPE_BOOL,								// bvec3
508e5c31af7Sopenharmony_ci		TYPE_BOOL,								// bvec4
509e5c31af7Sopenharmony_ci		TYPE_SAMPLER_1D,						// sampler1D
510e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D,						// sampler2D
511e5c31af7Sopenharmony_ci		TYPE_SAMPLER_CUBE,						// samplerCube
512e5c31af7Sopenharmony_ci		TYPE_SAMPLER_1D_ARRAY,					// sampler1DArray
513e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D_ARRAY,					// sampler2DArray
514e5c31af7Sopenharmony_ci		TYPE_SAMPLER_3D,						// sampler3D
515e5c31af7Sopenharmony_ci		TYPE_SAMPLER_CUBE_ARRAY,				// samplerCubeArray
516e5c31af7Sopenharmony_ci		TYPE_SAMPLER_1D_SHADOW,					// sampler1DShadow
517e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D_SHADOW,					// sampler2DShadow
518e5c31af7Sopenharmony_ci		TYPE_SAMPLER_CUBE_SHADOW,				// samplerCubeShadow
519e5c31af7Sopenharmony_ci		TYPE_SAMPLER_1D_ARRAY_SHADOW,			// sampler1DArrayShadow
520e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D_ARRAY_SHADOW,			// sampler2DArrayShadow
521e5c31af7Sopenharmony_ci		TYPE_SAMPLER_CUBE_ARRAY_SHADOW,			// samplerCubeArrayShadow
522e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_1D,					// isampler1D
523e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_2D,					// isampler2D
524e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_CUBE,					// isamplerCube
525e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_1D_ARRAY,				// isampler1DArray
526e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_2D_ARRAY,				// isampler2DArray
527e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_3D,					// isampler3D
528e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_CUBE_ARRAY,			// isamplerCubeArray
529e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_1D,					// usampler1D
530e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_2D,					// usampler2D
531e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_CUBE,					// usamplerCube
532e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_1D_ARRAY,				// usampler1DArray
533e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_2D_ARRAY,				// usampler2DArray
534e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_3D,					// usampler3D
535e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_CUBE_ARRAY,			// usamplerCubeArray
536e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D_MULTISAMPLE,			// sampler2DMS
537e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_2D_MULTISAMPLE,		// isampler2DMS
538e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_2D_MULTISAMPLE,		// usampler2DMS
539e5c31af7Sopenharmony_ci		TYPE_IMAGE_2D,							// image2D
540e5c31af7Sopenharmony_ci		TYPE_IMAGE_CUBE,						// imageCube
541e5c31af7Sopenharmony_ci		TYPE_IMAGE_2D_ARRAY,					// image2DArray
542e5c31af7Sopenharmony_ci		TYPE_IMAGE_3D,							// image3D
543e5c31af7Sopenharmony_ci		TYPE_IMAGE_CUBE_ARRAY,					// imageCubeArray
544e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_2D,						// iimage2D
545e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_CUBE,					// iimageCube
546e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_2D_ARRAY,				// iimage2DArray
547e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_3D,						// iimage3D
548e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_CUBE_ARRAY,				// iimageCubeArray
549e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_2D,						// uimage2D
550e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_CUBE,					// uimageCube
551e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_2D_ARRAY,				// uimage2DArray
552e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_3D,						// uimage3D
553e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_CUBE_ARRAY,				// uimageCubeArray
554e5c31af7Sopenharmony_ci		TYPE_UINT_ATOMIC_COUNTER,				// atomic_uint
555e5c31af7Sopenharmony_ci		TYPE_SAMPLER_BUFFER,					// samplerBuffer
556e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_BUFFER,				// isamplerBuffer
557e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_BUFFER,				// usamplerBuffer
558e5c31af7Sopenharmony_ci		TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY,		// sampler2DMSArray
559e5c31af7Sopenharmony_ci		TYPE_INT_SAMPLER_2D_MULTISAMPLE_ARRAY,	// isampler2DMSArray
560e5c31af7Sopenharmony_ci		TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY,	// usampler2DMSArray
561e5c31af7Sopenharmony_ci		TYPE_IMAGE_BUFFER,						// imageBuffer
562e5c31af7Sopenharmony_ci		TYPE_INT_IMAGE_BUFFER,					// iimageBuffer
563e5c31af7Sopenharmony_ci		TYPE_UINT_IMAGE_BUFFER,					// uimageBuffer
564e5c31af7Sopenharmony_ci		TYPE_UINT8,								// uint8_t
565e5c31af7Sopenharmony_ci		TYPE_UINT8,								// u8vec2
566e5c31af7Sopenharmony_ci		TYPE_UINT8,								// u8vec3
567e5c31af7Sopenharmony_ci		TYPE_UINT8,								// u8vec4
568e5c31af7Sopenharmony_ci		TYPE_INT8,								// int8_t
569e5c31af7Sopenharmony_ci		TYPE_INT8,								// i8vec2
570e5c31af7Sopenharmony_ci		TYPE_INT8,								// i8vec3
571e5c31af7Sopenharmony_ci		TYPE_INT8,								// i8vec4
572e5c31af7Sopenharmony_ci		TYPE_UINT16,							// uint16_t
573e5c31af7Sopenharmony_ci		TYPE_UINT16,							// u16vec2
574e5c31af7Sopenharmony_ci		TYPE_UINT16,							// u16vec3
575e5c31af7Sopenharmony_ci		TYPE_UINT16,							// u16vec4
576e5c31af7Sopenharmony_ci		TYPE_INT16,								// int16_t
577e5c31af7Sopenharmony_ci		TYPE_INT16,								// i16vec2
578e5c31af7Sopenharmony_ci		TYPE_INT16,								// i16vec3
579e5c31af7Sopenharmony_ci		TYPE_INT16,								// i16vec4
580e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// float16_t
581e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16vec2
582e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16vec3
583e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16vec4
584e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat2
585e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat2x3
586e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat2x4
587e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat3x2
588e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat3
589e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat3x4
590e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat4x2
591e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat4x3
592e5c31af7Sopenharmony_ci		TYPE_FLOAT16,							// f16mat4
593e5c31af7Sopenharmony_ci	};
594e5c31af7Sopenharmony_ci
595e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_scalarTypes) == TYPE_LAST);
596e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_scalarTypes)));
597e5c31af7Sopenharmony_ci	return s_scalarTypes[(int)dataType];
598e5c31af7Sopenharmony_ci}
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_ciDataType getDataTypeFloat16Scalars (DataType dataType)
601e5c31af7Sopenharmony_ci{
602e5c31af7Sopenharmony_ci	static const DataType s_floatTypes[] =
603e5c31af7Sopenharmony_ci	{
604e5c31af7Sopenharmony_ci		TYPE_INVALID,			// invalid
605e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// float
606e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// vec2
607e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// vec3
608e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// vec4
609e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2,		// mat2
610e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X3,	// mat2x3
611e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X4,	// mat2x4
612e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X2,	// mat3x2
613e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3,		// mat3
614e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X4,	// mat3x4
615e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X2,	// mat4x2
616e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X3,	// mat4x3
617e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4,		// mat4
618e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// double
619e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// dvec2
620e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// dvec3
621e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// dvec4
622e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2,		// dmat2
623e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X3,	// dmat2x3
624e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X4,	// dmat2x4
625e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X2,	// dmat3x2
626e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3,		// dmat3
627e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X4,	// dmat3x4
628e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X2,	// dmat4x2
629e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X3,	// dmat4x3
630e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4,		// dmat4
631e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// int
632e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// ivec2
633e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// ivec3
634e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// ivec4
635e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// uint
636e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// uvec2
637e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// uvec3
638e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// uvec4
639e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// bool
640e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// bvec2
641e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// bvec3
642e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// bvec4
643e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler1D
644e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2D
645e5c31af7Sopenharmony_ci		TYPE_INVALID,			// samplerCube
646e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler1DArray
647e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2DArray
648e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler3D
649e5c31af7Sopenharmony_ci		TYPE_INVALID,			// samplerCubeArray
650e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler1DShadow
651e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2DShadow
652e5c31af7Sopenharmony_ci		TYPE_INVALID,			// samplerCubeShadow
653e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler1DArrayShadow
654e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2DArrayShadow
655e5c31af7Sopenharmony_ci		TYPE_INVALID,			// samplerCubeArrayShadow
656e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler1D
657e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler2D
658e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isamplerCube
659e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler1DArray
660e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler2DArray
661e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler3D
662e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isamplerCubeArray
663e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler1D
664e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler2D
665e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usamplerCube
666e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler1DArray
667e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler2DArray
668e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler3D
669e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usamplerCubeArray
670e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2DMS
671e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler2DMS
672e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler2DMS
673e5c31af7Sopenharmony_ci		TYPE_INVALID,			// image2D
674e5c31af7Sopenharmony_ci		TYPE_INVALID,			// imageCube
675e5c31af7Sopenharmony_ci		TYPE_INVALID,			// image2DArray
676e5c31af7Sopenharmony_ci		TYPE_INVALID,			// image3D
677e5c31af7Sopenharmony_ci		TYPE_INVALID,			// imageCubeArray
678e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimage2D
679e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimageCube
680e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimage2DArray
681e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimage3D
682e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimageCubeArray
683e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimage2D
684e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimageCube
685e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimage2DArray
686e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimage3D
687e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimageCubeArray
688e5c31af7Sopenharmony_ci		TYPE_INVALID,			// atomic_uint
689e5c31af7Sopenharmony_ci		TYPE_INVALID,			// samplerBuffer
690e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isamplerBuffer
691e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usamplerBuffer
692e5c31af7Sopenharmony_ci		TYPE_INVALID,			// sampler2DMSArray
693e5c31af7Sopenharmony_ci		TYPE_INVALID,			// isampler2DMSArray
694e5c31af7Sopenharmony_ci		TYPE_INVALID,			// usampler2DMSArray
695e5c31af7Sopenharmony_ci		TYPE_INVALID,			// imageBuffer
696e5c31af7Sopenharmony_ci		TYPE_INVALID,			// iimageBuffer
697e5c31af7Sopenharmony_ci		TYPE_INVALID,			// uimageBuffer
698e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// uint8_t
699e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// u8vec2
700e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// u8vec3
701e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// u8vec4
702e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// int8_t
703e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// i8vec2
704e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// i8vec3
705e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// i8vec4
706e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// uint16_t
707e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// u16vec2
708e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// u16vec3
709e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// u16vec4
710e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// int16_t
711e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// i16vec2
712e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// i16vec3
713e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// i16vec4
714e5c31af7Sopenharmony_ci		TYPE_FLOAT16,			// float16_t
715e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC2,		// f16vec2
716e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC3,		// f16vec3
717e5c31af7Sopenharmony_ci		TYPE_FLOAT16_VEC4,		// f16vec4
718e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2,		// f16mat2
719e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X3,	// f16mat2x3
720e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT2X4,	// f16mat2x4
721e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X2,	// f16mat3x2
722e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3,		// f16mat3
723e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT3X4,	// f16mat3x4
724e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X2,	// f16mat4x2
725e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4X3,	// f16mat4x3
726e5c31af7Sopenharmony_ci		TYPE_FLOAT16_MAT4,		// f16mat4
727e5c31af7Sopenharmony_ci	};
728e5c31af7Sopenharmony_ci
729e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == TYPE_LAST);
730e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_floatTypes)));
731e5c31af7Sopenharmony_ci	return s_floatTypes[(int)dataType];
732e5c31af7Sopenharmony_ci}
733e5c31af7Sopenharmony_ci
734e5c31af7Sopenharmony_ciDataType getDataTypeFloatScalars (DataType dataType)
735e5c31af7Sopenharmony_ci{
736e5c31af7Sopenharmony_ci	static const DataType s_floatTypes[] =
737e5c31af7Sopenharmony_ci	{
738e5c31af7Sopenharmony_ci		TYPE_INVALID,		// invalid
739e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// float
740e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// vec2
741e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// vec3
742e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// vec4
743e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2,	// mat2
744e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X3,	// mat2x3
745e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X4,	// mat2x4
746e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X2,	// mat3x2
747e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3,	// mat3
748e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X4,	// mat3x4
749e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X2,	// mat4x2
750e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X3,	// mat4x3
751e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4,	// mat4
752e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// double
753e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// dvec2
754e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// dvec3
755e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// dvec4
756e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2,	// dmat2
757e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X3,	// dmat2x3
758e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X4,	// dmat2x4
759e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X2,	// dmat3x2
760e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3,	// dmat3
761e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X4,	// dmat3x4
762e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X2,	// dmat4x2
763e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X3,	// dmat4x3
764e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4,	// dmat4
765e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// int
766e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// ivec2
767e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// ivec3
768e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// ivec4
769e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// uint
770e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// uvec2
771e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// uvec3
772e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// uvec4
773e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// bool
774e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// bvec2
775e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// bvec3
776e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// bvec4
777e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1D
778e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2D
779e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCube
780e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DArray
781e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DArray
782e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler3D
783e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeArray
784e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DShadow
785e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DShadow
786e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeShadow
787e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DArrayShadow
788e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DArrayShadow
789e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeArrayShadow
790e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler1D
791e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2D
792e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerCube
793e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler1DArray
794e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DArray
795e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler3D
796e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerCubeArray
797e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler1D
798e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2D
799e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerCube
800e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler1DArray
801e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DArray
802e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler3D
803e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerCubeArray
804e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DMS
805e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DMS
806e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DMS
807e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image2D
808e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageCube
809e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image2DArray
810e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image3D
811e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageCubeArray
812e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage2D
813e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageCube
814e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage2DArray
815e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage3D
816e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageCubeArray
817e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage2D
818e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageCube
819e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage2DArray
820e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage3D
821e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageCubeArray
822e5c31af7Sopenharmony_ci		TYPE_INVALID,		// atomic_uint
823e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerBuffer
824e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerBuffer
825e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerBuffer
826e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DMSArray
827e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DMSArray
828e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DMSArray
829e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageBuffer
830e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageBuffer
831e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageBuffer
832e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// uint8_t
833e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// u8vec2
834e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// u8vec3
835e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// u8vec4
836e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// int8_t
837e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// i8vec2
838e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// i8vec3
839e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// i8vec4
840e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// uint16_t
841e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// u16vec2
842e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// u16vec3
843e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// u16vec4
844e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// int16_t
845e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// i16vec2
846e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// i16vec3
847e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// i16vec4
848e5c31af7Sopenharmony_ci		TYPE_FLOAT,			// float16_t
849e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC2,	// f16vec2
850e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC3,	// f16vec3
851e5c31af7Sopenharmony_ci		TYPE_FLOAT_VEC4,	// f16vec4
852e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2,	// f16mat2
853e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X3,	// f16mat2x3
854e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT2X4,	// f16mat2x4
855e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X2,	// f16mat3x2
856e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3,	// f16mat3
857e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT3X4,	// f16mat3x4
858e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X2,	// f16mat4x2
859e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4X3,	// f16mat4x3
860e5c31af7Sopenharmony_ci		TYPE_FLOAT_MAT4,	// f16mat4
861e5c31af7Sopenharmony_ci	};
862e5c31af7Sopenharmony_ci
863e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == TYPE_LAST);
864e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_floatTypes)));
865e5c31af7Sopenharmony_ci	return s_floatTypes[(int)dataType];
866e5c31af7Sopenharmony_ci}
867e5c31af7Sopenharmony_ci
868e5c31af7Sopenharmony_ciDataType getDataTypeDoubleScalars (DataType dataType)
869e5c31af7Sopenharmony_ci{
870e5c31af7Sopenharmony_ci	static const DataType s_doubleTypes[] =
871e5c31af7Sopenharmony_ci	{
872e5c31af7Sopenharmony_ci		TYPE_INVALID,		// invalid
873e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// float
874e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// vec2
875e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// vec3
876e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// vec4
877e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2,	// mat2
878e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X3,	// mat2x3
879e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X4,	// mat2x4
880e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X2,	// mat3x2
881e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3,	// mat3
882e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X4,	// mat3x4
883e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X2,	// mat4x2
884e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X3,	// mat4x3
885e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4,	// mat4
886e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// double
887e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// dvec2
888e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// dvec3
889e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// dvec4
890e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2,	// dmat2
891e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X3,	// dmat2x3
892e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X4,	// dmat2x4
893e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X2,	// dmat3x2
894e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3,	// dmat3
895e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X4,	// dmat3x4
896e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X2,	// dmat4x2
897e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X3,	// dmat4x3
898e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4,	// dmat4
899e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// int
900e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// ivec2
901e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// ivec3
902e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// ivec4
903e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// uint
904e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// uvec2
905e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// uvec3
906e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// uvec4
907e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// bool
908e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// bvec2
909e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// bvec3
910e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// bvec4
911e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1D
912e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2D
913e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCube
914e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DArray
915e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DArray
916e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler3D
917e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeArray
918e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DShadow
919e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DShadow
920e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeShadow
921e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler1DArrayShadow
922e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DArrayShadow
923e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerCubeArrayShadow
924e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler1D
925e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2D
926e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerCube
927e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler1DArray
928e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DArray
929e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler3D
930e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerCubeArray
931e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler1D
932e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2D
933e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerCube
934e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler1DArray
935e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DArray
936e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler3D
937e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerCubeArray
938e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DMS
939e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DMS
940e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DMS
941e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image2D
942e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageCube
943e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image2DArray
944e5c31af7Sopenharmony_ci		TYPE_INVALID,		// image3D
945e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageCubeArray
946e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage2D
947e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageCube
948e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage2DArray
949e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimage3D
950e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageCubeArray
951e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage2D
952e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageCube
953e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage2DArray
954e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimage3D
955e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageCubeArray
956e5c31af7Sopenharmony_ci		TYPE_INVALID,		// atomic_uint
957e5c31af7Sopenharmony_ci		TYPE_INVALID,		// samplerBuffer
958e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isamplerBuffer
959e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usamplerBuffer
960e5c31af7Sopenharmony_ci		TYPE_INVALID,		// sampler2DMSArray
961e5c31af7Sopenharmony_ci		TYPE_INVALID,		// isampler2DMSArray
962e5c31af7Sopenharmony_ci		TYPE_INVALID,		// usampler2DMSArray
963e5c31af7Sopenharmony_ci		TYPE_INVALID,		// imageBuffer
964e5c31af7Sopenharmony_ci		TYPE_INVALID,		// iimageBuffer
965e5c31af7Sopenharmony_ci		TYPE_INVALID,		// uimageBuffer
966e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// uint18_t
967e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// u8vec2
968e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// u8vec3
969e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// u8vec4
970e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// int8_t
971e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// i8vec2
972e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// i8vec3
973e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// i8vec4
974e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// uint16_t
975e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// u16vec2
976e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// u16vec3
977e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// u16vec4
978e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// int16_t
979e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// i16vec2
980e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// i16vec3
981e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// i16vec4
982e5c31af7Sopenharmony_ci		TYPE_DOUBLE,		// float16_t
983e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC2,	// f16vec2
984e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC3,	// f16vec3
985e5c31af7Sopenharmony_ci		TYPE_DOUBLE_VEC4,	// f16vec4
986e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2,	// f16mat2
987e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X3,	// f16mat2x3
988e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT2X4,	// f16mat2x4
989e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X2,	// f16mat3x2
990e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3,	// f16mat3
991e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT3X4,	// f16mat3x4
992e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X2,	// f16mat4x2
993e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4X3,	// f16mat4x3
994e5c31af7Sopenharmony_ci		TYPE_DOUBLE_MAT4,	// f16mat4
995e5c31af7Sopenharmony_ci	};
996e5c31af7Sopenharmony_ci
997e5c31af7Sopenharmony_ci	DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_doubleTypes) == TYPE_LAST);
998e5c31af7Sopenharmony_ci	DE_ASSERT(deInBounds32((int)dataType, 0, DE_LENGTH_OF_ARRAY(s_doubleTypes)));
999e5c31af7Sopenharmony_ci	return s_doubleTypes[(int)dataType];
1000e5c31af7Sopenharmony_ci}
1001e5c31af7Sopenharmony_ci
1002e5c31af7Sopenharmony_ciDataType getDataTypeVector (DataType scalarType, int size)
1003e5c31af7Sopenharmony_ci{
1004e5c31af7Sopenharmony_ci	DE_ASSERT(deInRange32(size, 1, 4));
1005e5c31af7Sopenharmony_ci	switch (scalarType)
1006e5c31af7Sopenharmony_ci	{
1007e5c31af7Sopenharmony_ci		case TYPE_FLOAT:
1008e5c31af7Sopenharmony_ci		case TYPE_DOUBLE:
1009e5c31af7Sopenharmony_ci		case TYPE_INT:
1010e5c31af7Sopenharmony_ci		case TYPE_UINT:
1011e5c31af7Sopenharmony_ci		case TYPE_BOOL:
1012e5c31af7Sopenharmony_ci		case TYPE_UINT8:
1013e5c31af7Sopenharmony_ci		case TYPE_INT8:
1014e5c31af7Sopenharmony_ci		case TYPE_UINT16:
1015e5c31af7Sopenharmony_ci		case TYPE_INT16:
1016e5c31af7Sopenharmony_ci		case TYPE_FLOAT16:
1017e5c31af7Sopenharmony_ci			return (DataType)((int)scalarType + size - 1);
1018e5c31af7Sopenharmony_ci		default:
1019e5c31af7Sopenharmony_ci			return TYPE_INVALID;
1020e5c31af7Sopenharmony_ci	}
1021e5c31af7Sopenharmony_ci}
1022e5c31af7Sopenharmony_ci
1023e5c31af7Sopenharmony_ciDataType getDataTypeFloatVec (int vecSize)
1024e5c31af7Sopenharmony_ci{
1025e5c31af7Sopenharmony_ci	return getDataTypeVector(TYPE_FLOAT, vecSize);
1026e5c31af7Sopenharmony_ci}
1027e5c31af7Sopenharmony_ci
1028e5c31af7Sopenharmony_ciDataType getDataTypeIntVec (int vecSize)
1029e5c31af7Sopenharmony_ci{
1030e5c31af7Sopenharmony_ci	return getDataTypeVector(TYPE_INT, vecSize);
1031e5c31af7Sopenharmony_ci}
1032e5c31af7Sopenharmony_ci
1033e5c31af7Sopenharmony_ciDataType getDataTypeUintVec (int vecSize)
1034e5c31af7Sopenharmony_ci{
1035e5c31af7Sopenharmony_ci	return getDataTypeVector(TYPE_UINT, vecSize);
1036e5c31af7Sopenharmony_ci}
1037e5c31af7Sopenharmony_ci
1038e5c31af7Sopenharmony_ciDataType getDataTypeBoolVec (int vecSize)
1039e5c31af7Sopenharmony_ci{
1040e5c31af7Sopenharmony_ci	return getDataTypeVector(TYPE_BOOL, vecSize);
1041e5c31af7Sopenharmony_ci}
1042e5c31af7Sopenharmony_ci
1043e5c31af7Sopenharmony_ciDataType getDataTypeMatrix (int numCols, int numRows)
1044e5c31af7Sopenharmony_ci{
1045e5c31af7Sopenharmony_ci	DE_ASSERT(de::inRange(numCols, 2, 4) && de::inRange(numRows, 2, 4));
1046e5c31af7Sopenharmony_ci	return (DataType)((int)TYPE_FLOAT_MAT2 + (numCols-2)*3 + (numRows-2));
1047e5c31af7Sopenharmony_ci}
1048e5c31af7Sopenharmony_ci
1049e5c31af7Sopenharmony_ciint getDataTypeMatrixNumRows (DataType dataType)
1050e5c31af7Sopenharmony_ci{
1051e5c31af7Sopenharmony_ci	switch (dataType)
1052e5c31af7Sopenharmony_ci	{
1053e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2:		return 2;
1054e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X3:		return 3;
1055e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X4:		return 4;
1056e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X2:		return 2;
1057e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3:		return 3;
1058e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X4:		return 4;
1059e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X2:		return 2;
1060e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X3:		return 3;
1061e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4:		return 4;
1062e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2:		return 2;
1063e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X3:	return 3;
1064e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X4:	return 4;
1065e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X2:	return 2;
1066e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3:		return 3;
1067e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X4:	return 4;
1068e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X2:	return 2;
1069e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X3:	return 3;
1070e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4:		return 4;
1071e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2:		return 2;
1072e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X3:	return 3;
1073e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X4:	return 4;
1074e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X2:	return 2;
1075e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3:		return 3;
1076e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X4:	return 4;
1077e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X2:	return 2;
1078e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X3:	return 3;
1079e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4:		return 4;
1080e5c31af7Sopenharmony_ci		default:
1081e5c31af7Sopenharmony_ci			DE_ASSERT(false);
1082e5c31af7Sopenharmony_ci			return 0;
1083e5c31af7Sopenharmony_ci	}
1084e5c31af7Sopenharmony_ci}
1085e5c31af7Sopenharmony_ci
1086e5c31af7Sopenharmony_ciint getDataTypeMatrixNumColumns (DataType dataType)
1087e5c31af7Sopenharmony_ci{
1088e5c31af7Sopenharmony_ci	switch (dataType)
1089e5c31af7Sopenharmony_ci	{
1090e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2:		return 2;
1091e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X3:		return 2;
1092e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X4:		return 2;
1093e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X2:		return 3;
1094e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3:		return 3;
1095e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X4:		return 3;
1096e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X2:		return 4;
1097e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X3:		return 4;
1098e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4:		return 4;
1099e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2:		return 2;
1100e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X3:	return 2;
1101e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X4:	return 2;
1102e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X2:	return 3;
1103e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3:		return 3;
1104e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X4:	return 3;
1105e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X2:	return 4;
1106e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X3:	return 4;
1107e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4:		return 4;
1108e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2:		return 2;
1109e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X3:	return 2;
1110e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X4:	return 2;
1111e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X2:	return 3;
1112e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3:		return 3;
1113e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X4:	return 3;
1114e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X2:	return 4;
1115e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X3:	return 4;
1116e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4:		return 4;
1117e5c31af7Sopenharmony_ci		default:
1118e5c31af7Sopenharmony_ci			DE_ASSERT(false);
1119e5c31af7Sopenharmony_ci			return 0;
1120e5c31af7Sopenharmony_ci	}
1121e5c31af7Sopenharmony_ci}
1122e5c31af7Sopenharmony_ci
1123e5c31af7Sopenharmony_ciDataType getDataTypeMatrixColumnType (DataType dataType)
1124e5c31af7Sopenharmony_ci{
1125e5c31af7Sopenharmony_ci	switch (dataType)
1126e5c31af7Sopenharmony_ci	{
1127e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2:		return TYPE_FLOAT_VEC2;
1128e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X3:		return TYPE_FLOAT_VEC3;
1129e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT2X4:		return TYPE_FLOAT_VEC4;
1130e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X2:		return TYPE_FLOAT_VEC2;
1131e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3:		return TYPE_FLOAT_VEC3;
1132e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT3X4:		return TYPE_FLOAT_VEC4;
1133e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X2:		return TYPE_FLOAT_VEC2;
1134e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4X3:		return TYPE_FLOAT_VEC3;
1135e5c31af7Sopenharmony_ci		case TYPE_FLOAT_MAT4:		return TYPE_FLOAT_VEC4;
1136e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2:		return TYPE_DOUBLE_VEC2;
1137e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X3:	return TYPE_DOUBLE_VEC3;
1138e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT2X4:	return TYPE_DOUBLE_VEC4;
1139e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X2:	return TYPE_DOUBLE_VEC2;
1140e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3:		return TYPE_DOUBLE_VEC3;
1141e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT3X4:	return TYPE_DOUBLE_VEC4;
1142e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X2:	return TYPE_DOUBLE_VEC2;
1143e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4X3:	return TYPE_DOUBLE_VEC3;
1144e5c31af7Sopenharmony_ci		case TYPE_DOUBLE_MAT4:		return TYPE_DOUBLE_VEC4;
1145e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2:		return TYPE_FLOAT16_VEC2;
1146e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X3:	return TYPE_FLOAT16_VEC3;
1147e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT2X4:	return TYPE_FLOAT16_VEC4;
1148e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X2:	return TYPE_FLOAT16_VEC2;
1149e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3:		return TYPE_FLOAT16_VEC3;
1150e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT3X4:	return TYPE_FLOAT16_VEC4;
1151e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X2:	return TYPE_FLOAT16_VEC2;
1152e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4X3:	return TYPE_FLOAT16_VEC3;
1153e5c31af7Sopenharmony_ci		case TYPE_FLOAT16_MAT4:		return TYPE_FLOAT16_VEC4;
1154e5c31af7Sopenharmony_ci		default:
1155e5c31af7Sopenharmony_ci			DE_ASSERT(false);
1156e5c31af7Sopenharmony_ci			return TYPE_INVALID;
1157e5c31af7Sopenharmony_ci	}
1158e5c31af7Sopenharmony_ci}
1159e5c31af7Sopenharmony_ci
1160e5c31af7Sopenharmony_ciint	getDataTypeNumLocations	(DataType dataType)
1161e5c31af7Sopenharmony_ci{
1162e5c31af7Sopenharmony_ci	if (isDataTypeScalarOrVector(dataType))
1163e5c31af7Sopenharmony_ci		return 1;
1164e5c31af7Sopenharmony_ci	else if (isDataTypeMatrix(dataType))
1165e5c31af7Sopenharmony_ci		return getDataTypeMatrixNumColumns(dataType);
1166e5c31af7Sopenharmony_ci
1167e5c31af7Sopenharmony_ci	DE_FATAL("Illegal datatype.");
1168e5c31af7Sopenharmony_ci	return 0;
1169e5c31af7Sopenharmony_ci}
1170e5c31af7Sopenharmony_ci
1171e5c31af7Sopenharmony_ciint	getDataTypeNumComponents (DataType dataType)
1172e5c31af7Sopenharmony_ci{
1173e5c31af7Sopenharmony_ci	if (isDataTypeScalarOrVector(dataType))
1174e5c31af7Sopenharmony_ci		return getDataTypeScalarSize(dataType);
1175e5c31af7Sopenharmony_ci	else if (isDataTypeMatrix(dataType))
1176e5c31af7Sopenharmony_ci		return getDataTypeMatrixNumRows(dataType);
1177e5c31af7Sopenharmony_ci
1178e5c31af7Sopenharmony_ci	DE_FATAL("Illegal datatype.");
1179e5c31af7Sopenharmony_ci	return 0;
1180e5c31af7Sopenharmony_ci}
1181e5c31af7Sopenharmony_ci
1182e5c31af7Sopenharmony_ciDataType getDataTypeFromGLType (deUint32 glType)
1183e5c31af7Sopenharmony_ci{
1184e5c31af7Sopenharmony_ci	switch (glType)
1185e5c31af7Sopenharmony_ci	{
1186e5c31af7Sopenharmony_ci		case GL_FLOAT:										return TYPE_FLOAT;
1187e5c31af7Sopenharmony_ci		case GL_FLOAT_VEC2:									return TYPE_FLOAT_VEC2;
1188e5c31af7Sopenharmony_ci		case GL_FLOAT_VEC3:									return TYPE_FLOAT_VEC3;
1189e5c31af7Sopenharmony_ci		case GL_FLOAT_VEC4:									return TYPE_FLOAT_VEC4;
1190e5c31af7Sopenharmony_ci
1191e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT2:									return TYPE_FLOAT_MAT2;
1192e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT2x3:								return TYPE_FLOAT_MAT2X3;
1193e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT2x4:								return TYPE_FLOAT_MAT2X4;
1194e5c31af7Sopenharmony_ci
1195e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT3x2:								return TYPE_FLOAT_MAT3X2;
1196e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT3:									return TYPE_FLOAT_MAT3;
1197e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT3x4:								return TYPE_FLOAT_MAT3X4;
1198e5c31af7Sopenharmony_ci
1199e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT4x2:								return TYPE_FLOAT_MAT4X2;
1200e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT4x3:								return TYPE_FLOAT_MAT4X3;
1201e5c31af7Sopenharmony_ci		case GL_FLOAT_MAT4:									return TYPE_FLOAT_MAT4;
1202e5c31af7Sopenharmony_ci
1203e5c31af7Sopenharmony_ci		case GL_DOUBLE:										return TYPE_DOUBLE;
1204e5c31af7Sopenharmony_ci		case GL_DOUBLE_VEC2:								return TYPE_DOUBLE_VEC2;
1205e5c31af7Sopenharmony_ci		case GL_DOUBLE_VEC3:								return TYPE_DOUBLE_VEC3;
1206e5c31af7Sopenharmony_ci		case GL_DOUBLE_VEC4:								return TYPE_DOUBLE_VEC4;
1207e5c31af7Sopenharmony_ci
1208e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT2:								return TYPE_DOUBLE_MAT2;
1209e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT2x3:								return TYPE_DOUBLE_MAT2X3;
1210e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT2x4:								return TYPE_DOUBLE_MAT2X4;
1211e5c31af7Sopenharmony_ci
1212e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT3x2:								return TYPE_DOUBLE_MAT3X2;
1213e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT3:								return TYPE_DOUBLE_MAT3;
1214e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT3x4:								return TYPE_DOUBLE_MAT3X4;
1215e5c31af7Sopenharmony_ci
1216e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT4x2:								return TYPE_DOUBLE_MAT4X2;
1217e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT4x3:								return TYPE_DOUBLE_MAT4X3;
1218e5c31af7Sopenharmony_ci		case GL_DOUBLE_MAT4:								return TYPE_DOUBLE_MAT4;
1219e5c31af7Sopenharmony_ci
1220e5c31af7Sopenharmony_ci		case GL_INT:										return TYPE_INT;
1221e5c31af7Sopenharmony_ci		case GL_INT_VEC2:									return TYPE_INT_VEC2;
1222e5c31af7Sopenharmony_ci		case GL_INT_VEC3:									return TYPE_INT_VEC3;
1223e5c31af7Sopenharmony_ci		case GL_INT_VEC4:									return TYPE_INT_VEC4;
1224e5c31af7Sopenharmony_ci
1225e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT:								return TYPE_UINT;
1226e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_VEC2:							return TYPE_UINT_VEC2;
1227e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_VEC3:							return TYPE_UINT_VEC3;
1228e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_VEC4:							return TYPE_UINT_VEC4;
1229e5c31af7Sopenharmony_ci
1230e5c31af7Sopenharmony_ci		case GL_BOOL:										return TYPE_BOOL;
1231e5c31af7Sopenharmony_ci		case GL_BOOL_VEC2:									return TYPE_BOOL_VEC2;
1232e5c31af7Sopenharmony_ci		case GL_BOOL_VEC3:									return TYPE_BOOL_VEC3;
1233e5c31af7Sopenharmony_ci		case GL_BOOL_VEC4:									return TYPE_BOOL_VEC4;
1234e5c31af7Sopenharmony_ci
1235e5c31af7Sopenharmony_ci		case GL_SAMPLER_1D:									return TYPE_SAMPLER_1D;
1236e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D:									return TYPE_SAMPLER_2D;
1237e5c31af7Sopenharmony_ci		case GL_SAMPLER_CUBE:								return TYPE_SAMPLER_CUBE;
1238e5c31af7Sopenharmony_ci		case GL_SAMPLER_1D_ARRAY:							return TYPE_SAMPLER_1D_ARRAY;
1239e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D_ARRAY:							return TYPE_SAMPLER_2D_ARRAY;
1240e5c31af7Sopenharmony_ci		case GL_SAMPLER_3D:									return TYPE_SAMPLER_3D;
1241e5c31af7Sopenharmony_ci		case GL_SAMPLER_CUBE_MAP_ARRAY:						return TYPE_SAMPLER_CUBE_ARRAY;
1242e5c31af7Sopenharmony_ci
1243e5c31af7Sopenharmony_ci		case GL_SAMPLER_1D_SHADOW:							return TYPE_SAMPLER_1D_SHADOW;
1244e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D_SHADOW:							return TYPE_SAMPLER_2D_SHADOW;
1245e5c31af7Sopenharmony_ci		case GL_SAMPLER_CUBE_SHADOW:						return TYPE_SAMPLER_CUBE_SHADOW;
1246e5c31af7Sopenharmony_ci		case GL_SAMPLER_1D_ARRAY_SHADOW:					return TYPE_SAMPLER_1D_ARRAY_SHADOW;
1247e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D_ARRAY_SHADOW:					return TYPE_SAMPLER_2D_ARRAY_SHADOW;
1248e5c31af7Sopenharmony_ci		case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW:				return TYPE_SAMPLER_CUBE_ARRAY_SHADOW;
1249e5c31af7Sopenharmony_ci
1250e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_1D:								return TYPE_INT_SAMPLER_1D;
1251e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_2D:								return TYPE_INT_SAMPLER_2D;
1252e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_CUBE:							return TYPE_INT_SAMPLER_CUBE;
1253e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_1D_ARRAY:						return TYPE_INT_SAMPLER_1D_ARRAY;
1254e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_2D_ARRAY:						return TYPE_INT_SAMPLER_2D_ARRAY;
1255e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_3D:								return TYPE_INT_SAMPLER_3D;
1256e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_CUBE_MAP_ARRAY:					return TYPE_INT_SAMPLER_CUBE_ARRAY;
1257e5c31af7Sopenharmony_ci
1258e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_1D:					return TYPE_UINT_SAMPLER_1D;
1259e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_2D:					return TYPE_UINT_SAMPLER_2D;
1260e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_CUBE:					return TYPE_UINT_SAMPLER_CUBE;
1261e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:				return TYPE_UINT_SAMPLER_1D_ARRAY;
1262e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:				return TYPE_UINT_SAMPLER_2D_ARRAY;
1263e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_3D:					return TYPE_UINT_SAMPLER_3D;
1264e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY:		return TYPE_UINT_SAMPLER_CUBE_ARRAY;
1265e5c31af7Sopenharmony_ci
1266e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D_MULTISAMPLE:						return TYPE_SAMPLER_2D_MULTISAMPLE;
1267e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_2D_MULTISAMPLE:					return TYPE_INT_SAMPLER_2D_MULTISAMPLE;
1268e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:		return TYPE_UINT_SAMPLER_2D_MULTISAMPLE;
1269e5c31af7Sopenharmony_ci
1270e5c31af7Sopenharmony_ci		case GL_IMAGE_2D:									return TYPE_IMAGE_2D;
1271e5c31af7Sopenharmony_ci		case GL_IMAGE_CUBE:									return TYPE_IMAGE_CUBE;
1272e5c31af7Sopenharmony_ci		case GL_IMAGE_2D_ARRAY:								return TYPE_IMAGE_2D_ARRAY;
1273e5c31af7Sopenharmony_ci		case GL_IMAGE_3D:									return TYPE_IMAGE_3D;
1274e5c31af7Sopenharmony_ci		case GL_INT_IMAGE_2D:								return TYPE_INT_IMAGE_2D;
1275e5c31af7Sopenharmony_ci		case GL_INT_IMAGE_CUBE:								return TYPE_INT_IMAGE_CUBE;
1276e5c31af7Sopenharmony_ci		case GL_INT_IMAGE_2D_ARRAY:							return TYPE_INT_IMAGE_2D_ARRAY;
1277e5c31af7Sopenharmony_ci		case GL_INT_IMAGE_3D:								return TYPE_INT_IMAGE_3D;
1278e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_IMAGE_2D:						return TYPE_UINT_IMAGE_2D;
1279e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_IMAGE_CUBE:					return TYPE_UINT_IMAGE_CUBE;
1280e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:				return TYPE_UINT_IMAGE_2D_ARRAY;
1281e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_IMAGE_3D:						return TYPE_UINT_IMAGE_3D;
1282e5c31af7Sopenharmony_ci
1283e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_ATOMIC_COUNTER:				return TYPE_UINT_ATOMIC_COUNTER;
1284e5c31af7Sopenharmony_ci
1285e5c31af7Sopenharmony_ci		case GL_SAMPLER_BUFFER:								return TYPE_SAMPLER_BUFFER;
1286e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_BUFFER:							return TYPE_INT_SAMPLER_BUFFER;
1287e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_BUFFER:				return TYPE_UINT_SAMPLER_BUFFER;
1288e5c31af7Sopenharmony_ci
1289e5c31af7Sopenharmony_ci		case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:				return TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY;
1290e5c31af7Sopenharmony_ci		case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:			return TYPE_INT_SAMPLER_2D_MULTISAMPLE_ARRAY;
1291e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:	return TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY;
1292e5c31af7Sopenharmony_ci
1293e5c31af7Sopenharmony_ci		case GL_IMAGE_BUFFER:								return TYPE_IMAGE_BUFFER;
1294e5c31af7Sopenharmony_ci		case GL_INT_IMAGE_BUFFER:							return TYPE_INT_IMAGE_BUFFER;
1295e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_IMAGE_BUFFER:					return TYPE_UINT_IMAGE_BUFFER;
1296e5c31af7Sopenharmony_ci
1297e5c31af7Sopenharmony_ci		default:
1298e5c31af7Sopenharmony_ci			return TYPE_LAST;
1299e5c31af7Sopenharmony_ci	}
1300e5c31af7Sopenharmony_ci}
1301e5c31af7Sopenharmony_ci
1302e5c31af7Sopenharmony_ci} // glu
1303