mesa/swrast/st: add ARB_occlusion_query2 support.
[mesa.git] / src / mesa / main / extensions.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.6
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 #include "glheader.h"
28 #include "imports.h"
29 #include "context.h"
30 #include "extensions.h"
31 #include "mtypes.h"
32
33
34 #define F(x) offsetof(struct gl_extensions, x)
35 #define ON GL_TRUE
36 #define OFF GL_FALSE
37
38
39 /*
40 * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions.
41 */
42 static const struct {
43 GLboolean enabled;
44 const char *name;
45 int flag_offset;
46 } default_extensions[] = {
47 { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) },
48 { ON, "GL_ARB_copy_buffer", F(ARB_copy_buffer) },
49 { OFF, "GL_ARB_depth_buffer_float", F(ARB_depth_buffer_float) },
50 { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) },
51 { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) },
52 { ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
53 { OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) },
54 { OFF, "GL_ARB_draw_instanced", F(ARB_draw_instanced) },
55 { OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) },
56 { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) },
57 { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
58 { OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
59 { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
60 { OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
61 /* TODO: reenable this when the new GLSL compiler actually supports them */
62 /* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */
63 { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
64 { OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) },
65 { OFF, "GL_ARB_instanced_arrays", F(ARB_instanced_arrays) },
66 { OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) },
67 { ON, "GL_ARB_multisample", F(ARB_multisample) },
68 { OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
69 { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) },
70 { OFF, "GL_ARB_occlusion_query2", F(ARB_occlusion_query2) },
71 { OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) },
72 { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) },
73 { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) },
74 { OFF, "GL_ARB_provoking_vertex", F(EXT_provoking_vertex) },
75 { OFF, "GL_ARB_sampler_objects", F(ARB_sampler_objects) },
76 { OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) },
77 { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) },
78 { OFF, "GL_ARB_shader_stencil_export", F(ARB_shader_stencil_export) },
79 { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) },
80 { OFF, "GL_ARB_shadow", F(ARB_shadow) },
81 { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) },
82 { OFF, "GL_ARB_sync", F(ARB_sync) },
83 { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
84 { OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) },
85 { ON, "GL_ARB_texture_compression", F(ARB_texture_compression) },
86 { OFF, "GL_ARB_texture_compression_rgtc", F(ARB_texture_compression_rgtc) },
87 { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
88 { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
89 { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) },
90 { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) },
91 { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) },
92 { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) },
93 { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
94 { OFF, "GL_ARB_texture_multisample", F(ARB_texture_multisample) },
95 { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)},
96 { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) },
97 { OFF, "GL_ARB_texture_rg", F(ARB_texture_rg) },
98 { OFF, "GL_ARB_texture_rgb10_a2ui", F(ARB_texture_rgb10_a2ui) },
99 { OFF, "GL_ARB_texture_swizzle", F(EXT_texture_swizzle) },
100 { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) },
101 { OFF, "GL_ARB_transform_feedback2", F(ARB_transform_feedback2) },
102 { OFF, "GL_ARB_uniform_buffer_object", F(ARB_uniform_buffer_object) },
103 { OFF, "GL_ARB_vertex_array_bgra", F(EXT_vertex_array_bgra) },
104 { OFF, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object) },
105 { ON, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) },
106 { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) },
107 { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) },
108 { OFF, "GL_ARB_vertex_type_2_10_10_10_rev", F(ARB_vertex_type_2_10_10_10_rev) },
109 { ON, "GL_ARB_window_pos", F(ARB_window_pos) },
110 { ON, "GL_EXT_abgr", F(EXT_abgr) },
111 { ON, "GL_EXT_bgra", F(EXT_bgra) },
112 { OFF, "GL_EXT_blend_color", F(EXT_blend_color) },
113 { OFF, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate) },
114 { OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) },
115 { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) },
116 { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) },
117 { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) },
118 { OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) },
119 { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) },
120 { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
121 { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
122 { OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) },
123 { OFF, "GL_EXT_draw_instanced", F(ARB_draw_instanced) },
124 { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) },
125 { OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
126 { OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
127 { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) },
128 { OFF, "GL_EXT_framebuffer_sRGB", F(EXT_framebuffer_sRGB) },
129 { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) },
130 { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) },
131 { OFF, "GL_EXT_gpu_shader4", F(EXT_gpu_shader4) },
132 { ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) },
133 { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) },
134 { OFF, "GL_EXT_packed_float", F(EXT_packed_float) },
135 { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) },
136 { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) },
137 { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) },
138 { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) },
139 { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) },
140 { OFF, "GL_EXT_provoking_vertex", F(EXT_provoking_vertex) },
141 { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) },
142 { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) },
143 { OFF, "GL_EXT_separate_shader_objects", F(EXT_separate_shader_objects) },
144 { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) },
145 { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) },
146 { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) },
147 { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) },
148 { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) },
149 { ON, "GL_EXT_subtexture", F(EXT_subtexture) },
150 { ON, "GL_EXT_texture", F(EXT_texture) },
151 { ON, "GL_EXT_texture3D", F(EXT_texture3D) },
152 { OFF, "GL_EXT_texture_array", F(EXT_texture_array) },
153 { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
154 { OFF, "GL_EXT_texture_compression_rgtc", F(ARB_texture_compression_rgtc) },
155 { OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) },
156 { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
157 { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
158 { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) },
159 { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) },
160 { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) },
161 { OFF, "GL_EXT_texture_integer", F(EXT_texture_integer) },
162 { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) },
163 { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) },
164 { ON, "GL_EXT_texture_object", F(EXT_texture_object) },
165 { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) },
166 { OFF, "GL_EXT_texture_shared_exponent", F(EXT_texture_shared_exponent) },
167 { OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) },
168 { OFF, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle) },
169 { OFF, "GL_EXT_timer_query", F(EXT_timer_query) },
170 { OFF, "GL_EXT_transform_feedback", F(EXT_transform_feedback) },
171 { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) },
172 { OFF, "GL_EXT_vertex_array_bgra", F(EXT_vertex_array_bgra) },
173 { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) },
174 { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) },
175 { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) },
176 { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) },
177 { OFF, "GL_APPLE_vertex_array_object", F(APPLE_vertex_array_object) },
178 { OFF, "GL_APPLE_object_purgeable", F(APPLE_object_purgeable) },
179 { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) },
180 { OFF, "GL_ATI_envmap_bumpmap", F(ATI_envmap_bumpmap) },
181 { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)},
182 { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
183 { OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)},
184 { OFF, "GL_ATI_separate_stencil", F(ATI_separate_stencil)},
185 { ON, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) },
186 { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) },
187 { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
188 { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) },
189 { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) },
190 { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) },
191 { OFF, "GL_MESA_texture_array", F(MESA_texture_array) },
192 { OFF, "GL_MESA_texture_signed_rgba", F(MESA_texture_signed_rgba) },
193 { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) },
194 { ON, "GL_MESA_window_pos", F(ARB_window_pos) },
195 { OFF, "GL_NV_blend_square", F(NV_blend_square) },
196 { OFF, "GL_NV_conditional_render", F(NV_conditional_render) },
197 { OFF, "GL_NV_depth_clamp", F(ARB_depth_clamp) },
198 { OFF, "GL_NV_fragment_program", F(NV_fragment_program) },
199 { OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) },
200 { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) },
201 { OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) },
202 { OFF, "GL_NV_point_sprite", F(NV_point_sprite) },
203 { OFF, "GL_NV_primitive_restart", F(NV_primitive_restart) },
204 { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) },
205 { OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) },
206 { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) },
207 { OFF, "GL_NV_vertex_program", F(NV_vertex_program) },
208 { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) },
209 { ON, "GL_OES_read_format", F(OES_read_format) },
210 { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) },
211 { ON, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) },
212 { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) },
213 { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
214 { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) },
215 { ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) },
216 { OFF, "GL_S3_s3tc", F(S3_s3tc) },
217 { OFF, "GL_EXT_texture_format_BGRA8888", F(EXT_texture_format_BGRA8888) },
218 #if FEATURE_OES_EGL_image
219 { OFF, "GL_OES_EGL_image", F(OES_EGL_image) },
220 #endif
221 #if FEATURE_OES_draw_texture
222 { OFF, "GL_OES_draw_texture", F(OES_draw_texture) },
223 #endif /* FEATURE_OES_draw_texture */
224 };
225
226
227
228 /**
229 * Enable all extensions suitable for a software-only renderer.
230 * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
231 */
232 void
233 _mesa_enable_sw_extensions(struct gl_context *ctx)
234 {
235 /*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/
236 ctx->Extensions.ARB_depth_clamp = GL_TRUE;
237 ctx->Extensions.ARB_depth_texture = GL_TRUE;
238 /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
239 ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
240 ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
241 ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
242 #if FEATURE_ARB_fragment_program
243 ctx->Extensions.ARB_fragment_program = GL_TRUE;
244 ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
245 #endif
246 #if FEATURE_ARB_fragment_shader
247 ctx->Extensions.ARB_fragment_shader = GL_TRUE;
248 #endif
249 #if FEATURE_ARB_framebuffer_object
250 ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
251 #endif
252 #if FEATURE_ARB_geometry_shader4 && 0
253 /* XXX re-enable when GLSL compiler again supports geometry shaders */
254 ctx->Extensions.ARB_geometry_shader4 = GL_TRUE;
255 #endif
256 ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
257 ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
258 ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
259 ctx->Extensions.ARB_multitexture = GL_TRUE;
260 #if FEATURE_queryobj
261 ctx->Extensions.ARB_occlusion_query = GL_TRUE;
262 ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
263 #endif
264 ctx->Extensions.ARB_point_sprite = GL_TRUE;
265 #if FEATURE_ARB_shader_objects
266 ctx->Extensions.ARB_shader_objects = GL_TRUE;
267 ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
268 #endif
269 #if FEATURE_ARB_shading_language_100
270 ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
271 #endif
272 ctx->Extensions.ARB_shadow = GL_TRUE;
273 ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
274 ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
275 ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
276 ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
277 ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
278 ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
279 /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
280 ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
281 ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
282 ctx->Extensions.ARB_texture_rg = GL_TRUE;
283 ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
284 #if FEATURE_ARB_vertex_program
285 ctx->Extensions.ARB_vertex_program = GL_TRUE;
286 #endif
287 #if FEATURE_ARB_vertex_shader
288 ctx->Extensions.ARB_vertex_shader = GL_TRUE;
289 #endif
290 #if FEATURE_ARB_vertex_buffer_object
291 /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
292 #endif
293 #if FEATURE_ARB_sync
294 ctx->Extensions.ARB_sync = GL_TRUE;
295 #endif
296 ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
297 #if FEATURE_APPLE_object_purgeable
298 ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
299 #endif
300 ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
301 #if FEATURE_ATI_fragment_shader
302 ctx->Extensions.ATI_fragment_shader = GL_TRUE;
303 #endif
304 ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
305 ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
306 ctx->Extensions.ATI_separate_stencil = GL_TRUE;
307 ctx->Extensions.EXT_blend_color = GL_TRUE;
308 ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
309 ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
310 ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
311 ctx->Extensions.EXT_blend_minmax = GL_TRUE;
312 ctx->Extensions.EXT_blend_subtract = GL_TRUE;
313 ctx->Extensions.EXT_depth_bounds_test = GL_TRUE;
314 ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
315 ctx->Extensions.EXT_fog_coord = GL_TRUE;
316 #if FEATURE_EXT_framebuffer_object
317 ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
318 #endif
319 #if FEATURE_EXT_framebuffer_blit
320 ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
321 #endif
322 #if FEATURE_ARB_framebuffer_object
323 ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
324 #endif
325 /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
326 ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
327 ctx->Extensions.EXT_paletted_texture = GL_TRUE;
328 #if FEATURE_EXT_pixel_buffer_object
329 ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
330 #endif
331 ctx->Extensions.EXT_point_parameters = GL_TRUE;
332 ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
333 ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
334 ctx->Extensions.EXT_secondary_color = GL_TRUE;
335 ctx->Extensions.EXT_shared_texture_palette = GL_TRUE;
336 ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
337 ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
338 ctx->Extensions.EXT_texture_array = GL_TRUE;
339 ctx->Extensions.EXT_texture_env_add = GL_TRUE;
340 ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
341 ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
342 ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
343 ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
344 #if FEATURE_EXT_texture_sRGB
345 ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
346 #endif
347 ctx->Extensions.EXT_texture_swizzle = GL_TRUE;
348 #if FEATURE_EXT_transform_feedback
349 /*ctx->Extensions.EXT_transform_feedback = GL_TRUE;*/
350 #endif
351 ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
352 /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/
353 ctx->Extensions.MESA_pack_invert = GL_TRUE;
354 ctx->Extensions.MESA_resize_buffers = GL_TRUE;
355 ctx->Extensions.MESA_texture_array = GL_TRUE;
356 ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
357 ctx->Extensions.NV_blend_square = GL_TRUE;
358 ctx->Extensions.NV_conditional_render = GL_TRUE;
359 /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/
360 ctx->Extensions.NV_point_sprite = GL_TRUE;
361 ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
362 ctx->Extensions.NV_texture_rectangle = GL_TRUE;
363 /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
364 #if FEATURE_NV_vertex_program
365 ctx->Extensions.NV_vertex_program = GL_TRUE;
366 ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
367 #endif
368 #if FEATURE_NV_fragment_program
369 ctx->Extensions.NV_fragment_program = GL_TRUE;
370 #endif
371 #if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program
372 ctx->Extensions.NV_fragment_program_option = GL_TRUE;
373 #endif
374 ctx->Extensions.SGI_texture_color_table = GL_TRUE;
375 /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/
376 ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE;
377 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
378 ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
379 #endif
380 #if FEATURE_texture_fxt1
381 _mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
382 #endif
383 #if FEATURE_texture_s3tc
384 if (ctx->Mesa_DXTn) {
385 _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
386 _mesa_enable_extension(ctx, "GL_S3_s3tc");
387 }
388 #endif
389 }
390
391
392 /**
393 * Enable common EXT extensions in the ARB_imaging subset.
394 */
395 void
396 _mesa_enable_imaging_extensions(struct gl_context *ctx)
397 {
398 ctx->Extensions.EXT_blend_color = GL_TRUE;
399 ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
400 ctx->Extensions.EXT_blend_minmax = GL_TRUE;
401 ctx->Extensions.EXT_blend_subtract = GL_TRUE;
402 }
403
404
405
406 /**
407 * Enable all OpenGL 1.3 features and extensions.
408 * A convenience function to be called by drivers.
409 */
410 void
411 _mesa_enable_1_3_extensions(struct gl_context *ctx)
412 {
413 /*ctx->Extensions.ARB_multisample = GL_TRUE;*/
414 ctx->Extensions.ARB_multitexture = GL_TRUE;
415 ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
416 /*ctx->Extensions.ARB_texture_compression = GL_TRUE;*/
417 ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
418 ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
419 ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
420 ctx->Extensions.EXT_texture_env_add = GL_TRUE;
421 /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/
422 }
423
424
425
426 /**
427 * Enable all OpenGL 1.4 features and extensions.
428 * A convenience function to be called by drivers.
429 */
430 void
431 _mesa_enable_1_4_extensions(struct gl_context *ctx)
432 {
433 ctx->Extensions.ARB_depth_texture = GL_TRUE;
434 ctx->Extensions.ARB_shadow = GL_TRUE;
435 ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
436 ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
437 ctx->Extensions.ARB_window_pos = GL_TRUE;
438 ctx->Extensions.EXT_blend_color = GL_TRUE;
439 ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
440 ctx->Extensions.EXT_blend_minmax = GL_TRUE;
441 ctx->Extensions.EXT_blend_subtract = GL_TRUE;
442 ctx->Extensions.EXT_fog_coord = GL_TRUE;
443 /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
444 ctx->Extensions.EXT_point_parameters = GL_TRUE;
445 ctx->Extensions.EXT_secondary_color = GL_TRUE;
446 ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
447 ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
448 /*ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;*/
449 }
450
451
452 /**
453 * Enable all OpenGL 1.5 features and extensions.
454 * A convenience function to be called by drivers.
455 */
456 void
457 _mesa_enable_1_5_extensions(struct gl_context *ctx)
458 {
459 ctx->Extensions.ARB_occlusion_query = GL_TRUE;
460 /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
461 ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
462 }
463
464
465 /**
466 * Enable all OpenGL 2.0 features and extensions.
467 * A convenience function to be called by drivers.
468 */
469 void
470 _mesa_enable_2_0_extensions(struct gl_context *ctx)
471 {
472 /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
473 #if FEATURE_ARB_fragment_shader
474 ctx->Extensions.ARB_fragment_shader = GL_TRUE;
475 #endif
476 ctx->Extensions.ARB_point_sprite = GL_TRUE;
477 ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
478 ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
479 #if FEATURE_ARB_shader_objects
480 ctx->Extensions.ARB_shader_objects = GL_TRUE;
481 #endif
482 #if FEATURE_ARB_shading_language_100
483 ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
484 #endif
485 ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
486 #if FEATURE_ARB_vertex_shader
487 ctx->Extensions.ARB_vertex_shader = GL_TRUE;
488 #endif
489 }
490
491
492 /**
493 * Enable all OpenGL 2.1 features and extensions.
494 * A convenience function to be called by drivers.
495 */
496 void
497 _mesa_enable_2_1_extensions(struct gl_context *ctx)
498 {
499 #if FEATURE_EXT_pixel_buffer_object
500 ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
501 #endif
502 #if FEATURE_EXT_texture_sRGB
503 ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
504 #endif
505 }
506
507
508 /**
509 * Either enable or disable the named extension.
510 * \return GL_TRUE for success, GL_FALSE if invalid extension name
511 */
512 static GLboolean
513 set_extension( struct gl_context *ctx, const char *name, GLboolean state )
514 {
515 GLboolean *base = (GLboolean *) &ctx->Extensions;
516 GLuint i;
517
518 if (ctx->Extensions.String) {
519 /* The string was already queried - can't change it now! */
520 _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name);
521 return GL_FALSE;
522 }
523
524 for (i = 0 ; i < Elements(default_extensions) ; i++) {
525 if (strcmp(default_extensions[i].name, name) == 0) {
526 if (default_extensions[i].flag_offset) {
527 GLboolean *enabled = base + default_extensions[i].flag_offset;
528 *enabled = state;
529 }
530 return GL_TRUE;
531 }
532 }
533 return GL_FALSE;
534 }
535
536
537 /**
538 * Enable the named extension.
539 * Typically called by drivers.
540 */
541 void
542 _mesa_enable_extension( struct gl_context *ctx, const char *name )
543 {
544 if (!set_extension(ctx, name, GL_TRUE))
545 _mesa_problem(ctx, "Trying to enable unknown extension: %s", name);
546 }
547
548
549 /**
550 * Disable the named extension.
551 * XXX is this really needed???
552 */
553 void
554 _mesa_disable_extension( struct gl_context *ctx, const char *name )
555 {
556 if (!set_extension(ctx, name, GL_FALSE))
557 _mesa_problem(ctx, "Trying to disable unknown extension: %s", name);
558 }
559
560
561 /**
562 * Check if the i-th extension is enabled.
563 */
564 static GLboolean
565 extension_enabled(struct gl_context *ctx, GLuint index)
566 {
567 const GLboolean *base = (const GLboolean *) &ctx->Extensions;
568 if (!default_extensions[index].flag_offset ||
569 *(base + default_extensions[index].flag_offset)) {
570 return GL_TRUE;
571 }
572 else {
573 return GL_FALSE;
574 }
575 }
576
577
578 /**
579 * Test if the named extension is enabled in this context.
580 */
581 GLboolean
582 _mesa_extension_is_enabled( struct gl_context *ctx, const char *name )
583 {
584 GLuint i;
585
586 for (i = 0 ; i < Elements(default_extensions) ; i++) {
587 if (strcmp(default_extensions[i].name, name) == 0) {
588 return extension_enabled(ctx, i);
589 }
590 }
591 return GL_FALSE;
592 }
593
594
595 /**
596 * Append string 'b' onto string 'a'. Free 'a' and return new string.
597 */
598 static char *
599 append(const char *a, const char *b)
600 {
601 const GLuint aLen = a ? strlen(a) : 0;
602 const GLuint bLen = b ? strlen(b) : 0;
603 char *s = calloc(1, aLen + bLen + 1);
604 if (s) {
605 if (a)
606 memcpy(s, a, aLen);
607 if (b)
608 memcpy(s + aLen, b, bLen);
609 s[aLen + bLen] = '\0';
610 }
611 if (a)
612 free((void *) a);
613 return s;
614 }
615
616
617 /**
618 * Check the MESA_EXTENSION_OVERRIDE env var.
619 * For extension names that are recognized, turn them on. For extension
620 * names that are recognized and prefixed with '-', turn them off.
621 * Return a string of the unknown/leftover names.
622 */
623 static const char *
624 get_extension_override( struct gl_context *ctx )
625 {
626 const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
627 char *extraExt = NULL;
628 char ext[1000];
629 GLuint extLen = 0;
630 GLuint i;
631 GLboolean disableExt = GL_FALSE;
632
633 if (!envExt)
634 return NULL;
635
636 for (i = 0; ; i++) {
637 if (envExt[i] == '\0' || envExt[i] == ' ') {
638 /* terminate/process 'ext' if extLen > 0 */
639 if (extLen > 0) {
640 assert(extLen < sizeof(ext));
641 /* enable extension named by 'ext' */
642 ext[extLen] = 0;
643 if (!set_extension(ctx, ext, !disableExt)) {
644 /* unknown extension name, append it to extraExt */
645 if (extraExt) {
646 extraExt = append(extraExt, " ");
647 }
648 extraExt = append(extraExt, ext);
649 }
650 extLen = 0;
651 disableExt = GL_FALSE;
652 }
653 if (envExt[i] == '\0')
654 break;
655 }
656 else if (envExt[i] == '-') {
657 disableExt = GL_TRUE;
658 }
659 else {
660 /* accumulate this non-space character */
661 ext[extLen++] = envExt[i];
662 }
663 }
664
665 return extraExt;
666 }
667
668
669 /**
670 * Run through the default_extensions array above and set the
671 * ctx->Extensions.ARB/EXT_* flags accordingly.
672 * To be called during context initialization.
673 */
674 void
675 _mesa_init_extensions( struct gl_context *ctx )
676 {
677 GLboolean *base = (GLboolean *) &ctx->Extensions;
678 GLuint i;
679
680 for (i = 0 ; i < Elements(default_extensions) ; i++) {
681 if (default_extensions[i].enabled &&
682 default_extensions[i].flag_offset) {
683 *(base + default_extensions[i].flag_offset) = GL_TRUE;
684 }
685 }
686 }
687
688
689 /**
690 * Construct the GL_EXTENSIONS string. Called the first time that
691 * glGetString(GL_EXTENSIONS) is called.
692 */
693 static GLubyte *
694 compute_extensions( struct gl_context *ctx )
695 {
696 const char *extraExt = get_extension_override(ctx);
697 GLuint extStrLen = 0;
698 char *s;
699 GLuint i;
700
701 /* first, compute length of the extension string */
702 for (i = 0 ; i < Elements(default_extensions) ; i++) {
703 if (extension_enabled(ctx, i)) {
704 extStrLen += (GLuint) strlen(default_extensions[i].name) + 1;
705 }
706 }
707
708 if (extraExt)
709 extStrLen += strlen(extraExt) + 1; /* +1 for space */
710
711 /* allocate the extension string */
712 s = (char *) malloc(extStrLen);
713 if (!s)
714 return NULL;
715
716 /* second, build the extension string */
717 extStrLen = 0;
718 for (i = 0 ; i < Elements(default_extensions) ; i++) {
719 if (extension_enabled(ctx, i)) {
720 GLuint len = (GLuint) strlen(default_extensions[i].name);
721 memcpy(s + extStrLen, default_extensions[i].name, len);
722 extStrLen += len;
723 s[extStrLen] = ' ';
724 extStrLen++;
725 }
726 }
727 ASSERT(extStrLen > 0);
728
729 s[extStrLen - 1] = 0; /* -1 to overwrite trailing the ' ' */
730
731 if (extraExt) {
732 s = append(s, " ");
733 s = append(s, extraExt);
734 }
735
736 return (GLubyte *) s;
737 }
738
739 static size_t
740 append_extension(GLubyte **str, const char *ext)
741 {
742 GLubyte *s = *str;
743 size_t len = strlen(ext);
744
745 if (s) {
746 memcpy(s, ext, len);
747 s[len++] = ' ';
748 s[len] = '\0';
749
750 *str += len;
751 }
752 else {
753 len++;
754 }
755
756 return len;
757 }
758
759
760 static size_t
761 make_extension_string_es1(const struct gl_context *ctx, GLubyte *str)
762 {
763 size_t len = 0;
764
765 /* Core additions */
766 len += append_extension(&str, "GL_OES_byte_coordinates");
767 len += append_extension(&str, "GL_OES_fixed_point");
768 len += append_extension(&str, "GL_OES_single_precision");
769 len += append_extension(&str, "GL_OES_matrix_get");
770
771 /* 1.1 required extensions */
772 len += append_extension(&str, "GL_OES_read_format");
773 len += append_extension(&str, "GL_OES_compressed_paletted_texture");
774 len += append_extension(&str, "GL_OES_point_size_array");
775 len += append_extension(&str, "GL_OES_point_sprite");
776
777 /* 1.1 deprecated extensions */
778 len += append_extension(&str, "GL_OES_query_matrix");
779
780 #if FEATURE_OES_draw_texture
781 if (ctx->Extensions.OES_draw_texture)
782 len += append_extension(&str, "GL_OES_draw_texture");
783 #endif
784
785 if (ctx->Extensions.EXT_blend_equation_separate)
786 len += append_extension(&str, "GL_OES_blend_equation_separate");
787 if (ctx->Extensions.EXT_blend_func_separate)
788 len += append_extension(&str, "GL_OES_blend_func_separate");
789 if (ctx->Extensions.EXT_blend_subtract)
790 len += append_extension(&str, "GL_OES_blend_subtract");
791
792 if (ctx->Extensions.EXT_stencil_wrap)
793 len += append_extension(&str, "GL_OES_stencil_wrap");
794
795 if (ctx->Extensions.ARB_texture_cube_map)
796 len += append_extension(&str, "GL_OES_texture_cube_map");
797 if (ctx->Extensions.ARB_texture_env_crossbar)
798 len += append_extension(&str, "GL_OES_texture_env_crossbar");
799 if (ctx->Extensions.ARB_texture_mirrored_repeat)
800 len += append_extension(&str, "GL_OES_texture_mirrored_repeat");
801
802 if (ctx->Extensions.ARB_framebuffer_object) {
803 len += append_extension(&str, "GL_OES_framebuffer_object");
804 len += append_extension(&str, "GL_OES_depth24");
805 len += append_extension(&str, "GL_OES_depth32");
806 len += append_extension(&str, "GL_OES_fbo_render_mipmap");
807 len += append_extension(&str, "GL_OES_rgb8_rgba8");
808 len += append_extension(&str, "GL_OES_stencil1");
809 len += append_extension(&str, "GL_OES_stencil4");
810 len += append_extension(&str, "GL_OES_stencil8");
811 }
812
813 if (ctx->Extensions.EXT_vertex_array)
814 len += append_extension(&str, "GL_OES_element_index_uint");
815 if (ctx->Extensions.ARB_vertex_buffer_object)
816 len += append_extension(&str, "GL_OES_mapbuffer");
817 if (ctx->Extensions.EXT_texture_filter_anisotropic)
818 len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
819
820 /* some applications check this for NPOT support */
821 if (ctx->Extensions.ARB_texture_non_power_of_two)
822 len += append_extension(&str, "GL_ARB_texture_non_power_of_two");
823
824 if (ctx->Extensions.EXT_texture_compression_s3tc)
825 len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
826 if (ctx->Extensions.EXT_texture_lod_bias)
827 len += append_extension(&str, "GL_EXT_texture_lod_bias");
828 if (ctx->Extensions.EXT_blend_minmax)
829 len += append_extension(&str, "GL_EXT_blend_minmax");
830 if (ctx->Extensions.EXT_multi_draw_arrays)
831 len += append_extension(&str, "GL_EXT_multi_draw_arrays");
832
833 #if FEATURE_OES_EGL_image
834 if (ctx->Extensions.OES_EGL_image)
835 len += append_extension(&str, "GL_OES_EGL_image");
836 #endif
837
838 return len;
839 }
840
841
842 static GLubyte *
843 compute_extensions_es1(const struct gl_context *ctx)
844 {
845 GLubyte *s;
846 unsigned int len;
847
848 len = make_extension_string_es1(ctx, NULL);
849 s = malloc(len + 1);
850 if (!s)
851 return NULL;
852 make_extension_string_es1(ctx, s);
853
854 return s;
855 }
856
857 static size_t
858 make_extension_string_es2(const struct gl_context *ctx, GLubyte *str)
859 {
860 size_t len = 0;
861
862 if (ctx->Extensions.ARB_framebuffer_object) {
863 len += append_extension(&str, "GL_OES_depth24");
864 len += append_extension(&str, "GL_OES_depth32");
865 len += append_extension(&str, "GL_OES_fbo_render_mipmap");
866 len += append_extension(&str, "GL_OES_rgb8_rgba8");
867 len += append_extension(&str, "GL_OES_stencil1");
868 len += append_extension(&str, "GL_OES_stencil4");
869 }
870
871 if (ctx->Extensions.EXT_vertex_array)
872 len += append_extension(&str, "GL_OES_element_index_uint");
873 if (ctx->Extensions.ARB_vertex_buffer_object)
874 len += append_extension(&str, "GL_OES_mapbuffer");
875
876 #if 0
877 /* disabled because of missing GLSL support */
878 if (ctx->Extensions.EXT_texture3D)
879 len += append_extension(&str, "GL_OES_texture_3D");
880 #endif
881
882 if (ctx->Extensions.ARB_texture_non_power_of_two)
883 len += append_extension(&str, "GL_OES_texture_npot");
884 if (ctx->Extensions.EXT_texture_filter_anisotropic)
885 len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
886
887 len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV");
888 if (ctx->Extensions.ARB_depth_texture)
889 len += append_extension(&str, "GL_OES_depth_texture");
890 if (ctx->Extensions.EXT_packed_depth_stencil)
891 len += append_extension(&str, "GL_OES_packed_depth_stencil");
892 if (ctx->Extensions.ARB_fragment_shader)
893 len += append_extension(&str, "GL_OES_standard_derivatives");
894
895 if (ctx->Extensions.EXT_texture_compression_s3tc)
896 len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
897 if (ctx->Extensions.EXT_blend_minmax)
898 len += append_extension(&str, "GL_EXT_blend_minmax");
899 if (ctx->Extensions.EXT_multi_draw_arrays)
900 len += append_extension(&str, "GL_EXT_multi_draw_arrays");
901
902 #if FEATURE_OES_EGL_image
903 if (ctx->Extensions.OES_EGL_image)
904 len += append_extension(&str, "GL_OES_EGL_image");
905 #endif
906
907 if (ctx->Extensions.EXT_texture_format_BGRA8888)
908 len += append_extension(&str, "GL_EXT_texture_format_BGRA8888");
909
910 return len;
911 }
912
913 static GLubyte *
914 compute_extensions_es2(struct gl_context *ctx)
915 {
916 GLubyte *s;
917 unsigned int len;
918
919 len = make_extension_string_es2(ctx, NULL);
920 s = malloc(len + 1);
921 if (!s)
922 return NULL;
923 make_extension_string_es2(ctx, s);
924
925 return s;
926 }
927
928
929 GLubyte *
930 _mesa_make_extension_string(struct gl_context *ctx)
931 {
932 switch (ctx->API) {
933 case API_OPENGL:
934 return compute_extensions(ctx);
935 case API_OPENGLES2:
936 return compute_extensions_es2(ctx);
937 case API_OPENGLES:
938 return compute_extensions_es1(ctx);
939 default:
940 assert(0);
941 return NULL;
942 }
943 }
944
945 /**
946 * Return number of enabled extensions.
947 */
948 GLuint
949 _mesa_get_extension_count(struct gl_context *ctx)
950 {
951 GLuint i;
952
953 /* only count once */
954 if (!ctx->Extensions.Count) {
955 for (i = 0; i < Elements(default_extensions); i++) {
956 if (extension_enabled(ctx, i)) {
957 ctx->Extensions.Count++;
958 }
959 }
960 }
961
962 if (0)
963 _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count,
964 (int) Elements(default_extensions));
965
966 return ctx->Extensions.Count;
967 }
968
969
970 /**
971 * Return name of i-th enabled extension
972 */
973 const GLubyte *
974 _mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
975 {
976 GLuint i;
977
978 for (i = 0; i < Elements(default_extensions); i++) {
979 if (extension_enabled(ctx, i)) {
980 if (index == 0)
981 return (const GLubyte *) default_extensions[i].name;
982 index--;
983 }
984 }
985
986 return NULL;
987 }