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 Reference context utils
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "sglrReferenceUtils.hpp"
25e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_cinamespace sglr
28e5c31af7Sopenharmony_ci{
29e5c31af7Sopenharmony_cinamespace rr_util
30e5c31af7Sopenharmony_ci{
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_cirr::VertexAttribType mapGLPureIntegerVertexAttributeType (deUint32 type)
33e5c31af7Sopenharmony_ci{
34e5c31af7Sopenharmony_ci	switch (type)
35e5c31af7Sopenharmony_ci	{
36e5c31af7Sopenharmony_ci		case GL_UNSIGNED_BYTE:					return rr::VERTEXATTRIBTYPE_PURE_UINT8;
37e5c31af7Sopenharmony_ci		case GL_UNSIGNED_SHORT:					return rr::VERTEXATTRIBTYPE_PURE_UINT16;
38e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT:					return rr::VERTEXATTRIBTYPE_PURE_UINT32;
39e5c31af7Sopenharmony_ci		case GL_BYTE:							return rr::VERTEXATTRIBTYPE_PURE_INT8;
40e5c31af7Sopenharmony_ci		case GL_SHORT:							return rr::VERTEXATTRIBTYPE_PURE_INT16;
41e5c31af7Sopenharmony_ci		case GL_INT:							return rr::VERTEXATTRIBTYPE_PURE_INT32;
42e5c31af7Sopenharmony_ci		default:
43e5c31af7Sopenharmony_ci			DE_ASSERT(false);
44e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_LAST;
45e5c31af7Sopenharmony_ci	}
46e5c31af7Sopenharmony_ci}
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_cirr::VertexAttribType mapGLFloatVertexAttributeType (deUint32 type, bool normalizedInteger, int size, glu::ContextType ctxType)
49e5c31af7Sopenharmony_ci{
50e5c31af7Sopenharmony_ci	const bool useClampingNormalization	= (ctxType.getProfile() == glu::PROFILE_ES && ctxType.getMajorVersion() >= 3) ||
51e5c31af7Sopenharmony_ci										  (ctxType.getMajorVersion() == 4 && ctxType.getMinorVersion() >= 2);
52e5c31af7Sopenharmony_ci	const bool bgraComponentOrder		= (size == GL_BGRA);
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_ci	switch (type)
55e5c31af7Sopenharmony_ci	{
56e5c31af7Sopenharmony_ci		case GL_FLOAT:
57e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_FLOAT;
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ci		case GL_HALF_FLOAT:
60e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_HALF;
61e5c31af7Sopenharmony_ci
62e5c31af7Sopenharmony_ci		case GL_FIXED:
63e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_FIXED;
64e5c31af7Sopenharmony_ci
65e5c31af7Sopenharmony_ci		case GL_DOUBLE:
66e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_DOUBLE;
67e5c31af7Sopenharmony_ci
68e5c31af7Sopenharmony_ci		case GL_UNSIGNED_BYTE:
69e5c31af7Sopenharmony_ci			if (!normalizedInteger)
70e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UINT8;
71e5c31af7Sopenharmony_ci			else
72e5c31af7Sopenharmony_ci				return (!bgraComponentOrder) ? (rr::VERTEXATTRIBTYPE_NONPURE_UNORM8) : (rr::VERTEXATTRIBTYPE_NONPURE_UNORM8_BGRA);
73e5c31af7Sopenharmony_ci
74e5c31af7Sopenharmony_ci		case GL_UNSIGNED_SHORT:
75e5c31af7Sopenharmony_ci			if (!normalizedInteger)
76e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UINT16;
77e5c31af7Sopenharmony_ci			else
78e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UNORM16;
79e5c31af7Sopenharmony_ci
80e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT:
81e5c31af7Sopenharmony_ci			if (!normalizedInteger)
82e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UINT32;
83e5c31af7Sopenharmony_ci			else
84e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UNORM32;
85e5c31af7Sopenharmony_ci
86e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT_2_10_10_10_REV:
87e5c31af7Sopenharmony_ci			if (!normalizedInteger)
88e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_UINT_2_10_10_10_REV;
89e5c31af7Sopenharmony_ci			else
90e5c31af7Sopenharmony_ci				return (!bgraComponentOrder) ? (rr::VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV) : (rr::VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA);
91e5c31af7Sopenharmony_ci
92e5c31af7Sopenharmony_ci		case GL_BYTE:
93e5c31af7Sopenharmony_ci			if (!normalizedInteger)
94e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_INT8;
95e5c31af7Sopenharmony_ci			else if (useClampingNormalization)
96e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM8_CLAMP;
97e5c31af7Sopenharmony_ci			else
98e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM8_SCALE;
99e5c31af7Sopenharmony_ci
100e5c31af7Sopenharmony_ci		case GL_SHORT:
101e5c31af7Sopenharmony_ci			if (!normalizedInteger)
102e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_INT16;
103e5c31af7Sopenharmony_ci			else if (useClampingNormalization)
104e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM16_CLAMP;
105e5c31af7Sopenharmony_ci			else
106e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM16_SCALE;
107e5c31af7Sopenharmony_ci
108e5c31af7Sopenharmony_ci		case GL_INT:
109e5c31af7Sopenharmony_ci			if (!normalizedInteger)
110e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_INT32;
111e5c31af7Sopenharmony_ci			else if (useClampingNormalization)
112e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM32_CLAMP;
113e5c31af7Sopenharmony_ci			else
114e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_SNORM32_SCALE;
115e5c31af7Sopenharmony_ci
116e5c31af7Sopenharmony_ci		case GL_INT_2_10_10_10_REV:
117e5c31af7Sopenharmony_ci			if (!normalizedInteger)
118e5c31af7Sopenharmony_ci				return rr::VERTEXATTRIBTYPE_NONPURE_INT_2_10_10_10_REV;
119e5c31af7Sopenharmony_ci			else if (useClampingNormalization)
120e5c31af7Sopenharmony_ci				return (!bgraComponentOrder) ? (rr::VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP) : (rr::VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA);
121e5c31af7Sopenharmony_ci			else
122e5c31af7Sopenharmony_ci				return (!bgraComponentOrder) ? (rr::VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE) : (rr::VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA);
123e5c31af7Sopenharmony_ci
124e5c31af7Sopenharmony_ci		default:
125e5c31af7Sopenharmony_ci			DE_ASSERT(false);
126e5c31af7Sopenharmony_ci			return rr::VERTEXATTRIBTYPE_LAST;
127e5c31af7Sopenharmony_ci	}
128e5c31af7Sopenharmony_ci}
129e5c31af7Sopenharmony_ci
130e5c31af7Sopenharmony_ciint mapGLSize (int size)
131e5c31af7Sopenharmony_ci{
132e5c31af7Sopenharmony_ci	switch (size)
133e5c31af7Sopenharmony_ci	{
134e5c31af7Sopenharmony_ci		case 1:			return 1;
135e5c31af7Sopenharmony_ci		case 2:			return 2;
136e5c31af7Sopenharmony_ci		case 3:			return 3;
137e5c31af7Sopenharmony_ci		case 4:			return 4;
138e5c31af7Sopenharmony_ci		case GL_BGRA:	return 4;
139e5c31af7Sopenharmony_ci
140e5c31af7Sopenharmony_ci		default:
141e5c31af7Sopenharmony_ci			DE_ASSERT(false);
142e5c31af7Sopenharmony_ci			return 0;
143e5c31af7Sopenharmony_ci	}
144e5c31af7Sopenharmony_ci}
145e5c31af7Sopenharmony_ci
146e5c31af7Sopenharmony_cirr::PrimitiveType mapGLPrimitiveType (deUint32 type)
147e5c31af7Sopenharmony_ci{
148e5c31af7Sopenharmony_ci	switch (type)
149e5c31af7Sopenharmony_ci	{
150e5c31af7Sopenharmony_ci		case GL_TRIANGLES:					return rr::PRIMITIVETYPE_TRIANGLES;
151e5c31af7Sopenharmony_ci		case GL_TRIANGLE_STRIP:				return rr::PRIMITIVETYPE_TRIANGLE_STRIP;
152e5c31af7Sopenharmony_ci		case GL_TRIANGLE_FAN:				return rr::PRIMITIVETYPE_TRIANGLE_FAN;
153e5c31af7Sopenharmony_ci		case GL_LINES:						return rr::PRIMITIVETYPE_LINES;
154e5c31af7Sopenharmony_ci		case GL_LINE_STRIP:					return rr::PRIMITIVETYPE_LINE_STRIP;
155e5c31af7Sopenharmony_ci		case GL_LINE_LOOP:					return rr::PRIMITIVETYPE_LINE_LOOP;
156e5c31af7Sopenharmony_ci		case GL_POINTS:						return rr::PRIMITIVETYPE_POINTS;
157e5c31af7Sopenharmony_ci		case GL_LINES_ADJACENCY:			return rr::PRIMITIVETYPE_LINES_ADJACENCY;
158e5c31af7Sopenharmony_ci		case GL_LINE_STRIP_ADJACENCY:		return rr::PRIMITIVETYPE_LINE_STRIP_ADJACENCY;
159e5c31af7Sopenharmony_ci		case GL_TRIANGLES_ADJACENCY:		return rr::PRIMITIVETYPE_TRIANGLES_ADJACENCY;
160e5c31af7Sopenharmony_ci		case GL_TRIANGLE_STRIP_ADJACENCY:	return rr::PRIMITIVETYPE_TRIANGLE_STRIP_ADJACENCY;
161e5c31af7Sopenharmony_ci		default:
162e5c31af7Sopenharmony_ci			DE_ASSERT(false);
163e5c31af7Sopenharmony_ci			return rr::PRIMITIVETYPE_LAST;
164e5c31af7Sopenharmony_ci	}
165e5c31af7Sopenharmony_ci}
166e5c31af7Sopenharmony_ci
167e5c31af7Sopenharmony_cirr::IndexType mapGLIndexType (deUint32 type)
168e5c31af7Sopenharmony_ci{
169e5c31af7Sopenharmony_ci	switch (type)
170e5c31af7Sopenharmony_ci	{
171e5c31af7Sopenharmony_ci		case GL_UNSIGNED_BYTE:	return rr::INDEXTYPE_UINT8;
172e5c31af7Sopenharmony_ci		case GL_UNSIGNED_SHORT:	return rr::INDEXTYPE_UINT16;
173e5c31af7Sopenharmony_ci		case GL_UNSIGNED_INT:	return rr::INDEXTYPE_UINT32;
174e5c31af7Sopenharmony_ci		default:
175e5c31af7Sopenharmony_ci			DE_ASSERT(false);
176e5c31af7Sopenharmony_ci			return rr::INDEXTYPE_LAST;
177e5c31af7Sopenharmony_ci	}
178e5c31af7Sopenharmony_ci}
179e5c31af7Sopenharmony_ci
180e5c31af7Sopenharmony_ci
181e5c31af7Sopenharmony_cirr::GeometryShaderOutputType mapGLGeometryShaderOutputType (deUint32 primitive)
182e5c31af7Sopenharmony_ci{
183e5c31af7Sopenharmony_ci	switch (primitive)
184e5c31af7Sopenharmony_ci	{
185e5c31af7Sopenharmony_ci		case GL_POINTS:				return rr::GEOMETRYSHADEROUTPUTTYPE_POINTS;
186e5c31af7Sopenharmony_ci		case GL_LINE_STRIP:			return rr::GEOMETRYSHADEROUTPUTTYPE_LINE_STRIP;
187e5c31af7Sopenharmony_ci		case GL_TRIANGLE_STRIP:		return rr::GEOMETRYSHADEROUTPUTTYPE_TRIANGLE_STRIP;
188e5c31af7Sopenharmony_ci		default:
189e5c31af7Sopenharmony_ci			DE_ASSERT(DE_FALSE);
190e5c31af7Sopenharmony_ci			return rr::GEOMETRYSHADEROUTPUTTYPE_LAST;
191e5c31af7Sopenharmony_ci	}
192e5c31af7Sopenharmony_ci}
193e5c31af7Sopenharmony_ci
194e5c31af7Sopenharmony_cirr::GeometryShaderInputType mapGLGeometryShaderInputType (deUint32 primitive)
195e5c31af7Sopenharmony_ci{
196e5c31af7Sopenharmony_ci	switch (primitive)
197e5c31af7Sopenharmony_ci	{
198e5c31af7Sopenharmony_ci		case GL_POINTS:						return rr::GEOMETRYSHADERINPUTTYPE_POINTS;
199e5c31af7Sopenharmony_ci		case GL_LINES:						return rr::GEOMETRYSHADERINPUTTYPE_LINES;
200e5c31af7Sopenharmony_ci		case GL_LINE_STRIP:					return rr::GEOMETRYSHADERINPUTTYPE_LINES;
201e5c31af7Sopenharmony_ci		case GL_LINE_LOOP:					return rr::GEOMETRYSHADERINPUTTYPE_LINES;
202e5c31af7Sopenharmony_ci		case GL_TRIANGLES:					return rr::GEOMETRYSHADERINPUTTYPE_TRIANGLES;
203e5c31af7Sopenharmony_ci		case GL_TRIANGLE_STRIP:				return rr::GEOMETRYSHADERINPUTTYPE_TRIANGLES;
204e5c31af7Sopenharmony_ci		case GL_TRIANGLE_FAN:				return rr::GEOMETRYSHADERINPUTTYPE_TRIANGLES;
205e5c31af7Sopenharmony_ci		case GL_LINES_ADJACENCY:			return rr::GEOMETRYSHADERINPUTTYPE_LINES_ADJACENCY;
206e5c31af7Sopenharmony_ci		case GL_LINE_STRIP_ADJACENCY:		return rr::GEOMETRYSHADERINPUTTYPE_LINES_ADJACENCY;
207e5c31af7Sopenharmony_ci		case GL_TRIANGLES_ADJACENCY:		return rr::GEOMETRYSHADERINPUTTYPE_TRIANGLES_ADJACENCY;
208e5c31af7Sopenharmony_ci		case GL_TRIANGLE_STRIP_ADJACENCY:	return rr::GEOMETRYSHADERINPUTTYPE_TRIANGLES_ADJACENCY;
209e5c31af7Sopenharmony_ci		default:
210e5c31af7Sopenharmony_ci			DE_ASSERT(DE_FALSE);
211e5c31af7Sopenharmony_ci			return rr::GEOMETRYSHADERINPUTTYPE_LAST;
212e5c31af7Sopenharmony_ci	}
213e5c31af7Sopenharmony_ci}
214e5c31af7Sopenharmony_ci
215e5c31af7Sopenharmony_cirr::TestFunc mapGLTestFunc (deUint32 func)
216e5c31af7Sopenharmony_ci{
217e5c31af7Sopenharmony_ci	switch (func)
218e5c31af7Sopenharmony_ci	{
219e5c31af7Sopenharmony_ci		case GL_ALWAYS:		return rr::TESTFUNC_ALWAYS;
220e5c31af7Sopenharmony_ci		case GL_EQUAL:		return rr::TESTFUNC_EQUAL;
221e5c31af7Sopenharmony_ci		case GL_GEQUAL:		return rr::TESTFUNC_GEQUAL;
222e5c31af7Sopenharmony_ci		case GL_GREATER:	return rr::TESTFUNC_GREATER;
223e5c31af7Sopenharmony_ci		case GL_LEQUAL:		return rr::TESTFUNC_LEQUAL;
224e5c31af7Sopenharmony_ci		case GL_LESS:		return rr::TESTFUNC_LESS;
225e5c31af7Sopenharmony_ci		case GL_NEVER:		return rr::TESTFUNC_NEVER;
226e5c31af7Sopenharmony_ci		case GL_NOTEQUAL:	return rr::TESTFUNC_NOTEQUAL;
227e5c31af7Sopenharmony_ci		default:
228e5c31af7Sopenharmony_ci			DE_ASSERT(false);
229e5c31af7Sopenharmony_ci			return rr::TESTFUNC_LAST;
230e5c31af7Sopenharmony_ci	}
231e5c31af7Sopenharmony_ci}
232e5c31af7Sopenharmony_ci
233e5c31af7Sopenharmony_cirr::StencilOp mapGLStencilOp (deUint32 op)
234e5c31af7Sopenharmony_ci{
235e5c31af7Sopenharmony_ci	switch (op)
236e5c31af7Sopenharmony_ci	{
237e5c31af7Sopenharmony_ci		case GL_KEEP:		return rr::STENCILOP_KEEP;
238e5c31af7Sopenharmony_ci		case GL_ZERO:		return rr::STENCILOP_ZERO;
239e5c31af7Sopenharmony_ci		case GL_REPLACE:	return rr::STENCILOP_REPLACE;
240e5c31af7Sopenharmony_ci		case GL_INCR:		return rr::STENCILOP_INCR;
241e5c31af7Sopenharmony_ci		case GL_DECR:		return rr::STENCILOP_DECR;
242e5c31af7Sopenharmony_ci		case GL_INCR_WRAP:	return rr::STENCILOP_INCR_WRAP;
243e5c31af7Sopenharmony_ci		case GL_DECR_WRAP:	return rr::STENCILOP_DECR_WRAP;
244e5c31af7Sopenharmony_ci		case GL_INVERT:		return rr::STENCILOP_INVERT;
245e5c31af7Sopenharmony_ci		default:
246e5c31af7Sopenharmony_ci			DE_ASSERT(false);
247e5c31af7Sopenharmony_ci			return rr::STENCILOP_LAST;
248e5c31af7Sopenharmony_ci	}
249e5c31af7Sopenharmony_ci}
250e5c31af7Sopenharmony_ci
251e5c31af7Sopenharmony_cirr::BlendEquation mapGLBlendEquation (deUint32 equation)
252e5c31af7Sopenharmony_ci{
253e5c31af7Sopenharmony_ci	switch (equation)
254e5c31af7Sopenharmony_ci	{
255e5c31af7Sopenharmony_ci		case GL_FUNC_ADD:				return rr::BLENDEQUATION_ADD;
256e5c31af7Sopenharmony_ci		case GL_FUNC_SUBTRACT:			return rr::BLENDEQUATION_SUBTRACT;
257e5c31af7Sopenharmony_ci		case GL_FUNC_REVERSE_SUBTRACT:	return rr::BLENDEQUATION_REVERSE_SUBTRACT;
258e5c31af7Sopenharmony_ci		case GL_MIN:					return rr::BLENDEQUATION_MIN;
259e5c31af7Sopenharmony_ci		case GL_MAX:					return rr::BLENDEQUATION_MAX;
260e5c31af7Sopenharmony_ci		default:
261e5c31af7Sopenharmony_ci			DE_ASSERT(false);
262e5c31af7Sopenharmony_ci			return rr::BLENDEQUATION_LAST;
263e5c31af7Sopenharmony_ci	}
264e5c31af7Sopenharmony_ci}
265e5c31af7Sopenharmony_ci
266e5c31af7Sopenharmony_cirr::BlendEquationAdvanced mapGLBlendEquationAdvanced (deUint32 equation)
267e5c31af7Sopenharmony_ci{
268e5c31af7Sopenharmony_ci	switch (equation)
269e5c31af7Sopenharmony_ci	{
270e5c31af7Sopenharmony_ci		case GL_MULTIPLY_KHR:		return rr::BLENDEQUATION_ADVANCED_MULTIPLY;
271e5c31af7Sopenharmony_ci		case GL_SCREEN_KHR:			return rr::BLENDEQUATION_ADVANCED_SCREEN;
272e5c31af7Sopenharmony_ci		case GL_OVERLAY_KHR:		return rr::BLENDEQUATION_ADVANCED_OVERLAY;
273e5c31af7Sopenharmony_ci		case GL_DARKEN_KHR:			return rr::BLENDEQUATION_ADVANCED_DARKEN;
274e5c31af7Sopenharmony_ci		case GL_LIGHTEN_KHR:		return rr::BLENDEQUATION_ADVANCED_LIGHTEN;
275e5c31af7Sopenharmony_ci		case GL_COLORDODGE_KHR:		return rr::BLENDEQUATION_ADVANCED_COLORDODGE;
276e5c31af7Sopenharmony_ci		case GL_COLORBURN_KHR:		return rr::BLENDEQUATION_ADVANCED_COLORBURN;
277e5c31af7Sopenharmony_ci		case GL_HARDLIGHT_KHR:		return rr::BLENDEQUATION_ADVANCED_HARDLIGHT;
278e5c31af7Sopenharmony_ci		case GL_SOFTLIGHT_KHR:		return rr::BLENDEQUATION_ADVANCED_SOFTLIGHT;
279e5c31af7Sopenharmony_ci		case GL_DIFFERENCE_KHR:		return rr::BLENDEQUATION_ADVANCED_DIFFERENCE;
280e5c31af7Sopenharmony_ci		case GL_EXCLUSION_KHR:		return rr::BLENDEQUATION_ADVANCED_EXCLUSION;
281e5c31af7Sopenharmony_ci		case GL_HSL_HUE_KHR:		return rr::BLENDEQUATION_ADVANCED_HSL_HUE;
282e5c31af7Sopenharmony_ci		case GL_HSL_SATURATION_KHR:	return rr::BLENDEQUATION_ADVANCED_HSL_SATURATION;
283e5c31af7Sopenharmony_ci		case GL_HSL_COLOR_KHR:		return rr::BLENDEQUATION_ADVANCED_HSL_COLOR;
284e5c31af7Sopenharmony_ci		case GL_HSL_LUMINOSITY_KHR:	return rr::BLENDEQUATION_ADVANCED_HSL_LUMINOSITY;
285e5c31af7Sopenharmony_ci		default:
286e5c31af7Sopenharmony_ci			DE_ASSERT(false);
287e5c31af7Sopenharmony_ci			return rr::BLENDEQUATION_ADVANCED_LAST;
288e5c31af7Sopenharmony_ci	}
289e5c31af7Sopenharmony_ci}
290e5c31af7Sopenharmony_ci
291e5c31af7Sopenharmony_cirr::BlendFunc mapGLBlendFunc (deUint32 func)
292e5c31af7Sopenharmony_ci{
293e5c31af7Sopenharmony_ci	switch (func)
294e5c31af7Sopenharmony_ci	{
295e5c31af7Sopenharmony_ci		case GL_ZERO:						return rr::BLENDFUNC_ZERO;
296e5c31af7Sopenharmony_ci		case GL_ONE:						return rr::BLENDFUNC_ONE;
297e5c31af7Sopenharmony_ci		case GL_SRC_COLOR:					return rr::BLENDFUNC_SRC_COLOR;
298e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_SRC_COLOR:		return rr::BLENDFUNC_ONE_MINUS_SRC_COLOR;
299e5c31af7Sopenharmony_ci		case GL_DST_COLOR:					return rr::BLENDFUNC_DST_COLOR;
300e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_DST_COLOR:		return rr::BLENDFUNC_ONE_MINUS_DST_COLOR;
301e5c31af7Sopenharmony_ci		case GL_SRC_ALPHA:					return rr::BLENDFUNC_SRC_ALPHA;
302e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_SRC_ALPHA:		return rr::BLENDFUNC_ONE_MINUS_SRC_ALPHA;
303e5c31af7Sopenharmony_ci		case GL_DST_ALPHA:					return rr::BLENDFUNC_DST_ALPHA;
304e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_DST_ALPHA:		return rr::BLENDFUNC_ONE_MINUS_DST_ALPHA;
305e5c31af7Sopenharmony_ci		case GL_CONSTANT_COLOR:				return rr::BLENDFUNC_CONSTANT_COLOR;
306e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_CONSTANT_COLOR:	return rr::BLENDFUNC_ONE_MINUS_CONSTANT_COLOR;
307e5c31af7Sopenharmony_ci		case GL_CONSTANT_ALPHA:				return rr::BLENDFUNC_CONSTANT_ALPHA;
308e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_CONSTANT_ALPHA:	return rr::BLENDFUNC_ONE_MINUS_CONSTANT_ALPHA;
309e5c31af7Sopenharmony_ci		case GL_SRC_ALPHA_SATURATE:			return rr::BLENDFUNC_SRC_ALPHA_SATURATE;
310e5c31af7Sopenharmony_ci		case GL_SRC1_COLOR:					return rr::BLENDFUNC_SRC1_COLOR;
311e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_SRC1_COLOR:		return rr::BLENDFUNC_ONE_MINUS_SRC1_COLOR;
312e5c31af7Sopenharmony_ci		case GL_SRC1_ALPHA:					return rr::BLENDFUNC_SRC1_ALPHA;
313e5c31af7Sopenharmony_ci		case GL_ONE_MINUS_SRC1_ALPHA:		return rr::BLENDFUNC_ONE_MINUS_SRC1_ALPHA;
314e5c31af7Sopenharmony_ci		default:
315e5c31af7Sopenharmony_ci			DE_ASSERT(false);
316e5c31af7Sopenharmony_ci			return rr::BLENDFUNC_LAST;
317e5c31af7Sopenharmony_ci	}
318e5c31af7Sopenharmony_ci}
319e5c31af7Sopenharmony_ci
320e5c31af7Sopenharmony_ci} // rr_util
321e5c31af7Sopenharmony_ci} // sglr
322