1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 **************************************************************************/
26 #include "main/mtypes.h"
27 #include "main/context.h"
28 #include "main/imports.h"
32 const GLubyte
* GLAPIENTRY
_es_GetString(GLenum name
);
36 append_extension(char **str
, const char *ext
)
39 size_t len
= strlen(ext
);
57 make_extension_string(const GLcontext
*ctx
, char *str
)
61 len
+= append_extension(&str
, "GL_OES_compressed_paletted_texture");
63 if (ctx
->Extensions
.ARB_framebuffer_object
) {
64 len
+= append_extension(&str
, "GL_OES_depth24");
65 len
+= append_extension(&str
, "GL_OES_depth32");
66 len
+= append_extension(&str
, "GL_OES_fbo_render_mipmap");
67 len
+= append_extension(&str
, "GL_OES_rgb8_rgba8");
68 len
+= append_extension(&str
, "GL_OES_stencil1");
69 len
+= append_extension(&str
, "GL_OES_stencil4");
72 if (ctx
->Extensions
.EXT_vertex_array
)
73 len
+= append_extension(&str
, "GL_OES_element_index_uint");
74 if (ctx
->Extensions
.ARB_vertex_buffer_object
)
75 len
+= append_extension(&str
, "GL_OES_mapbuffer");
77 if (ctx
->Extensions
.EXT_texture3D
)
78 len
+= append_extension(&str
, "GL_OES_texture_3D");
79 if (ctx
->Extensions
.ARB_texture_non_power_of_two
)
80 len
+= append_extension(&str
, "GL_OES_texture_npot");
81 if (ctx
->Extensions
.EXT_texture_filter_anisotropic
)
82 len
+= append_extension(&str
, "GL_EXT_texture_filter_anisotropic");
84 len
+= append_extension(&str
, "GL_EXT_texture_type_2_10_10_10_REV");
85 if (ctx
->Extensions
.ARB_depth_texture
)
86 len
+= append_extension(&str
, "GL_OES_depth_texture");
87 if (ctx
->Extensions
.EXT_packed_depth_stencil
)
88 len
+= append_extension(&str
, "GL_OES_packed_depth_stencil");
89 if (ctx
->Extensions
.ARB_fragment_shader
)
90 len
+= append_extension(&str
, "GL_OES_standard_derivatives");
92 if (ctx
->Extensions
.EXT_texture_compression_s3tc
)
93 len
+= append_extension(&str
, "GL_EXT_texture_compression_dxt1");
94 if (ctx
->Extensions
.EXT_blend_minmax
)
95 len
+= append_extension(&str
, "GL_EXT_blend_minmax");
96 if (ctx
->Extensions
.EXT_multi_draw_arrays
)
97 len
+= append_extension(&str
, "GL_EXT_multi_draw_arrays");
99 #if FEATURE_OES_EGL_image
100 if (ctx
->Extensions
.OES_EGL_image
)
101 len
+= append_extension(&str
, "GL_OES_EGL_image");
108 static const GLubyte
*
109 compute_es_extensions(void)
111 GET_CURRENT_CONTEXT(ctx
);
113 if (!ctx
->Extensions
.String
) {
117 len
= make_extension_string(ctx
, NULL
);
118 s
= (char *) malloc(len
+ 1);
121 make_extension_string(ctx
, s
);
122 ctx
->Extensions
.String
= (const GLubyte
*) s
;
125 return ctx
->Extensions
.String
;
128 const GLubyte
* GLAPIENTRY
129 _es_GetString(GLenum name
)
132 case GL_SHADING_LANGUAGE_VERSION
:
133 return (const GLubyte
*) "OpenGL ES GLSL ES 1.0.16";
135 return compute_es_extensions();
137 return _mesa_GetString(name
);