1 /*
2  * (C) Copyright IBM Corporation 2002, 2004
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * on the rights to use, copy, modify, merge, publish, distribute, sub
9  * license, and/or sell copies of the Software, and to permit persons to whom
10  * the Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22  * USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /**
26  * \file glxextensions.h
27  *
28  * \author Ian Romanick <idr@us.ibm.com>
29  */
30 
31 #ifndef GLX_GLXEXTENSIONS_H
32 #define GLX_GLXEXTENSIONS_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 enum
39 {
40    ARB_context_flush_control_bit = 0,
41    ARB_create_context_bit,
42    ARB_create_context_no_error_bit,
43    ARB_create_context_profile_bit,
44    ARB_create_context_robustness_bit,
45    ARB_fbconfig_float_bit,
46    ARB_get_proc_address_bit,
47    ARB_multisample_bit,
48    EXT_buffer_age_bit,
49    EXT_create_context_es2_profile_bit,
50    EXT_create_context_es_profile_bit,
51    EXT_fbconfig_packed_float_bit,
52    EXT_framebuffer_sRGB_bit,
53    EXT_import_context_bit,
54    EXT_no_config_context_bit,
55    EXT_swap_control_bit,
56    EXT_swap_control_tear_bit,
57    EXT_texture_from_pixmap_bit,
58    EXT_visual_info_bit,
59    EXT_visual_rating_bit,
60    ATI_pixel_format_float_bit,
61    INTEL_swap_event_bit,
62    MESA_copy_sub_buffer_bit,
63    MESA_depth_float_bit,
64    MESA_multithread_makecurrent_bit,
65    MESA_query_renderer_bit,
66    MESA_swap_control_bit,
67    MESA_swap_frame_usage_bit,
68    NV_float_buffer_bit,
69    OML_swap_method_bit,
70    OML_sync_control_bit,
71    SGIS_multisample_bit,
72    SGIX_fbconfig_bit,
73    SGIX_pbuffer_bit,
74    SGIX_visual_select_group_bit,
75    SGI_make_current_read_bit,
76    SGI_swap_control_bit,
77    SGI_video_sync_bit,
78 
79    __NUM_GLX_EXTS,
80 };
81 
82 #define __GLX_EXT_BYTES   ((__NUM_GLX_EXTS + 7) / 8)
83 
84 /* From the GLX perspective, the ARB and EXT extensions are identical.  Use a
85  * single bit for both.
86  */
87 #define ARB_framebuffer_sRGB_bit EXT_framebuffer_sRGB_bit
88 
89 enum
90 {
91    GL_ARB_depth_texture_bit = 0,
92    GL_ARB_draw_buffers_bit,
93    GL_ARB_fragment_program_bit,
94    GL_ARB_fragment_program_shadow_bit,
95    GL_ARB_framebuffer_object_bit,
96    GL_ARB_imaging_bit,
97    GL_ARB_multisample_bit,
98    GL_ARB_multitexture_bit,
99    GL_ARB_occlusion_query_bit,
100    GL_ARB_point_parameters_bit,
101    GL_ARB_point_sprite_bit,
102    GL_ARB_shadow_bit,
103    GL_ARB_shadow_ambient_bit,
104    GL_ARB_texture_border_clamp_bit,
105    GL_ARB_texture_cube_map_bit,
106    GL_ARB_texture_compression_bit,
107    GL_ARB_texture_env_add_bit,
108    GL_ARB_texture_env_combine_bit,
109    GL_ARB_texture_env_crossbar_bit,
110    GL_ARB_texture_env_dot3_bit,
111    GL_ARB_texture_filter_anisotropic_bit,
112    GL_ARB_texture_mirrored_repeat_bit,
113    GL_ARB_texture_non_power_of_two_bit,
114    GL_ARB_texture_rectangle_bit,
115    GL_ARB_texture_rg_bit,
116    GL_ARB_transpose_matrix_bit,
117    GL_ARB_vertex_buffer_object_bit,
118    GL_ARB_vertex_program_bit,
119    GL_ARB_window_pos_bit,
120    GL_EXT_abgr_bit,
121    GL_EXT_bgra_bit,
122    GL_EXT_blend_color_bit,
123    GL_EXT_blend_equation_separate_bit,
124    GL_EXT_blend_func_separate_bit,
125    GL_EXT_blend_logic_op_bit,
126    GL_EXT_blend_minmax_bit,
127    GL_EXT_blend_subtract_bit,
128    GL_EXT_clip_volume_hint_bit,
129    GL_EXT_compiled_vertex_array_bit,
130    GL_EXT_convolution_bit,
131    GL_EXT_copy_texture_bit,
132    GL_EXT_cull_vertex_bit,
133    GL_EXT_depth_bounds_test_bit,
134    GL_EXT_draw_range_elements_bit,
135    GL_EXT_fog_coord_bit,
136    GL_EXT_framebuffer_blit_bit,
137    GL_EXT_framebuffer_multisample_bit,
138    GL_EXT_framebuffer_object_bit,
139    GL_EXT_framebuffer_sRGB_bit,
140    GL_EXT_multi_draw_arrays_bit,
141    GL_EXT_packed_depth_stencil_bit,
142    GL_EXT_packed_pixels_bit,
143    GL_EXT_paletted_texture_bit,
144    GL_EXT_pixel_buffer_object_bit,
145    GL_EXT_polygon_offset_bit,
146    GL_EXT_rescale_normal_bit,
147    GL_EXT_secondary_color_bit,
148    GL_EXT_separate_specular_color_bit,
149    GL_EXT_shadow_funcs_bit,
150    GL_EXT_shared_texture_palette_bit,
151    GL_EXT_stencil_two_side_bit,
152    GL_EXT_stencil_wrap_bit,
153    GL_EXT_subtexture_bit,
154    GL_EXT_texture_bit,
155    GL_EXT_texture3D_bit,
156    GL_EXT_texture_compression_dxt1_bit,
157    GL_EXT_texture_compression_s3tc_bit,
158    GL_EXT_texture_edge_clamp_bit,
159    GL_EXT_texture_env_combine_bit,
160    GL_EXT_texture_env_dot3_bit,
161    GL_EXT_texture_integer_bit,
162    GL_EXT_texture_lod_bit,
163    GL_EXT_texture_lod_bias_bit,
164    GL_EXT_texture_mirror_clamp_bit,
165    GL_EXT_texture_object_bit,
166    GL_EXT_vertex_array_bit,
167    GL_3DFX_texture_compression_FXT1_bit,
168    GL_APPLE_packed_pixels_bit,
169    GL_APPLE_ycbcr_422_bit,
170    GL_ATI_text_fragment_shader_bit,
171    GL_ATI_texture_env_combine3_bit,
172    GL_ATI_texture_float_bit,
173    GL_ATI_texture_mirror_once_bit,
174    GL_HP_convolution_border_modes_bit,
175    GL_HP_occlusion_test_bit,
176    GL_IBM_cull_vertex_bit,
177    GL_IBM_pixel_filter_hint_bit,
178    GL_IBM_rasterpos_clip_bit,
179    GL_IBM_texture_clamp_nodraw_bit,
180    GL_INGR_interlace_read_bit,
181    GL_MESA_pack_invert_bit,
182    GL_MESA_ycbcr_texture_bit,
183    GL_NV_blend_square_bit,
184    GL_NV_copy_depth_to_color_bit,
185    GL_NV_depth_clamp_bit,
186    GL_NV_fog_distance_bit,
187    GL_NV_fragment_program_bit,
188    GL_NV_fragment_program_option_bit,
189    GL_NV_fragment_program2_bit,
190    GL_NV_light_max_exponent_bit,
191    GL_NV_multisample_filter_hint_bit,
192    GL_NV_packed_depth_stencil_bit,
193    GL_NV_point_sprite_bit,
194    GL_NV_texgen_reflection_bit,
195    GL_NV_texture_compression_vtc_bit,
196    GL_NV_texture_env_combine4_bit,
197    GL_NV_vertex_program_bit,
198    GL_NV_vertex_program1_1_bit,
199    GL_NV_vertex_program2_bit,
200    GL_NV_vertex_program2_option_bit,
201    GL_NV_vertex_program3_bit,
202    GL_OES_compressed_paletted_texture_bit,
203    GL_OES_read_format_bit,
204    GL_SGI_color_matrix_bit,
205    GL_SGI_color_table_bit,
206    GL_SGI_texture_color_table_bit,
207    GL_SGIS_generate_mipmap_bit,
208    GL_SGIS_multisample_bit,
209    GL_SGIS_texture_lod_bit,
210    GL_SGIX_blend_alpha_minmax_bit,
211    GL_SGIX_clipmap_bit,
212    GL_SGIX_depth_texture_bit,
213    GL_SGIX_fog_offset_bit,
214    GL_SGIX_shadow_bit,
215    GL_SGIX_texture_coordinate_clamp_bit,
216    GL_SGIX_texture_lod_bias_bit,
217    GL_SGIX_texture_range_bit,
218    GL_SGIX_texture_scale_bias_bit,
219    GL_SGIX_vertex_preclip_bit,
220    GL_SGIX_vertex_preclip_hint_bit,
221    GL_SGIX_ycrcb_bit,
222    GL_SUN_convolution_border_modes_bit,
223    GL_SUN_slice_accum_bit,
224 
225    /* This *MUST* go here.  If it gets put after the duplicate values it will
226     * get the value after the last duplicate.
227     */
228    __NUM_GL_EXTS,
229 
230 
231    /* Alias extension bits.  These extensions exist in either vendor-specific
232     * or EXT form and were later promoted to either EXT or ARB form.  In all
233     * cases, the meaning (to GLX) is *exactly* the same.  That's why
234     * EXT_texture_env_combine is *NOT* an alias of ARB_texture_env_combine and
235     * EXT_texture_env_dot3 is *NOT* an alias of ARB_texture_env_dot3.  Be
236     * careful!  When in doubt, src/mesa/main/extensions.c is a great reference.
237     */
238 
239    GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit,
240    GL_ATI_draw_buffers_bit = GL_ARB_draw_buffers_bit,
241    GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit,
242    GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit,
243    GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit,
244    GL_EXT_texture_filter_anisotropic_bit = GL_ARB_texture_filter_anisotropic_bit,
245    GL_EXT_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
246    GL_IBM_texture_mirrored_repeat_bit = GL_ARB_texture_mirrored_repeat_bit,
247    GL_INGR_blend_func_separate_bit = GL_EXT_blend_func_separate_bit,
248    GL_MESA_window_pos_bit = GL_ARB_window_pos_bit,
249    GL_NV_texture_rectangle_bit = GL_ARB_texture_rectangle_bit,
250    GL_SGIS_texture_border_clamp_bit = GL_ARB_texture_border_clamp_bit,
251    GL_SGIS_texture_edge_clamp_bit = GL_EXT_texture_edge_clamp_bit,
252    GL_SGIX_shadow_ambient_bit = GL_ARB_shadow_ambient_bit,
253    GL_SUN_multi_draw_arrays_bit = GL_EXT_multi_draw_arrays_bit
254 };
255 
256 #define __GL_EXT_BYTES   ((__NUM_GL_EXTS + 7) / 8)
257 
258 struct glx_screen;
259 struct glx_context;
260 
261 extern GLboolean __glXExtensionBitIsEnabled(struct glx_screen *psc,
262                                             unsigned bit);
263 extern const char *__glXGetClientExtensions(Display *dpy);
264 extern void __glXCalculateUsableExtensions(struct glx_screen *psc,
265                                            GLboolean
266                                            display_is_direct_capable);
267 
268 extern void __glXParseExtensionOverride(struct glx_screen *psc,
269                                         const char *override);
270 extern void __IndirectGlParseExtensionOverride(struct glx_screen *psc,
271                                                const char *override);
272 extern void __glXCalculateUsableGLExtensions(struct glx_context *gc,
273                                              const char *server_string);
274 extern char *__glXGetClientGLExtensionString(void);
275 
276 extern GLboolean __glExtensionBitIsEnabled(struct glx_context *gc,
277                                            unsigned bit);
278 
279 extern void
280 __glXEnableDirectExtension(struct glx_screen *psc, const char *name);
281 
282 
283 /* GLX_ALIAS should be used for functions with a non-void return type.
284    GLX_ALIAS_VOID is for functions with a void return type. */
285 # ifdef HAVE_FUNC_ATTRIBUTE_ALIAS
286 /* GLX_ALIAS and GLX_ALIAS_VOID both expand to the macro GLX_ALIAS2. Using the
287  * extra expansion means that the name mangling macros in glx_mangle.h will
288  * apply before stringification, so the alias attribute will have a string like
289  * "mglXFoo" instead of "glXFoo". */
290 #  define GLX_ALIAS2(return_type, real_func, proto_args, args, aliased_func) \
291    return_type  real_func  proto_args                                   \
292    __attribute__ ((alias( # aliased_func ) ));
293 #  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
294    GLX_ALIAS2(return_type, real_func, proto_args, args, aliased_func)
295 #  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
296    GLX_ALIAS2(void, real_func, proto_args, args, aliased_func)
297 # else
298 #  define GLX_ALIAS(return_type, real_func, proto_args, args, aliased_func) \
299    return_type  real_func  proto_args                                   \
300    { return aliased_func args ; }
301 #  define GLX_ALIAS_VOID(real_func, proto_args, args, aliased_func) \
302    void  real_func  proto_args                                      \
303    { aliased_func args ; }
304 # endif /* HAVE_FUNC_ATTRIBUTE_ALIAS */
305 
306 #ifdef __cplusplus
307 }
308 #endif
309 
310 #endif /* GLX_GLXEXTENSIONS_H */
311