2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
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:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
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.
30 #include "extensions.h"
31 #include "simple_list.h"
35 #define F(x) offsetof(struct gl_extensions, x)
41 * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions.
47 } default_extensions
[] = {
48 { OFF
, "GL_ARB_copy_buffer", F(ARB_copy_buffer
) },
49 { OFF
, "GL_ARB_depth_texture", F(ARB_depth_texture
) },
50 { OFF
, "GL_ARB_depth_clamp", F(ARB_depth_clamp
) },
51 { ON
, "GL_ARB_draw_buffers", F(ARB_draw_buffers
) },
52 { OFF
, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex
) },
53 /* TODO: uncomment the following line once GLSL layout(...) support is implemented */
54 /* { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) }, */
55 { OFF
, "GL_ARB_fragment_program", F(ARB_fragment_program
) },
56 { OFF
, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow
) },
57 { OFF
, "GL_ARB_fragment_shader", F(ARB_fragment_shader
) },
58 { OFF
, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object
) },
59 { OFF
, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel
) },
60 { OFF
, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex
) },
61 { OFF
, "GL_ARB_imaging", F(ARB_imaging
) },
62 { OFF
, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range
) },
63 { ON
, "GL_ARB_multisample", F(ARB_multisample
) },
64 { OFF
, "GL_ARB_multitexture", F(ARB_multitexture
) },
65 { OFF
, "GL_ARB_occlusion_query", F(ARB_occlusion_query
) },
66 { OFF
, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object
) },
67 { OFF
, "GL_ARB_point_parameters", F(EXT_point_parameters
) },
68 { OFF
, "GL_ARB_point_sprite", F(ARB_point_sprite
) },
69 { OFF
, "GL_ARB_provoking_vertex", F(EXT_provoking_vertex
) },
70 { OFF
, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map
) },
71 { OFF
, "GL_ARB_shader_objects", F(ARB_shader_objects
) },
72 { OFF
, "GL_ARB_shading_language_100", F(ARB_shading_language_100
) },
73 { OFF
, "GL_ARB_shading_language_120", F(ARB_shading_language_120
) },
74 { OFF
, "GL_ARB_shadow", F(ARB_shadow
) },
75 { OFF
, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient
) },
76 { OFF
, "GL_ARB_sync", F(ARB_sync
) },
77 { OFF
, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp
) },
78 { ON
, "GL_ARB_texture_compression", F(ARB_texture_compression
) },
79 { OFF
, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map
) },
80 { OFF
, "GL_ARB_texture_env_add", F(EXT_texture_env_add
) },
81 { OFF
, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine
) },
82 { OFF
, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar
) },
83 { OFF
, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3
) },
84 { OFF
, "GL_MESAX_texture_float", F(ARB_texture_float
) },
85 { OFF
, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat
)},
86 { OFF
, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two
)},
87 { OFF
, "GL_ARB_texture_rectangle", F(NV_texture_rectangle
) },
88 { ON
, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix
) },
89 { OFF
, "GL_ARB_vertex_array_bgra", F(EXT_vertex_array_bgra
) },
90 { OFF
, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object
) },
91 { ON
, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object
) },
92 { OFF
, "GL_ARB_vertex_program", F(ARB_vertex_program
) },
93 { OFF
, "GL_ARB_vertex_shader", F(ARB_vertex_shader
) },
94 { ON
, "GL_ARB_window_pos", F(ARB_window_pos
) },
95 { ON
, "GL_EXT_abgr", F(EXT_abgr
) },
96 { ON
, "GL_EXT_bgra", F(EXT_bgra
) },
97 { OFF
, "GL_EXT_blend_color", F(EXT_blend_color
) },
98 { OFF
, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate
) },
99 { OFF
, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate
) },
100 { OFF
, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op
) },
101 { OFF
, "GL_EXT_blend_minmax", F(EXT_blend_minmax
) },
102 { OFF
, "GL_EXT_blend_subtract", F(EXT_blend_subtract
) },
103 { OFF
, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint
) },
104 { OFF
, "GL_EXT_cull_vertex", F(EXT_cull_vertex
) },
105 { ON
, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array
) },
106 { OFF
, "GL_EXT_convolution", F(EXT_convolution
) },
107 { ON
, "GL_EXT_copy_texture", F(EXT_copy_texture
) },
108 { OFF
, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test
) },
109 { OFF
, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2
) },
110 { ON
, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements
) },
111 { OFF
, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit
) },
112 { OFF
, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample
) },
113 { OFF
, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object
) },
114 { OFF
, "GL_EXT_fog_coord", F(EXT_fog_coord
) },
115 { OFF
, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters
) },
116 { OFF
, "GL_EXT_histogram", F(EXT_histogram
) },
117 { ON
, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays
) },
118 { OFF
, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil
) },
119 { ON
, "GL_EXT_packed_pixels", F(EXT_packed_pixels
) },
120 { OFF
, "GL_EXT_paletted_texture", F(EXT_paletted_texture
) },
121 { OFF
, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object
) },
122 { OFF
, "GL_EXT_point_parameters", F(EXT_point_parameters
) },
123 { ON
, "GL_EXT_polygon_offset", F(EXT_polygon_offset
) },
124 { OFF
, "GL_EXT_provoking_vertex", F(EXT_provoking_vertex
) },
125 { ON
, "GL_EXT_rescale_normal", F(EXT_rescale_normal
) },
126 { OFF
, "GL_EXT_secondary_color", F(EXT_secondary_color
) },
127 { ON
, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color
) },
128 { OFF
, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs
) },
129 { OFF
, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette
) },
130 { OFF
, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side
) },
131 { OFF
, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap
) },
132 { ON
, "GL_EXT_subtexture", F(EXT_subtexture
) },
133 { ON
, "GL_EXT_texture", F(EXT_texture
) },
134 { ON
, "GL_EXT_texture3D", F(EXT_texture3D
) },
135 { OFF
, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc
) },
136 { OFF
, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map
) },
137 { ON
, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp
) },
138 { OFF
, "GL_EXT_texture_env_add", F(EXT_texture_env_add
) },
139 { OFF
, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine
) },
140 { OFF
, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3
) },
141 { OFF
, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic
) },
142 { OFF
, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias
) },
143 { OFF
, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp
) },
144 { ON
, "GL_EXT_texture_object", F(EXT_texture_object
) },
145 { OFF
, "GL_EXT_texture_rectangle", F(NV_texture_rectangle
) },
146 { OFF
, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB
) },
147 { OFF
, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle
) },
148 { OFF
, "GL_EXT_timer_query", F(EXT_timer_query
) },
149 { ON
, "GL_EXT_vertex_array", F(EXT_vertex_array
) },
150 { OFF
, "GL_EXT_vertex_array_bgra", F(EXT_vertex_array_bgra
) },
151 { OFF
, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set
) },
152 { OFF
, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1
) },
153 { OFF
, "GL_APPLE_client_storage", F(APPLE_client_storage
) },
154 { ON
, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels
) },
155 { OFF
, "GL_APPLE_vertex_array_object", F(APPLE_vertex_array_object
) },
156 { OFF
, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate
) },
157 { OFF
, "GL_ATI_envmap_bumpmap", F(ATI_envmap_bumpmap
) },
158 { OFF
, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3
)},
159 { OFF
, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once
)},
160 { OFF
, "GL_ATI_fragment_shader", F(ATI_fragment_shader
)},
161 { OFF
, "GL_ATI_separate_stencil", F(ATI_separate_stencil
)},
162 { ON
, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays
) },
163 { ON
, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip
) },
164 { OFF
, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat
)},
165 { OFF
, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate
) },
166 { OFF
, "GL_MESA_pack_invert", F(MESA_pack_invert
) },
167 { OFF
, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil
) },
168 { OFF
, "GL_MESA_resize_buffers", F(MESA_resize_buffers
) },
169 { OFF
, "GL_MESA_texture_array", F(MESA_texture_array
) },
170 { OFF
, "GL_MESA_texture_signed_rgba", F(MESA_texture_signed_rgba
) },
171 { OFF
, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture
) },
172 { ON
, "GL_MESA_window_pos", F(ARB_window_pos
) },
173 { OFF
, "GL_NV_blend_square", F(NV_blend_square
) },
174 { OFF
, "GL_NV_conditional_render", F(NV_conditional_render
) },
175 { OFF
, "GL_NV_depth_clamp", F(ARB_depth_clamp
) },
176 { OFF
, "GL_NV_fragment_program", F(NV_fragment_program
) },
177 { OFF
, "GL_NV_fragment_program_option", F(NV_fragment_program_option
) },
178 { ON
, "GL_NV_light_max_exponent", F(NV_light_max_exponent
) },
179 { OFF
, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil
) },
180 { OFF
, "GL_NV_point_sprite", F(NV_point_sprite
) },
181 { OFF
, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4
) },
182 { OFF
, "GL_NV_texture_rectangle", F(NV_texture_rectangle
) },
183 { ON
, "GL_NV_texgen_reflection", F(NV_texgen_reflection
) },
184 { OFF
, "GL_NV_vertex_program", F(NV_vertex_program
) },
185 { OFF
, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1
) },
186 { ON
, "GL_OES_read_format", F(OES_read_format
) },
187 { OFF
, "GL_SGI_color_matrix", F(SGI_color_matrix
) },
188 { OFF
, "GL_SGI_color_table", F(SGI_color_table
) },
189 { OFF
, "GL_SGI_texture_color_table", F(SGI_texture_color_table
) },
190 { OFF
, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap
) },
191 { OFF
, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp
) },
192 { ON
, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp
) },
193 { ON
, "GL_SGIS_texture_lod", F(SGIS_texture_lod
) },
194 { ON
, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays
) },
195 { OFF
, "GL_S3_s3tc", F(S3_s3tc
) },
196 #if FEATURE_OES_draw_texture
197 { OFF
, "GL_OES_draw_texture", F(OES_draw_texture
) },
198 #endif /* FEATURE_OES_draw_texture */
204 * Enable all extensions suitable for a software-only renderer.
205 * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
208 _mesa_enable_sw_extensions(GLcontext
*ctx
)
210 ctx
->Extensions
.ARB_copy_buffer
= GL_TRUE
;
211 ctx
->Extensions
.ARB_depth_clamp
= GL_TRUE
;
212 ctx
->Extensions
.ARB_depth_texture
= GL_TRUE
;
213 /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
214 ctx
->Extensions
.ARB_draw_elements_base_vertex
= GL_TRUE
;
215 #if FEATURE_ARB_fragment_program
216 ctx
->Extensions
.ARB_fragment_program
= GL_TRUE
;
217 ctx
->Extensions
.ARB_fragment_program_shadow
= GL_TRUE
;
219 #if FEATURE_ARB_fragment_shader
220 ctx
->Extensions
.ARB_fragment_shader
= GL_TRUE
;
222 #if FEATURE_ARB_framebuffer_object
223 ctx
->Extensions
.ARB_framebuffer_object
= GL_TRUE
;
225 ctx
->Extensions
.ARB_half_float_pixel
= GL_TRUE
;
226 ctx
->Extensions
.ARB_half_float_vertex
= GL_TRUE
;
227 ctx
->Extensions
.ARB_imaging
= GL_TRUE
;
228 ctx
->Extensions
.ARB_map_buffer_range
= GL_TRUE
;
229 ctx
->Extensions
.ARB_multitexture
= GL_TRUE
;
231 ctx
->Extensions
.ARB_occlusion_query
= GL_TRUE
;
233 ctx
->Extensions
.ARB_point_sprite
= GL_TRUE
;
234 #if FEATURE_ARB_shader_objects
235 ctx
->Extensions
.ARB_shader_objects
= GL_TRUE
;
237 #if FEATURE_ARB_shading_language_100
238 ctx
->Extensions
.ARB_shading_language_100
= GL_TRUE
;
240 #if FEATURE_ARB_shading_language_120
241 ctx
->Extensions
.ARB_shading_language_120
= GL_TRUE
;
243 ctx
->Extensions
.ARB_shadow
= GL_TRUE
;
244 ctx
->Extensions
.ARB_shadow_ambient
= GL_TRUE
;
245 ctx
->Extensions
.ARB_texture_border_clamp
= GL_TRUE
;
246 ctx
->Extensions
.ARB_texture_cube_map
= GL_TRUE
;
247 ctx
->Extensions
.ARB_texture_env_combine
= GL_TRUE
;
248 ctx
->Extensions
.ARB_texture_env_crossbar
= GL_TRUE
;
249 ctx
->Extensions
.ARB_texture_env_dot3
= GL_TRUE
;
250 /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
251 ctx
->Extensions
.ARB_texture_mirrored_repeat
= GL_TRUE
;
252 ctx
->Extensions
.ARB_texture_non_power_of_two
= GL_TRUE
;
253 ctx
->Extensions
.ARB_vertex_array_object
= GL_TRUE
;
254 #if FEATURE_ARB_vertex_program
255 ctx
->Extensions
.ARB_vertex_program
= GL_TRUE
;
257 #if FEATURE_ARB_vertex_shader
258 ctx
->Extensions
.ARB_vertex_shader
= GL_TRUE
;
260 #if FEATURE_ARB_vertex_buffer_object
261 /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
264 ctx
->Extensions
.ARB_sync
= GL_TRUE
;
266 ctx
->Extensions
.APPLE_vertex_array_object
= GL_TRUE
;
267 ctx
->Extensions
.ATI_envmap_bumpmap
= GL_TRUE
;
268 #if FEATURE_ATI_fragment_shader
269 ctx
->Extensions
.ATI_fragment_shader
= GL_TRUE
;
271 ctx
->Extensions
.ATI_texture_env_combine3
= GL_TRUE
;
272 ctx
->Extensions
.ATI_texture_mirror_once
= GL_TRUE
;
273 ctx
->Extensions
.ATI_separate_stencil
= GL_TRUE
;
274 ctx
->Extensions
.EXT_blend_color
= GL_TRUE
;
275 ctx
->Extensions
.EXT_blend_equation_separate
= GL_TRUE
;
276 ctx
->Extensions
.EXT_blend_func_separate
= GL_TRUE
;
277 ctx
->Extensions
.EXT_blend_logic_op
= GL_TRUE
;
278 ctx
->Extensions
.EXT_blend_minmax
= GL_TRUE
;
279 ctx
->Extensions
.EXT_blend_subtract
= GL_TRUE
;
280 ctx
->Extensions
.EXT_convolution
= GL_TRUE
;
281 ctx
->Extensions
.EXT_depth_bounds_test
= GL_TRUE
;
282 ctx
->Extensions
.EXT_draw_buffers2
= GL_TRUE
;
283 ctx
->Extensions
.EXT_fog_coord
= GL_TRUE
;
284 #if FEATURE_EXT_framebuffer_object
285 ctx
->Extensions
.EXT_framebuffer_object
= GL_TRUE
;
287 #if FEATURE_EXT_framebuffer_blit
288 ctx
->Extensions
.EXT_framebuffer_blit
= GL_TRUE
;
290 #if FEATURE_ARB_framebuffer_object
291 ctx
->Extensions
.EXT_framebuffer_multisample
= GL_TRUE
;
293 ctx
->Extensions
.EXT_histogram
= GL_TRUE
;
294 /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
295 ctx
->Extensions
.EXT_packed_depth_stencil
= GL_TRUE
;
296 ctx
->Extensions
.EXT_paletted_texture
= GL_TRUE
;
297 #if FEATURE_EXT_pixel_buffer_object
298 ctx
->Extensions
.EXT_pixel_buffer_object
= GL_TRUE
;
300 ctx
->Extensions
.EXT_point_parameters
= GL_TRUE
;
301 ctx
->Extensions
.EXT_provoking_vertex
= GL_TRUE
;
302 ctx
->Extensions
.EXT_shadow_funcs
= GL_TRUE
;
303 ctx
->Extensions
.EXT_secondary_color
= GL_TRUE
;
304 ctx
->Extensions
.EXT_shared_texture_palette
= GL_TRUE
;
305 ctx
->Extensions
.EXT_stencil_wrap
= GL_TRUE
;
306 ctx
->Extensions
.EXT_stencil_two_side
= GL_TRUE
;
307 ctx
->Extensions
.EXT_texture_env_add
= GL_TRUE
;
308 ctx
->Extensions
.EXT_texture_env_combine
= GL_TRUE
;
309 ctx
->Extensions
.EXT_texture_env_dot3
= GL_TRUE
;
310 ctx
->Extensions
.EXT_texture_mirror_clamp
= GL_TRUE
;
311 ctx
->Extensions
.EXT_texture_lod_bias
= GL_TRUE
;
312 #if FEATURE_EXT_texture_sRGB
313 ctx
->Extensions
.EXT_texture_sRGB
= GL_TRUE
;
315 ctx
->Extensions
.EXT_texture_swizzle
= GL_TRUE
;
316 ctx
->Extensions
.EXT_vertex_array_bgra
= GL_TRUE
;
317 /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/
318 ctx
->Extensions
.MESA_pack_invert
= GL_TRUE
;
319 ctx
->Extensions
.MESA_resize_buffers
= GL_TRUE
;
320 ctx
->Extensions
.MESA_texture_array
= GL_TRUE
;
321 ctx
->Extensions
.MESA_ycbcr_texture
= GL_TRUE
;
322 ctx
->Extensions
.NV_blend_square
= GL_TRUE
;
323 ctx
->Extensions
.NV_conditional_render
= GL_TRUE
;
324 /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/
325 ctx
->Extensions
.NV_point_sprite
= GL_TRUE
;
326 ctx
->Extensions
.NV_texture_env_combine4
= GL_TRUE
;
327 ctx
->Extensions
.NV_texture_rectangle
= GL_TRUE
;
328 /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
329 #if FEATURE_NV_vertex_program
330 ctx
->Extensions
.NV_vertex_program
= GL_TRUE
;
331 ctx
->Extensions
.NV_vertex_program1_1
= GL_TRUE
;
333 #if FEATURE_NV_fragment_program
334 ctx
->Extensions
.NV_fragment_program
= GL_TRUE
;
336 #if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program
337 ctx
->Extensions
.NV_fragment_program_option
= GL_TRUE
;
339 ctx
->Extensions
.SGI_color_matrix
= GL_TRUE
;
340 ctx
->Extensions
.SGI_color_table
= GL_TRUE
;
341 ctx
->Extensions
.SGI_texture_color_table
= GL_TRUE
;
342 ctx
->Extensions
.SGIS_generate_mipmap
= GL_TRUE
;
343 ctx
->Extensions
.SGIS_texture_edge_clamp
= GL_TRUE
;
344 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
345 ctx
->Extensions
.EXT_gpu_program_parameters
= GL_TRUE
;
347 #if FEATURE_texture_fxt1
348 _mesa_enable_extension(ctx
, "GL_3DFX_texture_compression_FXT1");
350 #if FEATURE_texture_s3tc
351 if (ctx
->Mesa_DXTn
) {
352 _mesa_enable_extension(ctx
, "GL_EXT_texture_compression_s3tc");
353 _mesa_enable_extension(ctx
, "GL_S3_s3tc");
360 * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it.
363 _mesa_enable_imaging_extensions(GLcontext
*ctx
)
365 ctx
->Extensions
.ARB_imaging
= GL_TRUE
;
366 ctx
->Extensions
.EXT_blend_color
= GL_TRUE
;
367 ctx
->Extensions
.EXT_blend_logic_op
= GL_TRUE
;
368 ctx
->Extensions
.EXT_blend_minmax
= GL_TRUE
;
369 ctx
->Extensions
.EXT_blend_subtract
= GL_TRUE
;
370 ctx
->Extensions
.EXT_convolution
= GL_TRUE
;
371 ctx
->Extensions
.EXT_histogram
= GL_TRUE
;
372 ctx
->Extensions
.SGI_color_matrix
= GL_TRUE
;
373 ctx
->Extensions
.SGI_color_table
= GL_TRUE
;
379 * Enable all OpenGL 1.3 features and extensions.
380 * A convenience function to be called by drivers.
383 _mesa_enable_1_3_extensions(GLcontext
*ctx
)
385 /*ctx->Extensions.ARB_multisample = GL_TRUE;*/
386 ctx
->Extensions
.ARB_multitexture
= GL_TRUE
;
387 ctx
->Extensions
.ARB_texture_border_clamp
= GL_TRUE
;
388 /*ctx->Extensions.ARB_texture_compression = GL_TRUE;*/
389 ctx
->Extensions
.ARB_texture_cube_map
= GL_TRUE
;
390 ctx
->Extensions
.ARB_texture_env_combine
= GL_TRUE
;
391 ctx
->Extensions
.ARB_texture_env_dot3
= GL_TRUE
;
392 ctx
->Extensions
.EXT_texture_env_add
= GL_TRUE
;
393 /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/
399 * Enable all OpenGL 1.4 features and extensions.
400 * A convenience function to be called by drivers.
403 _mesa_enable_1_4_extensions(GLcontext
*ctx
)
405 ctx
->Extensions
.ARB_depth_texture
= GL_TRUE
;
406 ctx
->Extensions
.ARB_shadow
= GL_TRUE
;
407 ctx
->Extensions
.ARB_texture_env_crossbar
= GL_TRUE
;
408 ctx
->Extensions
.ARB_texture_mirrored_repeat
= GL_TRUE
;
409 ctx
->Extensions
.ARB_window_pos
= GL_TRUE
;
410 ctx
->Extensions
.EXT_blend_color
= GL_TRUE
;
411 ctx
->Extensions
.EXT_blend_func_separate
= GL_TRUE
;
412 ctx
->Extensions
.EXT_blend_minmax
= GL_TRUE
;
413 ctx
->Extensions
.EXT_blend_subtract
= GL_TRUE
;
414 ctx
->Extensions
.EXT_fog_coord
= GL_TRUE
;
415 /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/
416 ctx
->Extensions
.EXT_point_parameters
= GL_TRUE
;
417 ctx
->Extensions
.EXT_secondary_color
= GL_TRUE
;
418 ctx
->Extensions
.EXT_stencil_wrap
= GL_TRUE
;
419 ctx
->Extensions
.EXT_texture_lod_bias
= GL_TRUE
;
420 ctx
->Extensions
.SGIS_generate_mipmap
= GL_TRUE
;
425 * Enable all OpenGL 1.5 features and extensions.
426 * A convenience function to be called by drivers.
429 _mesa_enable_1_5_extensions(GLcontext
*ctx
)
431 ctx
->Extensions
.ARB_occlusion_query
= GL_TRUE
;
432 /*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
433 ctx
->Extensions
.EXT_shadow_funcs
= GL_TRUE
;
438 * Enable all OpenGL 2.0 features and extensions.
439 * A convenience function to be called by drivers.
442 _mesa_enable_2_0_extensions(GLcontext
*ctx
)
444 /*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
445 #if FEATURE_ARB_fragment_shader
446 ctx
->Extensions
.ARB_fragment_shader
= GL_TRUE
;
448 ctx
->Extensions
.ARB_point_sprite
= GL_TRUE
;
449 ctx
->Extensions
.EXT_blend_equation_separate
= GL_TRUE
;
450 ctx
->Extensions
.ARB_texture_non_power_of_two
= GL_TRUE
;
451 #if FEATURE_ARB_shader_objects
452 ctx
->Extensions
.ARB_shader_objects
= GL_TRUE
;
454 #if FEATURE_ARB_shading_language_100
455 ctx
->Extensions
.ARB_shading_language_100
= GL_TRUE
;
457 ctx
->Extensions
.EXT_stencil_two_side
= GL_TRUE
;
458 #if FEATURE_ARB_vertex_shader
459 ctx
->Extensions
.ARB_vertex_shader
= GL_TRUE
;
465 * Enable all OpenGL 2.1 features and extensions.
466 * A convenience function to be called by drivers.
469 _mesa_enable_2_1_extensions(GLcontext
*ctx
)
471 #if FEATURE_EXT_pixel_buffer_object
472 ctx
->Extensions
.EXT_pixel_buffer_object
= GL_TRUE
;
474 #if FEATURE_EXT_texture_sRGB
475 ctx
->Extensions
.EXT_texture_sRGB
= GL_TRUE
;
477 #ifdef FEATURE_ARB_shading_language_120
478 ctx
->Extensions
.ARB_shading_language_120
= GL_TRUE
;
485 * Either enable or disable the named extension.
486 * \return GL_TRUE for success, GL_FALSE if invalid extension name
489 set_extension( GLcontext
*ctx
, const char *name
, GLboolean state
)
491 GLboolean
*base
= (GLboolean
*) &ctx
->Extensions
;
494 if (ctx
->Extensions
.String
) {
495 /* The string was already queried - can't change it now! */
496 _mesa_problem(ctx
, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name
);
500 for (i
= 0 ; i
< Elements(default_extensions
) ; i
++) {
501 if (_mesa_strcmp(default_extensions
[i
].name
, name
) == 0) {
502 if (default_extensions
[i
].flag_offset
) {
503 GLboolean
*enabled
= base
+ default_extensions
[i
].flag_offset
;
514 * Enable the named extension.
515 * Typically called by drivers.
518 _mesa_enable_extension( GLcontext
*ctx
, const char *name
)
520 if (!set_extension(ctx
, name
, GL_TRUE
))
521 _mesa_problem(ctx
, "Trying to enable unknown extension: %s", name
);
526 * Disable the named extension.
527 * XXX is this really needed???
530 _mesa_disable_extension( GLcontext
*ctx
, const char *name
)
532 if (!set_extension(ctx
, name
, GL_FALSE
))
533 _mesa_problem(ctx
, "Trying to disable unknown extension: %s", name
);
538 * Check if the i-th extension is enabled.
541 extension_enabled(GLcontext
*ctx
, GLuint index
)
543 const GLboolean
*base
= (const GLboolean
*) &ctx
->Extensions
;
544 if (!default_extensions
[index
].flag_offset
||
545 *(base
+ default_extensions
[index
].flag_offset
)) {
555 * Test if the named extension is enabled in this context.
558 _mesa_extension_is_enabled( GLcontext
*ctx
, const char *name
)
562 for (i
= 0 ; i
< Elements(default_extensions
) ; i
++) {
563 if (_mesa_strcmp(default_extensions
[i
].name
, name
) == 0) {
564 return extension_enabled(ctx
, i
);
572 * Append string 'b' onto string 'a'. Free 'a' and return new string.
575 append(const char *a
, const char *b
)
577 const GLuint aLen
= a
? _mesa_strlen(a
) : 0;
578 const GLuint bLen
= b
? _mesa_strlen(b
) : 0;
579 char *s
= _mesa_calloc(aLen
+ bLen
+ 1);
582 _mesa_memcpy(s
, a
, aLen
);
584 _mesa_memcpy(s
+ aLen
, b
, bLen
);
585 s
[aLen
+ bLen
] = '\0';
588 _mesa_free((void *) a
);
594 * Check the MESA_EXTENSION_OVERRIDE env var.
595 * For extension names that are recognized, turn them on. For extension
596 * names that are recognized and prefixed with '-', turn them off.
597 * Return a string of the unknown/leftover names.
600 get_extension_override( GLcontext
*ctx
)
602 const char *envExt
= _mesa_getenv("MESA_EXTENSION_OVERRIDE");
603 char *extraExt
= NULL
;
607 GLboolean disableExt
= GL_FALSE
;
613 if (envExt
[i
] == '\0' || envExt
[i
] == ' ') {
614 /* terminate/process 'ext' if extLen > 0 */
616 assert(extLen
< sizeof(ext
));
617 /* enable extension named by 'ext' */
619 if (!set_extension(ctx
, ext
, !disableExt
)) {
620 /* unknown extension name, append it to extraExt */
622 extraExt
= append(extraExt
, " ");
624 extraExt
= append(extraExt
, ext
);
627 disableExt
= GL_FALSE
;
629 if (envExt
[i
] == '\0')
632 else if (envExt
[i
] == '-') {
633 disableExt
= GL_TRUE
;
636 /* accumulate this non-space character */
637 ext
[extLen
++] = envExt
[i
];
646 * Run through the default_extensions array above and set the
647 * ctx->Extensions.ARB/EXT_* flags accordingly.
648 * To be called during context initialization.
651 _mesa_init_extensions( GLcontext
*ctx
)
653 GLboolean
*base
= (GLboolean
*) &ctx
->Extensions
;
656 for (i
= 0 ; i
< Elements(default_extensions
) ; i
++) {
657 if (default_extensions
[i
].enabled
&&
658 default_extensions
[i
].flag_offset
) {
659 *(base
+ default_extensions
[i
].flag_offset
) = GL_TRUE
;
666 * Construct the GL_EXTENSIONS string. Called the first time that
667 * glGetString(GL_EXTENSIONS) is called.
670 _mesa_make_extension_string( GLcontext
*ctx
)
672 const char *extraExt
= get_extension_override(ctx
);
673 GLuint extStrLen
= 0;
677 /* first, compute length of the extension string */
678 for (i
= 0 ; i
< Elements(default_extensions
) ; i
++) {
679 if (extension_enabled(ctx
, i
)) {
680 extStrLen
+= (GLuint
)_mesa_strlen(default_extensions
[i
].name
) + 1;
685 extStrLen
+= _mesa_strlen(extraExt
) + 1; /* +1 for space */
687 /* allocate the extension string */
688 s
= (char *) _mesa_malloc(extStrLen
);
692 /* second, build the extension string */
694 for (i
= 0 ; i
< Elements(default_extensions
) ; i
++) {
695 if (extension_enabled(ctx
, i
)) {
696 GLuint len
= (GLuint
)_mesa_strlen(default_extensions
[i
].name
);
697 _mesa_memcpy(s
+ extStrLen
, default_extensions
[i
].name
, len
);
703 ASSERT(extStrLen
> 0);
705 s
[extStrLen
- 1] = 0; /* -1 to overwrite trailing the ' ' */
709 s
= append(s
, extraExt
);
712 return (GLubyte
*) s
;
717 * Return number of enabled extensions.
720 _mesa_get_extension_count(GLcontext
*ctx
)
724 /* only count once */
725 if (!ctx
->Extensions
.Count
) {
726 for (i
= 0; i
< Elements(default_extensions
); i
++) {
727 if (extension_enabled(ctx
, i
)) {
728 ctx
->Extensions
.Count
++;
734 _mesa_debug(ctx
, "%u of %d extensions enabled\n", ctx
->Extensions
.Count
,
735 Elements(default_extensions
));
737 return ctx
->Extensions
.Count
;
742 * Return name of i-th enabled extension
745 _mesa_get_enabled_extension(GLcontext
*ctx
, GLuint index
)
749 for (i
= 0; i
< Elements(default_extensions
); i
++) {
750 if (extension_enabled(ctx
, i
)) {
752 return (const GLubyte
*) default_extensions
[i
].name
;