• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2018 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "GLTestUtils.h"
16 
17 using android::AlignedBuf;
18 
19 namespace gfxstream {
20 
RowMatches(int rowIndex,size_t rowBytes,unsigned char * expected,unsigned char * actual)21 testing::AssertionResult RowMatches(int rowIndex, size_t rowBytes,
22                                     unsigned char* expected, unsigned char* actual) {
23     for (size_t i = 0; i < rowBytes; ++i) {
24         if (expected[i] != actual[i]) {
25             return testing::AssertionFailure()
26                    << "row " << rowIndex << " byte " << i
27                    << " mismatch. expected: "
28                    << "(" << testing::PrintToString(expected[i])
29                    << "), actual: "
30                    << "(" << testing::PrintToString(actual[i]) << ")";
31         }
32     }
33     return testing::AssertionSuccess();
34 }
35 
ImageMatches(int width,int height,int bpp,int rowLength,unsigned char * expected,unsigned char * actual)36 testing::AssertionResult ImageMatches(int width, int height, int bpp, int rowLength,
37                                       unsigned char* expected, unsigned char* actual) {
38     int rowMismatches = 0;
39     std::stringstream rowList;
40     std::stringstream rowDetails;
41     rowList << "on ";
42     for (int i = 0; i < height * rowLength; i += rowLength) {
43         size_t rowBytes = width * bpp;
44         testing::AssertionResult rowResult = RowMatches(
45                 i / rowLength, rowBytes, expected + i * bpp, actual + i * bpp);
46         if (!rowResult) {
47             ++rowMismatches;
48             if (rowMismatches < 50) {
49                 rowList << ((rowMismatches != 1) ? ", " : "")
50                         << (i / rowLength);
51                 rowDetails << "\t" << rowResult.message() << "\n";
52             }
53             if (rowMismatches == 50) {
54                 rowList << " and more";
55                 rowDetails << "\t...";
56             }
57         }
58     }
59     if (rowMismatches) {
60         return testing::AssertionFailure()
61                << "Mismatch in image: " << rowMismatches << " rows mismatch "
62                << rowList.str() << ".\n"
63                << rowDetails.str();
64     } else {
65         return testing::AssertionSuccess();
66     }
67 }
68 
createTestPatternRGB888(int width,int height)69 TestTexture createTestPatternRGB888(int width, int height) {
70     int bpp = 3;
71 
72     TestTexture res(bpp * width * height);
73 
74     for (int i = 0; i < height; i++) {
75         for (int j = 0; j < width; j++) {
76             res[i * bpp * width + j * bpp + 0] = i % 0x100;
77             res[i * bpp * width + j * bpp + 1] = j % 0x100;
78             res[i * bpp * width + j * bpp + 2] = (i * width + j) % 0x100;
79         }
80     }
81 
82     return res;
83 }
84 
createTestPatternRGBA8888(int width,int height)85 TestTexture createTestPatternRGBA8888(int width, int height) {
86     int bpp = 4;
87 
88     TestTexture res(bpp * width * height);
89 
90     for (int i = 0; i < height; i++) {
91         for (int j = 0; j < width; j++) {
92             res[i * bpp * width + j * bpp + 0] = i % 0x100;
93             res[i * bpp * width + j * bpp + 1] = j % 0x100;
94             res[i * bpp * width + j * bpp + 2] = (i * width + j) % 0x100;
95             res[i * bpp * width + j * bpp + 3] = (width - j) % 0x100;
96         }
97     }
98 
99     return res;
100 }
101 
clamp(float x,float low,float high)102 static float clamp(float x, float low, float high) {
103     if (x < low) return low;
104     if (x > high) return high;
105     return x;
106 }
107 
createTestTextureRGB888SingleColor(int width,int height,float r,float g,float b)108 TestTexture createTestTextureRGB888SingleColor(int width, int height, float r, float g, float b) {
109     int bpp = 3;
110 
111     TestTexture res(bpp * width * height);
112 
113     for (int i = 0; i < height; i++) {
114         for (int j = 0; j < width; j++) {
115             res[i * bpp * width + j * bpp + 0] = clamp(r, 0.0f, 1.0f) * 255.0f;
116             res[i * bpp * width + j * bpp + 1] = clamp(g, 0.0f, 1.0f) * 255.0f;
117             res[i * bpp * width + j * bpp + 2] = clamp(b, 0.0f, 1.0f) * 255.0f;
118         }
119     }
120 
121     return res;
122 }
123 
createTestTextureRGBA8888SingleColor(int width,int height,float r,float g,float b,float a)124 TestTexture createTestTextureRGBA8888SingleColor(int width, int height, float r, float g, float b, float a) {
125     int bpp = 4;
126 
127     TestTexture res(bpp * width * height);
128 
129     for (int i = 0; i < height; i++) {
130         for (int j = 0; j < width; j++) {
131             res[i * bpp * width + j * bpp + 0] = clamp(r, 0.0f, 1.0f) * 255.0f;
132             res[i * bpp * width + j * bpp + 1] = clamp(g, 0.0f, 1.0f) * 255.0f;
133             res[i * bpp * width + j * bpp + 2] = clamp(b, 0.0f, 1.0f) * 255.0f;
134             res[i * bpp * width + j * bpp + 3] = clamp(a, 0.0f, 1.0f) * 255.0f;
135         }
136     }
137 
138     return res;
139 }
140 
getEnumString(GLenum v)141 const char* getEnumString(GLenum v) {
142     switch (v) {
143         case 0x0000: return "GL_ZERO/GL_NO_ERROR/GL_POINTS";
144         case 0x0001: return "GL_ONE/GL_LINES";
145         case 0x0002: return "GL_LINE_LOOP";
146         case 0x0003: return "GL_LINE_STRIP";
147         case 0x0004: return "GL_TRIANGLES";
148         case 0x0005: return "GL_TRIANGLE_STRIP";
149         case 0x0006: return "GL_TRIANGLE_FAN";
150         case 0x0100: return "GL_DEPTH_BUFFER_BIT";
151         case 0x0104: return "GL_ADD";
152         case 0x0200: return "GL_NEVER";
153         case 0x0201: return "GL_LESS";
154         case 0x0202: return "GL_EQUAL";
155         case 0x0203: return "GL_LEQUAL";
156         case 0x0204: return "GL_GREATER";
157         case 0x0205: return "GL_NOTEQUAL";
158         case 0x0206: return "GL_GEQUAL";
159         case 0x0207: return "GL_ALWAYS";
160         case 0x0300: return "GL_SRC_COLOR";
161         case 0x0301: return "GL_ONE_MINUS_SRC_COLOR";
162         case 0x0302: return "GL_SRC_ALPHA";
163         case 0x0303: return "GL_ONE_MINUS_SRC_ALPHA";
164         case 0x0304: return "GL_DST_ALPHA";
165         case 0x0305: return "GL_ONE_MINUS_DST_ALPHA";
166         case 0x0306: return "GL_DST_COLOR";
167         case 0x0307: return "GL_ONE_MINUS_DST_COLOR";
168         case 0x0308: return "GL_SRC_ALPHA_SATURATE";
169         case 0x0400: return "GL_STENCIL_BUFFER_BIT";
170         case 0x0404: return "GL_FRONT";
171         case 0x0405: return "GL_BACK";
172         case 0x0408: return "GL_FRONT_AND_BACK";
173         case 0x0500: return "GL_INVALID_ENUM";
174         case 0x0501: return "GL_INVALID_VALUE";
175         case 0x0502: return "GL_INVALID_OPERATION";
176         case 0x0503: return "GL_STACK_OVERFLOW";
177         case 0x0504: return "GL_STACK_UNDERFLOW";
178         case 0x0505: return "GL_OUT_OF_MEMORY";
179         case 0x0506: return "GL_INVALID_FRAMEBUFFER_OPERATION";
180         case 0x0800: return "GL_EXP";
181         case 0x0801: return "GL_EXP2";
182         case 0x0900: return "GL_CW";
183         case 0x0901: return "GL_CCW";
184         case 0x0B00: return "GL_CURRENT_COLOR";
185         case 0x0B02: return "GL_CURRENT_NORMAL";
186         case 0x0B03: return "GL_CURRENT_TEXTURE_COORDS";
187         case 0x0B10: return "GL_POINT_SMOOTH";
188         case 0x0B11: return "GL_POINT_SIZE";
189         case 0x0B12: return "GL_SMOOTH_POINT_SIZE_RANGE";
190         case 0x0B20: return "GL_LINE_SMOOTH";
191         case 0x0B21: return "GL_LINE_WIDTH";
192         case 0x0B22: return "GL_SMOOTH_LINE_WIDTH_RANGE";
193         case 0x0B44: return "GL_CULL_FACE";
194         case 0x0B45: return "GL_CULL_FACE_MODE";
195         case 0x0B46: return "GL_FRONT_FACE";
196         case 0x0B50: return "GL_LIGHTING";
197         case 0x0B52: return "GL_LIGHT_MODEL_TWO_SIDE";
198         case 0x0B53: return "GL_LIGHT_MODEL_AMBIENT";
199         case 0x0B54: return "GL_SHADE_MODEL";
200         case 0x0B57: return "GL_COLOR_MATERIAL";
201         case 0x0B60: return "GL_FOG";
202         case 0x0B62: return "GL_FOG_DENSITY";
203         case 0x0B63: return "GL_FOG_START";
204         case 0x0B64: return "GL_FOG_END";
205         case 0x0B65: return "GL_FOG_MODE";
206         case 0x0B66: return "GL_FOG_COLOR";
207         case 0x0B70: return "GL_DEPTH_RANGE";
208         case 0x0B71: return "GL_DEPTH_TEST";
209         case 0x0B72: return "GL_DEPTH_WRITEMASK";
210         case 0x0B73: return "GL_DEPTH_CLEAR_VALUE";
211         case 0x0B74: return "GL_DEPTH_FUNC";
212         case 0x0B90: return "GL_STENCIL_TEST";
213         case 0x0B91: return "GL_STENCIL_CLEAR_VALUE";
214         case 0x0B92: return "GL_STENCIL_FUNC";
215         case 0x0B93: return "GL_STENCIL_VALUE_MASK";
216         case 0x0B94: return "GL_STENCIL_FAIL";
217         case 0x0B95: return "GL_STENCIL_PASS_DEPTH_FAIL";
218         case 0x0B96: return "GL_STENCIL_PASS_DEPTH_PASS";
219         case 0x0B97: return "GL_STENCIL_REF";
220         case 0x0B98: return "GL_STENCIL_WRITEMASK";
221         case 0x0BA0: return "GL_MATRIX_MODE";
222         case 0x0BA1: return "GL_NORMALIZE";
223         case 0x0BA2: return "GL_VIEWPORT";
224         case 0x0BA3: return "GL_MODELVIEW_STACK_DEPTH";
225         case 0x0BA4: return "GL_PROJECTION_STACK_DEPTH";
226         case 0x0BA5: return "GL_TEXTURE_STACK_DEPTH";
227         case 0x0BA6: return "GL_MODELVIEW_MATRIX";
228         case 0x0BA7: return "GL_PROJECTION_MATRIX";
229         case 0x0BA8: return "GL_TEXTURE_MATRIX";
230         case 0x0BC0: return "GL_ALPHA_TEST";
231         case 0x0BC1: return "GL_ALPHA_TEST_FUNC";
232         case 0x0BC2: return "GL_ALPHA_TEST_REF";
233         case 0x0BD0: return "GL_DITHER";
234         case 0x0BE0: return "GL_BLEND_DST";
235         case 0x0BE1: return "GL_BLEND_SRC";
236         case 0x0BE2: return "GL_BLEND";
237         case 0x0BF0: return "GL_LOGIC_OP_MODE";
238         case 0x0BF2: return "GL_COLOR_LOGIC_OP";
239         case 0x0C10: return "GL_SCISSOR_BOX";
240         case 0x0C11: return "GL_SCISSOR_TEST";
241         case 0x0C22: return "GL_COLOR_CLEAR_VALUE";
242         case 0x0C23: return "GL_COLOR_WRITEMASK";
243         case 0x0C50: return "GL_PERSPECTIVE_CORRECTION_HINT";
244         case 0x0C51: return "GL_POINT_SMOOTH_HINT";
245         case 0x0C52: return "GL_LINE_SMOOTH_HINT";
246         case 0x0C54: return "GL_FOG_HINT";
247         case 0x0CF5: return "GL_UNPACK_ALIGNMENT";
248         case 0x0D05: return "GL_PACK_ALIGNMENT";
249         case 0x0D1C: return "GL_ALPHA_SCALE";
250         case 0x0D31: return "GL_MAX_LIGHTS";
251         case 0x0D32: return "GL_MAX_CLIP_PLANES";
252         case 0x0D33: return "GL_MAX_TEXTURE_SIZE";
253         case 0x0D36: return "GL_MAX_MODELVIEW_STACK_DEPTH";
254         case 0x0D38: return "GL_MAX_PROJECTION_STACK_DEPTH";
255         case 0x0D39: return "GL_MAX_TEXTURE_STACK_DEPTH";
256         case 0x0D3A: return "GL_MAX_VIEWPORT_DIMS";
257         case 0x0D50: return "GL_SUBPIXEL_BITS";
258         case 0x0D52: return "GL_RED_BITS";
259         case 0x0D53: return "GL_GREEN_BITS";
260         case 0x0D54: return "GL_BLUE_BITS";
261         case 0x0D55: return "GL_ALPHA_BITS";
262         case 0x0D56: return "GL_DEPTH_BITS";
263         case 0x0D57: return "GL_STENCIL_BITS";
264         case 0x0DE1: return "GL_TEXTURE_2D";
265         case 0x1100: return "GL_DONT_CARE";
266         case 0x1101: return "GL_FASTEST";
267         case 0x1102: return "GL_NICEST";
268         case 0x1200: return "GL_AMBIENT";
269         case 0x1201: return "GL_DIFFUSE";
270         case 0x1202: return "GL_SPECULAR";
271         case 0x1203: return "GL_POSITION";
272         case 0x1204: return "GL_SPOT_DIRECTION";
273         case 0x1205: return "GL_SPOT_EXPONENT";
274         case 0x1206: return "GL_SPOT_CUTOFF";
275         case 0x1207: return "GL_CONSTANT_ATTENUATION";
276         case 0x1208: return "GL_LINEAR_ATTENUATION";
277         case 0x1209: return "GL_QUADRATIC_ATTENUATION";
278         case 0x1400: return "GL_BYTE";
279         case 0x1401: return "GL_UNSIGNED_BYTE";
280         case 0x1402: return "GL_SHORT";
281         case 0x1403: return "GL_UNSIGNED_SHORT";
282         case 0x1404: return "GL_INT";
283         case 0x1405: return "GL_UNSIGNED_INT";
284         case 0x1406: return "GL_FLOAT";
285         case 0x140C: return "GL_FIXED";
286         case 0x1500: return "GL_CLEAR";
287         case 0x1501: return "GL_AND";
288         case 0x1502: return "GL_AND_REVERSE";
289         case 0x1503: return "GL_COPY";
290         case 0x1504: return "GL_AND_INVERTED";
291         case 0x1505: return "GL_NOOP";
292         case 0x1506: return "GL_XOR";
293         case 0x1507: return "GL_OR";
294         case 0x1508: return "GL_NOR";
295         case 0x1509: return "GL_EQUIV";
296         case 0x150A: return "GL_INVERT";
297         case 0x150B: return "GL_OR_REVERSE";
298         case 0x150C: return "GL_COPY_INVERTED";
299         case 0x150D: return "GL_OR_INVERTED";
300         case 0x150E: return "GL_NAND";
301         case 0x150F: return "GL_SET";
302         case 0x1600: return "GL_EMISSION";
303         case 0x1601: return "GL_SHININESS";
304         case 0x1602: return "GL_AMBIENT_AND_DIFFUSE";
305         case 0x1700: return "GL_MODELVIEW";
306         case 0x1701: return "GL_PROJECTION";
307         case 0x1702: return "GL_TEXTURE";
308         case 0x1901: return "GL_STENCIL_INDEX";
309         case 0x1902: return "GL_DEPTH_COMPONENT";
310         case 0x1906: return "GL_ALPHA";
311         case 0x1907: return "GL_RGB";
312         case 0x1908: return "GL_RGBA";
313         case 0x1909: return "GL_LUMINANCE";
314         case 0x190A: return "GL_LUMINANCE_ALPHA";
315         case 0x1D00: return "GL_FLAT";
316         case 0x1D01: return "GL_SMOOTH";
317         case 0x1E00: return "GL_KEEP";
318         case 0x1E01: return "GL_REPLACE";
319         case 0x1E02: return "GL_INCR";
320         case 0x1E03: return "GL_DECR";
321         case 0x1F00: return "GL_VENDOR";
322         case 0x1F01: return "GL_RENDERER";
323         case 0x1F02: return "GL_VERSION";
324         case 0x1F03: return "GL_EXTENSIONS";
325         case 0x2100: return "GL_MODULATE";
326         case 0x2101: return "GL_DECAL";
327         case 0x2200: return "GL_TEXTURE_ENV_MODE";
328         case 0x2201: return "GL_TEXTURE_ENV_COLOR";
329         case 0x2300: return "GL_TEXTURE_ENV";
330         case 0x2500: return "GL_TEXTURE_GEN_MODE_OES";
331         case 0x2600: return "GL_NEAREST";
332         case 0x2601: return "GL_LINEAR";
333         case 0x2700: return "GL_NEAREST_MIPMAP_NEAREST";
334         case 0x2701: return "GL_LINEAR_MIPMAP_NEAREST";
335         case 0x2702: return "GL_NEAREST_MIPMAP_LINEAR";
336         case 0x2703: return "GL_LINEAR_MIPMAP_LINEAR";
337         case 0x2800: return "GL_TEXTURE_MAG_FILTER";
338         case 0x2801: return "GL_TEXTURE_MIN_FILTER";
339         case 0x2802: return "GL_TEXTURE_WRAP_S";
340         case 0x2803: return "GL_TEXTURE_WRAP_T";
341         case 0x2901: return "GL_REPEAT";
342         case 0x2A00: return "GL_POLYGON_OFFSET_UNITS";
343         case 0x3000: return "GL_CLIP_PLANE0";
344         case 0x3001: return "GL_CLIP_PLANE1";
345         case 0x3002: return "GL_CLIP_PLANE2";
346         case 0x3003: return "GL_CLIP_PLANE3";
347         case 0x3004: return "GL_CLIP_PLANE4";
348         case 0x3005: return "GL_CLIP_PLANE5";
349         case 0x300E: return "GL_CONTEXT_LOST";
350         case 0x4000: return "GL_LIGHT0";
351         case 0x4001: return "GL_LIGHT1";
352         case 0x4002: return "GL_LIGHT2";
353         case 0x4003: return "GL_LIGHT3";
354         case 0x4004: return "GL_LIGHT4";
355         case 0x4005: return "GL_LIGHT5";
356         case 0x4006: return "GL_LIGHT6";
357         case 0x4007: return "GL_LIGHT7";
358         case 0x8001: return "GL_CONSTANT_COLOR";
359         case 0x8002: return "GL_ONE_MINUS_CONSTANT_COLOR";
360         case 0x8003: return "GL_CONSTANT_ALPHA";
361         case 0x8004: return "GL_ONE_MINUS_CONSTANT_ALPHA";
362         case 0x8005: return "GL_BLEND_COLOR";
363         case 0x8006: return "GL_FUNC_ADD";
364         case 0x8009: return "GL_BLEND_EQUATION";
365         case 0x800A: return "GL_FUNC_SUBTRACT";
366         case 0x800B: return "GL_FUNC_REVERSE_SUBTRACT";
367         case 0x8033: return "GL_UNSIGNED_SHORT_4_4_4_4";
368         case 0x8034: return "GL_UNSIGNED_SHORT_5_5_5_1";
369         case 0x8037: return "GL_POLYGON_OFFSET_FILL";
370         case 0x8038: return "GL_POLYGON_OFFSET_FACTOR";
371         case 0x803A: return "GL_RESCALE_NORMAL";
372         case 0x8056: return "GL_RGBA4";
373         case 0x8057: return "GL_RGB5_A1";
374         case 0x8069: return "GL_TEXTURE_BINDING_2D";
375         case 0x8074: return "GL_VERTEX_ARRAY";
376         case 0x8075: return "GL_NORMAL_ARRAY";
377         case 0x8076: return "GL_COLOR_ARRAY";
378         case 0x8078: return "GL_TEXTURE_COORD_ARRAY";
379         case 0x807A: return "GL_VERTEX_ARRAY_SIZE";
380         case 0x807B: return "GL_VERTEX_ARRAY_TYPE";
381         case 0x807C: return "GL_VERTEX_ARRAY_STRIDE";
382         case 0x807E: return "GL_NORMAL_ARRAY_TYPE";
383         case 0x807F: return "GL_NORMAL_ARRAY_STRIDE";
384         case 0x8081: return "GL_COLOR_ARRAY_SIZE";
385         case 0x8082: return "GL_COLOR_ARRAY_TYPE";
386         case 0x8083: return "GL_COLOR_ARRAY_STRIDE";
387         case 0x8088: return "GL_TEXTURE_COORD_ARRAY_SIZE";
388         case 0x8089: return "GL_TEXTURE_COORD_ARRAY_TYPE";
389         case 0x808A: return "GL_TEXTURE_COORD_ARRAY_STRIDE";
390         case 0x808E: return "GL_VERTEX_ARRAY_POINTER";
391         case 0x808F: return "GL_NORMAL_ARRAY_POINTER";
392         case 0x8090: return "GL_COLOR_ARRAY_POINTER";
393         case 0x8092: return "GL_TEXTURE_COORD_ARRAY_POINTER";
394         case 0x809D: return "GL_MULTISAMPLE";
395         case 0x809E: return "GL_SAMPLE_ALPHA_TO_COVERAGE";
396         case 0x809F: return "GL_SAMPLE_ALPHA_TO_ONE";
397         case 0x80A0: return "GL_SAMPLE_COVERAGE";
398         case 0x80A8: return "GL_SAMPLE_BUFFERS";
399         case 0x80A9: return "GL_SAMPLES";
400         case 0x80AA: return "GL_SAMPLE_COVERAGE_VALUE";
401         case 0x80AB: return "GL_SAMPLE_COVERAGE_INVERT";
402         case 0x80C8: return "GL_BLEND_DST_RGB";
403         case 0x80C9: return "GL_BLEND_SRC_RGB";
404         case 0x80CA: return "GL_BLEND_DST_ALPHA";
405         case 0x80CB: return "GL_BLEND_SRC_ALPHA";
406         case 0x8126: return "GL_POINT_SIZE_MIN";
407         case 0x8127: return "GL_POINT_SIZE_MAX";
408         case 0x8128: return "GL_POINT_FADE_THRESHOLD_SIZE";
409         case 0x8129: return "GL_POINT_DISTANCE_ATTENUATION";
410         case 0x812F: return "GL_CLAMP_TO_EDGE";
411         case 0x8191: return "GL_GENERATE_MIPMAP";
412         case 0x8192: return "GL_GENERATE_MIPMAP_HINT";
413         case 0x81A5: return "GL_DEPTH_COMPONENT16";
414         case 0x81A6: return "GL_DEPTH_COMPONENT24_OES";
415         case 0x81A7: return "GL_DEPTH_COMPONENT32_OES";
416         case 0x8363: return "GL_UNSIGNED_SHORT_5_6_5";
417         case 0x8370: return "GL_MIRRORED_REPEAT";
418         case 0x846D: return "GL_ALIASED_POINT_SIZE_RANGE";
419         case 0x846E: return "GL_ALIASED_LINE_WIDTH_RANGE";
420         case 0x84C0: return "GL_TEXTURE0";
421         case 0x84C1: return "GL_TEXTURE1";
422         case 0x84C2: return "GL_TEXTURE2";
423         case 0x84C3: return "GL_TEXTURE3";
424         case 0x84C4: return "GL_TEXTURE4";
425         case 0x84C5: return "GL_TEXTURE5";
426         case 0x84C6: return "GL_TEXTURE6";
427         case 0x84C7: return "GL_TEXTURE7";
428         case 0x84C8: return "GL_TEXTURE8";
429         case 0x84C9: return "GL_TEXTURE9";
430         case 0x84CA: return "GL_TEXTURE10";
431         case 0x84CB: return "GL_TEXTURE11";
432         case 0x84CC: return "GL_TEXTURE12";
433         case 0x84CD: return "GL_TEXTURE13";
434         case 0x84CE: return "GL_TEXTURE14";
435         case 0x84CF: return "GL_TEXTURE15";
436         case 0x84D0: return "GL_TEXTURE16";
437         case 0x84D1: return "GL_TEXTURE17";
438         case 0x84D2: return "GL_TEXTURE18";
439         case 0x84D3: return "GL_TEXTURE19";
440         case 0x84D4: return "GL_TEXTURE20";
441         case 0x84D5: return "GL_TEXTURE21";
442         case 0x84D6: return "GL_TEXTURE22";
443         case 0x84D7: return "GL_TEXTURE23";
444         case 0x84D8: return "GL_TEXTURE24";
445         case 0x84D9: return "GL_TEXTURE25";
446         case 0x84DA: return "GL_TEXTURE26";
447         case 0x84DB: return "GL_TEXTURE27";
448         case 0x84DC: return "GL_TEXTURE28";
449         case 0x84DD: return "GL_TEXTURE29";
450         case 0x84DE: return "GL_TEXTURE30";
451         case 0x84DF: return "GL_TEXTURE31";
452         case 0x84E0: return "GL_ACTIVE_TEXTURE";
453         case 0x84E1: return "GL_CLIENT_ACTIVE_TEXTURE";
454         case 0x84E2: return "GL_MAX_TEXTURE_UNITS";
455         case 0x84E7: return "GL_SUBTRACT";
456         case 0x84E8: return "GL_MAX_RENDERBUFFER_SIZE";
457         case 0x8507: return "GL_INCR_WRAP";
458         case 0x8508: return "GL_DECR_WRAP";
459         case 0x8511: return "GL_NORMAL_MAP_OES";
460         case 0x8512: return "GL_REFLECTION_MAP_OES";
461         case 0x8513: return "GL_TEXTURE_CUBE_MAP_OES";
462         case 0x8514: return "GL_TEXTURE_BINDING_CUBE_MAP_OES";
463         case 0x8515: return "GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES";
464         case 0x8516: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES";
465         case 0x8517: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES";
466         case 0x8518: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES";
467         case 0x8519: return "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES";
468         case 0x851A: return "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES";
469         case 0x851C: return "GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES";
470         case 0x8570: return "GL_COMBINE";
471         case 0x8571: return "GL_COMBINE_RGB";
472         case 0x8572: return "GL_COMBINE_ALPHA";
473         case 0x8573: return "GL_RGB_SCALE";
474         case 0x8574: return "GL_ADD_SIGNED";
475         case 0x8575: return "GL_INTERPOLATE";
476         case 0x8576: return "GL_CONSTANT";
477         case 0x8577: return "GL_PRIMARY_COLOR";
478         case 0x8578: return "GL_PREVIOUS";
479         case 0x8580: return "GL_SRC0_RGB";
480         case 0x8581: return "GL_SRC1_RGB";
481         case 0x8582: return "GL_SRC2_RGB";
482         case 0x8588: return "GL_SRC0_ALPHA";
483         case 0x8589: return "GL_SRC1_ALPHA";
484         case 0x858A: return "GL_SRC2_ALPHA";
485         case 0x8590: return "GL_OPERAND0_RGB";
486         case 0x8591: return "GL_OPERAND1_RGB";
487         case 0x8592: return "GL_OPERAND2_RGB";
488         case 0x8598: return "GL_OPERAND0_ALPHA";
489         case 0x8599: return "GL_OPERAND1_ALPHA";
490         case 0x859A: return "GL_OPERAND2_ALPHA";
491         case 0x8622: return "GL_VERTEX_ATTRIB_ARRAY_ENABLED";
492         case 0x8623: return "GL_VERTEX_ATTRIB_ARRAY_SIZE";
493         case 0x8624: return "GL_VERTEX_ATTRIB_ARRAY_STRIDE";
494         case 0x8625: return "GL_VERTEX_ATTRIB_ARRAY_TYPE";
495         case 0x8626: return "GL_CURRENT_VERTEX_ATTRIB";
496         case 0x8645: return "GL_VERTEX_ATTRIB_ARRAY_POINTER";
497         case 0x86A2: return "GL_NUM_COMPRESSED_TEXTURE_FORMATS";
498         case 0x86A3: return "GL_COMPRESSED_TEXTURE_FORMATS";
499         case 0x86AE: return "GL_DOT3_RGB";
500         case 0x86AF: return "GL_DOT3_RGBA";
501         case 0x8764: return "GL_BUFFER_SIZE";
502         case 0x8765: return "GL_BUFFER_USAGE";
503         case 0x8800: return "GL_STENCIL_BACK_FUNC";
504         case 0x8801: return "GL_STENCIL_BACK_FAIL";
505         case 0x8802: return "GL_STENCIL_BACK_PASS_DEPTH_FAIL";
506         case 0x8803: return "GL_STENCIL_BACK_PASS_DEPTH_PASS";
507         case 0x883D: return "GL_BLEND_EQUATION_ALPHA";
508         case 0x8861: return "GL_POINT_SPRITE_OES";
509         case 0x8862: return "GL_COORD_REPLACE_OES";
510         case 0x8869: return "GL_MAX_VERTEX_ATTRIBS";
511         case 0x886A: return "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED";
512         case 0x8872: return "GL_MAX_TEXTURE_IMAGE_UNITS";
513         case 0x8892: return "GL_ARRAY_BUFFER";
514         case 0x8893: return "GL_ELEMENT_ARRAY_BUFFER";
515         case 0x8894: return "GL_ARRAY_BUFFER_BINDING";
516         case 0x8895: return "GL_ELEMENT_ARRAY_BUFFER_BINDING";
517         case 0x8896: return "GL_VERTEX_ARRAY_BUFFER_BINDING";
518         case 0x8897: return "GL_NORMAL_ARRAY_BUFFER_BINDING";
519         case 0x8898: return "GL_COLOR_ARRAY_BUFFER_BINDING";
520         case 0x889A: return "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING";
521         case 0x889F: return "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING";
522         case 0x88E0: return "GL_STREAM_DRAW";
523         case 0x88E4: return "GL_STATIC_DRAW";
524         case 0x88E8: return "GL_DYNAMIC_DRAW";
525         case 0x898A: return "GL_POINT_SIZE_ARRAY_TYPE_OES";
526         case 0x898B: return "GL_POINT_SIZE_ARRAY_STRIDE_OES";
527         case 0x898C: return "GL_POINT_SIZE_ARRAY_POINTER_OES";
528         case 0x8B30: return "GL_FRAGMENT_SHADER";
529         case 0x8B31: return "GL_VERTEX_SHADER";
530         case 0x8B4C: return "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS";
531         case 0x8B4D: return "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS";
532         case 0x8B4F: return "GL_SHADER_TYPE";
533         case 0x8B50: return "GL_FLOAT_VEC2";
534         case 0x8B51: return "GL_FLOAT_VEC3";
535         case 0x8B52: return "GL_FLOAT_VEC4";
536         case 0x8B53: return "GL_INT_VEC2";
537         case 0x8B54: return "GL_INT_VEC3";
538         case 0x8B55: return "GL_INT_VEC4";
539         case 0x8B56: return "GL_BOOL";
540         case 0x8B57: return "GL_BOOL_VEC2";
541         case 0x8B58: return "GL_BOOL_VEC3";
542         case 0x8B59: return "GL_BOOL_VEC4";
543         case 0x8B5A: return "GL_FLOAT_MAT2";
544         case 0x8B5B: return "GL_FLOAT_MAT3";
545         case 0x8B5C: return "GL_FLOAT_MAT4";
546         case 0x8B5E: return "GL_SAMPLER_2D";
547         case 0x8B60: return "GL_SAMPLER_CUBE";
548         case 0x8B80: return "GL_DELETE_STATUS";
549         case 0x8B81: return "GL_COMPILE_STATUS";
550         case 0x8B82: return "GL_LINK_STATUS";
551         case 0x8B83: return "GL_VALIDATE_STATUS";
552         case 0x8B84: return "GL_INFO_LOG_LENGTH";
553         case 0x8B85: return "GL_ATTACHED_SHADERS";
554         case 0x8B86: return "GL_ACTIVE_UNIFORMS";
555         case 0x8B87: return "GL_ACTIVE_UNIFORM_MAX_LENGTH";
556         case 0x8B88: return "GL_SHADER_SOURCE_LENGTH";
557         case 0x8B89: return "GL_ACTIVE_ATTRIBUTES";
558         case 0x8B8A: return "GL_ACTIVE_ATTRIBUTE_MAX_LENGTH";
559         case 0x8B8C: return "GL_SHADING_LANGUAGE_VERSION";
560         case 0x8B8D: return "GL_CURRENT_PROGRAM";
561         case 0x8B90: return "GL_PALETTE4_RGB8_OES";
562         case 0x8B91: return "GL_PALETTE4_RGBA8_OES";
563         case 0x8B92: return "GL_PALETTE4_R5_G6_B5_OES";
564         case 0x8B93: return "GL_PALETTE4_RGBA4_OES";
565         case 0x8B94: return "GL_PALETTE4_RGB5_A1_OES";
566         case 0x8B95: return "GL_PALETTE8_RGB8_OES";
567         case 0x8B96: return "GL_PALETTE8_RGBA8_OES";
568         case 0x8B97: return "GL_PALETTE8_R5_G6_B5_OES";
569         case 0x8B98: return "GL_PALETTE8_RGBA4_OES";
570         case 0x8B99: return "GL_PALETTE8_RGB5_A1_OES";
571         case 0x8B9A: return "GL_IMPLEMENTATION_COLOR_READ_TYPE";
572         case 0x8B9B: return "GL_IMPLEMENTATION_COLOR_READ_FORMAT";
573         case 0x8B9C: return "GL_POINT_SIZE_ARRAY_OES";
574         case 0x8B9D: return "GL_POINT_SIZE_ARRAY_OES";
575         case 0x8B9F: return "GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES";
576         case 0x8CA3: return "GL_STENCIL_BACK_REF";
577         case 0x8CA4: return "GL_STENCIL_BACK_VALUE_MASK";
578         case 0x8CA5: return "GL_STENCIL_BACK_WRITEMASK";
579         case 0x8CA6: return "GL_FRAMEBUFFER_BINDING";
580         case 0x8CA7: return "GL_RENDERBUFFER_BINDING";
581         case 0x8CD0: return "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE";
582         case 0x8CD1: return "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME";
583         case 0x8CD2: return "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL";
584         case 0x8CD3: return "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE";
585         case 0x8CD5: return "GL_FRAMEBUFFER_COMPLETE";
586         case 0x8CD6: return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT";
587         case 0x8CD7: return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";
588         case 0x8CD9: return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS";
589         case 0x8CDD: return "GL_FRAMEBUFFER_UNSUPPORTED";
590         case 0x8CE0: return "GL_COLOR_ATTACHMENT0";
591         case 0x8D00: return "GL_DEPTH_ATTACHMENT";
592         case 0x8D20: return "GL_STENCIL_ATTACHMENT";
593         case 0x8D40: return "GL_FRAMEBUFFER";
594         case 0x8D41: return "GL_RENDERBUFFER";
595         case 0x8D42: return "GL_RENDERBUFFER_WIDTH";
596         case 0x8D43: return "GL_RENDERBUFFER_HEIGHT";
597         case 0x8D44: return "GL_RENDERBUFFER_INTERNAL_FORMAT";
598         case 0x8D48: return "GL_STENCIL_INDEX8";
599         case 0x8D50: return "GL_RENDERBUFFER_RED_SIZE";
600         case 0x8D51: return "GL_RENDERBUFFER_GREEN_SIZE";
601         case 0x8D52: return "GL_RENDERBUFFER_BLUE_SIZE";
602         case 0x8D53: return "GL_RENDERBUFFER_ALPHA_SIZE";
603         case 0x8D54: return "GL_RENDERBUFFER_DEPTH_SIZE";
604         case 0x8D55: return "GL_RENDERBUFFER_STENCIL_SIZE";
605         case 0x8D60: return "GL_TEXTURE_GEN_STR_OES";
606         case 0x8D62: return "GL_RGB565";
607         case 0x8D64: return "GL_ETC1_RGB8_OES";
608         case 0x8D65: return "GL_TEXTURE_EXTERNAL_OES";
609         case 0x8D67: return "GL_TEXTURE_BINDING_EXTERNAL_OES";
610         case 0x8D68: return "GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES";
611         case 0x8DF0: return "GL_LOW_FLOAT";
612         case 0x8DF1: return "GL_MEDIUM_FLOAT";
613         case 0x8DF2: return "GL_HIGH_FLOAT";
614         case 0x8DF3: return "GL_LOW_INT";
615         case 0x8DF4: return "GL_MEDIUM_INT";
616         case 0x8DF5: return "GL_HIGH_INT";
617         case 0x8DF8: return "GL_SHADER_BINARY_FORMATS";
618         case 0x8DF9: return "GL_NUM_SHADER_BINARY_FORMATS";
619         case 0x8DFA: return "GL_SHADER_COMPILER";
620         case 0x8DFB: return "GL_MAX_VERTEX_UNIFORM_VECTORS";
621         case 0x8DFC: return "GL_MAX_VARYING_VECTORS";
622         case 0x8DFD: return "GL_MAX_FRAGMENT_UNIFORM_VECTORS";
623         default: return "<unknown>";
624     }
625 }
626 
627 }  // namespace gfxstream
628