2004-10-25 22:09:16 +01:00
|
|
|
/*
|
|
|
|
* (C) Copyright IBM Corporation 2002, 2004
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
* the Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file glxextensions.c
|
|
|
|
*
|
|
|
|
* \author Ian Romanick <idr@us.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "glxclient.h"
|
2005-08-11 15:18:53 +01:00
|
|
|
#include <X11/extensions/extutil.h>
|
|
|
|
#include <X11/extensions/Xext.h>
|
2004-10-25 22:09:16 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include "glxextensions.h"
|
2008-09-18 20:26:30 +01:00
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
#define SET_BIT(m,b) (m[ (b) / 8 ] |= (1U << ((b) % 8)))
|
|
|
|
#define CLR_BIT(m,b) (m[ (b) / 8 ] &= ~(1U << ((b) % 8)))
|
|
|
|
#define IS_SET(m,b) ((m[ (b) / 8 ] & (1U << ((b) % 8))) != 0)
|
|
|
|
#define CONCAT(a,b) a ## b
|
|
|
|
#define GLX(n) "GLX_" # n, 4 + sizeof( # n ) - 1, CONCAT(n,_bit)
|
|
|
|
#define GL(n) "GL_" # n, 3 + sizeof( # n ) - 1, GL_ ## n ## _bit
|
|
|
|
#define VER(a,b) a, b
|
|
|
|
#define Y 1
|
|
|
|
#define N 0
|
|
|
|
#define EXT_ENABLED(bit,supported) (IS_SET( supported, bit ))
|
|
|
|
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
struct extension_info
|
|
|
|
{
|
|
|
|
const char *const name;
|
|
|
|
unsigned name_len;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned char bit;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/* This is the lowest version of GLX that "requires" this extension.
|
|
|
|
* For example, GLX 1.3 requires SGIX_fbconfig, SGIX_pbuffer, and
|
|
|
|
* SGI_make_current_read. If the extension is not required by any known
|
|
|
|
* version of GLX, use 0, 0.
|
|
|
|
*/
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned char version_major;
|
|
|
|
unsigned char version_minor;
|
|
|
|
unsigned char client_support;
|
|
|
|
unsigned char direct_support;
|
|
|
|
unsigned char client_only; /** Is the extension client-side only? */
|
|
|
|
unsigned char direct_only; /** Is the extension for direct
|
2004-10-25 22:09:16 +01:00
|
|
|
* contexts only?
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
/* *INDENT-OFF* */
|
2004-10-25 22:09:16 +01:00
|
|
|
static const struct extension_info known_glx_extensions[] = {
|
|
|
|
{ GLX(ARB_get_proc_address), VER(1,4), Y, N, Y, N },
|
|
|
|
{ GLX(ARB_multisample), VER(1,4), Y, Y, N, N },
|
|
|
|
{ GLX(ARB_render_texture), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(ATI_pixel_format_float), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(EXT_import_context), VER(0,0), Y, Y, N, N },
|
|
|
|
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
|
|
|
|
{ GLX(EXT_visual_rating), VER(0,0), Y, Y, N, N },
|
|
|
|
{ GLX(MESA_agp_offset), VER(0,0), N, N, N, Y }, /* Deprecated */
|
|
|
|
{ GLX(MESA_allocate_memory), VER(0,0), Y, N, N, Y },
|
2006-03-31 16:48:04 +01:00
|
|
|
{ GLX(MESA_copy_sub_buffer), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GLX(MESA_pixmap_colormap), VER(0,0), N, N, N, N }, /* Deprecated */
|
|
|
|
{ GLX(MESA_release_buffers), VER(0,0), N, N, N, N }, /* Deprecated */
|
|
|
|
{ GLX(MESA_swap_control), VER(0,0), Y, N, N, Y },
|
|
|
|
{ GLX(MESA_swap_frame_usage), VER(0,0), Y, N, N, Y },
|
|
|
|
{ GLX(NV_float_buffer), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(NV_render_depth_texture), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(NV_render_texture_rectangle), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(NV_vertex_array_range), VER(0,0), N, N, N, Y }, /* Deprecated */
|
2005-07-24 07:29:14 +01:00
|
|
|
{ GLX(OML_swap_method), VER(0,0), Y, Y, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GLX(OML_sync_control), VER(0,0), Y, N, N, Y },
|
|
|
|
{ GLX(SGI_make_current_read), VER(1,3), Y, N, N, N },
|
|
|
|
{ GLX(SGI_swap_control), VER(0,0), Y, N, N, N },
|
|
|
|
{ GLX(SGI_video_sync), VER(0,0), Y, N, N, Y },
|
|
|
|
{ GLX(SGIS_blended_overlay), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(SGIS_color_range), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(SGIS_multisample), VER(0,0), Y, Y, N, N },
|
2005-07-24 07:29:14 +01:00
|
|
|
{ GLX(SGIX_fbconfig), VER(1,3), Y, Y, N, N },
|
2009-01-28 03:12:24 +00:00
|
|
|
{ GLX(SGIX_pbuffer), VER(1,3), Y, Y, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GLX(SGIX_swap_barrier), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(SGIX_swap_group), VER(0,0), N, N, N, N },
|
|
|
|
{ GLX(SGIX_visual_select_group), VER(0,0), Y, Y, N, N },
|
2006-02-07 00:39:56 +00:00
|
|
|
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, N, N, N },
|
2009-11-12 16:48:07 +00:00
|
|
|
{ GLX(INTEL_swap_event), VER(1,4), Y, Y, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct extension_info known_gl_extensions[] = {
|
|
|
|
{ GL(ARB_depth_texture), VER(1,4), Y, N, N, N },
|
2005-03-11 20:55:03 +00:00
|
|
|
{ GL(ARB_draw_buffers), VER(0,0), Y, N, N, N },
|
Add GLX protocol support for ARB_fragement_program,
ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
2005-02-25 22:46:30 +00:00
|
|
|
{ GL(ARB_fragment_program), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N },
|
2009-11-12 21:28:12 +00:00
|
|
|
{ GL(ARB_framebuffer_object), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ARB_imaging), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ARB_multisample), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(ARB_multitexture), VER(1,3), Y, N, N, N },
|
2005-03-11 20:55:03 +00:00
|
|
|
{ GL(ARB_occlusion_query), VER(1,5), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ARB_point_parameters), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(ARB_point_sprite), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ARB_shadow), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(ARB_shadow_ambient), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_border_clamp), VER(1,3), Y, N, N, N },
|
2005-02-04 19:29:30 +00:00
|
|
|
{ GL(ARB_texture_compression), VER(1,3), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ARB_texture_cube_map), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_env_add), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_env_combine), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_env_crossbar), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_env_dot3), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_mirrored_repeat), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(ARB_texture_non_power_of_two), VER(1,5), Y, N, N, N },
|
2004-12-01 00:20:22 +00:00
|
|
|
{ GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
|
|
|
|
{ GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
|
Add GLX protocol support for ARB_fragement_program,
ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
2005-02-25 22:46:30 +00:00
|
|
|
{ GL(ARB_vertex_program), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ARB_window_pos), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_abgr), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_bgra), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_blend_color), VER(1,4), Y, N, N, N },
|
2006-08-25 20:57:37 +01:00
|
|
|
{ GL(EXT_blend_equation_separate), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(EXT_blend_func_separate), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_blend_logic_op), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_blend_minmax), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_blend_subtract), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_clip_volume_hint), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_compiled_vertex_array), VER(0,0), N, N, N, N },
|
|
|
|
{ GL(EXT_convolution), VER(0,0), N, N, N, N },
|
|
|
|
{ GL(EXT_copy_texture), VER(1,1), Y, N, N, N },
|
|
|
|
{ GL(EXT_cull_vertex), VER(0,0), N, N, N, N },
|
|
|
|
{ GL(EXT_depth_bounds_test), VER(0,0), N, N, N, N },
|
|
|
|
{ GL(EXT_draw_range_elements), VER(1,2), Y, N, Y, N },
|
|
|
|
{ GL(EXT_fog_coord), VER(1,4), Y, N, N, N },
|
2009-11-12 21:28:12 +00:00
|
|
|
{ GL(EXT_framebuffer_blit), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_framebuffer_multisample), VER(0,0), Y, N, N, N },
|
2006-02-24 15:36:24 +00:00
|
|
|
{ GL(EXT_framebuffer_object), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N },
|
2009-11-12 21:28:12 +00:00
|
|
|
{ GL(EXT_packed_depth_stencil), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(EXT_packed_pixels), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_paletted_texture), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_pixel_buffer_object), VER(0,0), N, N, N, N },
|
|
|
|
{ GL(EXT_point_parameters), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_polygon_offset), VER(1,1), Y, N, N, N },
|
|
|
|
{ GL(EXT_rescale_normal), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_secondary_color), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_separate_specular_color), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_shadow_funcs), VER(1,5), Y, N, N, N },
|
|
|
|
{ GL(EXT_shared_texture_palette), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_stencil_two_side), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_stencil_wrap), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_subtexture), VER(1,1), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture), VER(1,1), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture3D), VER(1,2), Y, N, N, N },
|
2005-02-04 19:29:30 +00:00
|
|
|
{ GL(EXT_texture_compression_dxt1), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_compression_s3tc), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(EXT_texture_edge_clamp), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_env_add), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_env_combine), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_env_dot3), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_filter_anisotropic), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_lod), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_lod_bias), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_mirror_clamp), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_object), VER(1,1), Y, N, N, N },
|
|
|
|
{ GL(EXT_texture_rectangle), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(EXT_vertex_array), VER(0,0), Y, N, N, N },
|
2005-02-04 19:29:30 +00:00
|
|
|
{ GL(3DFX_texture_compression_FXT1), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(APPLE_packed_pixels), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(APPLE_ycbcr_422), VER(0,0), Y, N, N, N },
|
2005-03-11 20:55:03 +00:00
|
|
|
{ GL(ATI_draw_buffers), VER(0,0), Y, N, N, N },
|
Add GLX protocol support for ARB_fragement_program,
ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
2005-02-25 22:46:30 +00:00
|
|
|
{ GL(ATI_text_fragment_shader), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(ATI_texture_env_combine3), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ATI_texture_float), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ATI_texture_mirror_once), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(ATIX_texture_env_combine3), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(HP_convolution_border_modes), VER(0,0), Y, N, N, N },
|
2004-11-30 23:29:51 +00:00
|
|
|
{ GL(HP_occlusion_test), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(IBM_cull_vertex), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(IBM_pixel_filter_hint), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(IBM_rasterpos_clip), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(IBM_texture_clamp_nodraw), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(IBM_texture_mirrored_repeat), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(INGR_blend_func_separate), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(INGR_interlace_read), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(MESA_pack_invert), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(MESA_ycbcr_texture), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_blend_square), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(NV_copy_depth_to_color), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_depth_clamp), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_fog_distance), VER(0,0), Y, N, N, N },
|
Add GLX protocol support for ARB_fragement_program,
ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
2005-02-25 22:46:30 +00:00
|
|
|
{ GL(NV_fragment_program), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_fragment_program_option), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_fragment_program2), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
|
2009-11-12 21:28:12 +00:00
|
|
|
{ GL(NV_packed_depth_stencil), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(NV_point_sprite), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_texgen_reflection), VER(0,0), Y, N, N, N },
|
2005-02-04 19:29:30 +00:00
|
|
|
{ GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(NV_texture_env_combine4), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_texture_rectangle), VER(0,0), Y, N, N, N },
|
Add GLX protocol support for ARB_fragement_program,
ARB_fragment_program_shadow, ARB_vertex_program, NV_fragment_program,
NV_fragment_program_option, NV_fragment_program2, NV_vertex_program,
NV_vertex_program1_1, NV_vertex_program2, NV_vertex_program2_option,
NV_vertex_program3, and ATI_text_fragment_shader.
2005-02-25 22:46:30 +00:00
|
|
|
{ GL(NV_vertex_program), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_vertex_program1_1), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_vertex_program2), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_vertex_program2_option), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(NV_vertex_program3), VER(0,0), Y, N, N, N },
|
2004-12-01 00:20:22 +00:00
|
|
|
{ GL(OES_read_format), VER(0,0), Y, N, N, N },
|
2005-02-04 19:29:30 +00:00
|
|
|
{ GL(OES_compressed_paletted_texture),VER(0,0), Y, N, N, N },
|
2005-02-03 00:38:40 +00:00
|
|
|
{ GL(SGI_color_matrix), VER(0,0), Y, N, N, N },
|
2006-08-24 22:42:38 +01:00
|
|
|
{ GL(SGI_color_table), VER(0,0), Y, N, N, N },
|
2005-02-03 00:38:40 +00:00
|
|
|
{ GL(SGI_texture_color_table), VER(0,0), Y, N, N, N },
|
2004-10-25 22:09:16 +01:00
|
|
|
{ GL(SGIS_generate_mipmap), VER(1,4), Y, N, N, N },
|
|
|
|
{ GL(SGIS_multisample), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIS_texture_border_clamp), VER(1,3), Y, N, N, N },
|
|
|
|
{ GL(SGIS_texture_edge_clamp), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(SGIS_texture_lod), VER(1,2), Y, N, N, N },
|
|
|
|
{ GL(SGIX_blend_alpha_minmax), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_clipmap), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_depth_texture), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_fog_offset), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_shadow), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_shadow_ambient), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_texture_coordinate_clamp), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_texture_lod_bias), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_texture_range), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_texture_scale_bias), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_vertex_preclip), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_vertex_preclip_hint), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SGIX_ycrcb), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SUN_convolution_border_modes), VER(0,0), Y, N, N, N },
|
|
|
|
{ GL(SUN_multi_draw_arrays), VER(0,0), Y, N, Y, N },
|
|
|
|
{ GL(SUN_slice_accum), VER(0,0), Y, N, N, N },
|
|
|
|
{ NULL }
|
|
|
|
};
|
2008-10-13 14:10:59 +01:00
|
|
|
/* *INDENT-ON* */
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* global bit-fields of available extensions and their characteristics */
|
|
|
|
static unsigned char client_glx_support[8];
|
|
|
|
static unsigned char client_glx_only[8];
|
|
|
|
static unsigned char direct_glx_only[8];
|
2008-10-13 14:10:59 +01:00
|
|
|
static unsigned char client_gl_support[__GL_EXT_BYTES];
|
|
|
|
static unsigned char client_gl_only[__GL_EXT_BYTES];
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bits representing the set of extensions that are enabled by default in all
|
|
|
|
* direct rendering drivers.
|
|
|
|
*/
|
|
|
|
static unsigned char direct_glx_support[8];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Highest core GL version that can be supported for indirect rendering.
|
|
|
|
*/
|
2005-03-17 01:36:24 +00:00
|
|
|
static const unsigned gl_major = 1;
|
|
|
|
static const unsigned gl_minor = 4;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/* client extensions string */
|
2008-10-13 14:10:59 +01:00
|
|
|
static const char *__glXGLXClientExtensions = NULL;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
static void __glXExtensionsCtr(void);
|
|
|
|
static void __glXExtensionsCtrScreen(__GLXscreenConfigs * psc);
|
|
|
|
static void __glXProcessServerString(const struct extension_info *ext,
|
|
|
|
const char *server_string,
|
|
|
|
unsigned char *server_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the state of a GLX extension.
|
|
|
|
*
|
|
|
|
* \param name Name of the extension.
|
|
|
|
* \param name_len Length, in characters, of the extension name.
|
|
|
|
* \param state New state (either enabled or disabled) of the extension.
|
|
|
|
* \param supported Table in which the state of the extension is to be set.
|
|
|
|
*/
|
|
|
|
static void
|
2008-10-13 14:10:59 +01:00
|
|
|
set_glx_extension(const struct extension_info *ext,
|
|
|
|
const char *name, unsigned name_len, GLboolean state,
|
|
|
|
unsigned char *supported)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned i;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; ext[i].name != NULL; i++) {
|
|
|
|
if ((name_len == ext[i].name_len)
|
|
|
|
&& (strncmp(ext[i].name, name, name_len) == 0)) {
|
|
|
|
if (state) {
|
|
|
|
SET_BIT(supported, ext[i].bit);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
CLR_BIT(supported, ext[i].bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
return;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define NUL '\0'
|
|
|
|
#define SEPARATOR ' '
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert the server's extension string to a bit-field.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2004-10-25 22:09:16 +01:00
|
|
|
* \param server_string GLX extension string from the server.
|
|
|
|
* \param server_support Bit-field of supported extensions.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2006-07-13 16:27:37 +01:00
|
|
|
* \note
|
|
|
|
* This function is used to process both GLX and GL extension strings. The
|
|
|
|
* bit-fields used to track each of these have different sizes. Therefore,
|
|
|
|
* the data pointed by \c server_support must be preinitialized to zero.
|
2004-10-25 22:09:16 +01:00
|
|
|
*/
|
|
|
|
static void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXProcessServerString(const struct extension_info *ext,
|
|
|
|
const char *server_string,
|
|
|
|
unsigned char *server_support)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned base;
|
|
|
|
unsigned len;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (base = 0; server_string[base] != NUL; /* empty */ ) {
|
2004-10-25 22:09:16 +01:00
|
|
|
/* Determine the length of the next extension name.
|
|
|
|
*/
|
2008-10-13 14:10:59 +01:00
|
|
|
for (len = 0; (server_string[base + len] != SEPARATOR)
|
2009-08-12 11:41:22 +01:00
|
|
|
&& (server_string[base + len] != NUL); len++) {
|
2008-10-13 14:10:59 +01:00
|
|
|
/* empty */
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the bit for the extension in the server_support table.
|
|
|
|
*/
|
2008-10-13 14:10:59 +01:00
|
|
|
set_glx_extension(ext, &server_string[base], len, GL_TRUE,
|
|
|
|
server_support);
|
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/* Advance to the next extension string. This means that we skip
|
|
|
|
* over the previous string and any trialing white-space.
|
|
|
|
*/
|
2008-10-13 14:10:59 +01:00
|
|
|
for (base += len; (server_string[base] == SEPARATOR)
|
2009-08-12 11:41:22 +01:00
|
|
|
&& (server_string[base] != NUL); base++) {
|
2008-10-13 14:10:59 +01:00
|
|
|
/* empty */
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtr();
|
|
|
|
__glXExtensionsCtrScreen(psc);
|
2007-05-17 20:47:47 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
set_glx_extension(known_glx_extensions,
|
|
|
|
name, strlen(name), GL_TRUE, psc->direct_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize global extension support tables.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtr(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned i;
|
2004-10-25 22:09:16 +01:00
|
|
|
static GLboolean ext_list_first_time = GL_TRUE;
|
|
|
|
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (ext_list_first_time) {
|
2004-10-25 22:09:16 +01:00
|
|
|
ext_list_first_time = GL_FALSE;
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
(void) memset(client_glx_support, 0, sizeof(client_glx_support));
|
|
|
|
(void) memset(direct_glx_support, 0, sizeof(direct_glx_support));
|
|
|
|
(void) memset(client_glx_only, 0, sizeof(client_glx_only));
|
|
|
|
(void) memset(direct_glx_only, 0, sizeof(direct_glx_only));
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
(void) memset(client_gl_support, 0, sizeof(client_gl_support));
|
|
|
|
(void) memset(client_gl_only, 0, sizeof(client_gl_only));
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; known_glx_extensions[i].name != NULL; i++) {
|
|
|
|
const unsigned bit = known_glx_extensions[i].bit;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_glx_extensions[i].client_support) {
|
|
|
|
SET_BIT(client_glx_support, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_glx_extensions[i].direct_support) {
|
|
|
|
SET_BIT(direct_glx_support, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_glx_extensions[i].client_only) {
|
|
|
|
SET_BIT(client_glx_only, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_glx_extensions[i].direct_only) {
|
|
|
|
SET_BIT(direct_glx_only, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; known_gl_extensions[i].name != NULL; i++) {
|
|
|
|
const unsigned bit = known_gl_extensions[i].bit;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_gl_extensions[i].client_support) {
|
|
|
|
SET_BIT(client_gl_support, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (known_gl_extensions[i].client_only) {
|
|
|
|
SET_BIT(client_gl_only, bit);
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
2008-10-13 14:10:59 +01:00
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
#if 0
|
2008-10-13 14:10:59 +01:00
|
|
|
fprintf(stderr, "[%s:%u] Maximum client library version: %u.%u\n",
|
|
|
|
__func__, __LINE__, gl_major, gl_minor);
|
2004-10-25 22:09:16 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure that per-screen direct-support table is initialized.
|
|
|
|
*
|
|
|
|
* \param psc Pointer to GLX per-screen record.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtrScreen(__GLXscreenConfigs * psc)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
if (psc->ext_list_first_time) {
|
|
|
|
psc->ext_list_first_time = GL_FALSE;
|
|
|
|
(void) memcpy(psc->direct_support, direct_glx_support,
|
|
|
|
sizeof(direct_glx_support));
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a certain extension is enabled on a given screen.
|
|
|
|
*
|
|
|
|
* \param psc Pointer to GLX per-screen record.
|
|
|
|
* \param bit Bit index in the direct-support table.
|
|
|
|
* \returns If the extension bit is enabled for the screen, \c GL_TRUE is
|
|
|
|
* returned. If the extension bit is not enabled or if \c psc is
|
|
|
|
* \c NULL, then \c GL_FALSE is returned.
|
|
|
|
*/
|
|
|
|
GLboolean
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionBitIsEnabled(__GLXscreenConfigs * psc, unsigned bit)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
|
|
|
GLboolean enabled = GL_FALSE;
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (psc != NULL) {
|
2004-10-25 22:09:16 +01:00
|
|
|
__glXExtensionsCtr();
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtrScreen(psc);
|
|
|
|
enabled = EXT_ENABLED(bit, psc->direct_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-22 22:36:31 +00:00
|
|
|
/**
|
|
|
|
* Check if a certain extension is enabled in a given context.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
GLboolean
|
2008-10-13 14:10:59 +01:00
|
|
|
__glExtensionBitIsEnabled(const __GLXcontext * gc, unsigned bit)
|
2005-02-22 22:36:31 +00:00
|
|
|
{
|
|
|
|
GLboolean enabled = GL_FALSE;
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (gc != NULL) {
|
|
|
|
enabled = EXT_ENABLED(bit, gc->gl_extension_bits);
|
2005-02-22 22:36:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
/**
|
|
|
|
* Convert a bit-field to a string of supported extensions.
|
|
|
|
*/
|
|
|
|
static char *
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXGetStringFromTable(const struct extension_info *ext,
|
|
|
|
const unsigned char *supported)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned i;
|
|
|
|
unsigned ext_str_len;
|
|
|
|
char *ext_str;
|
|
|
|
char *point;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
ext_str_len = 0;
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; ext[i].name != NULL; i++) {
|
|
|
|
if (EXT_ENABLED(ext[i].bit, supported)) {
|
|
|
|
ext_str_len += ext[i].name_len + 1;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
ext_str = Xmalloc(ext_str_len + 1);
|
|
|
|
if (ext_str != NULL) {
|
2004-10-25 22:09:16 +01:00
|
|
|
point = ext_str;
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; ext[i].name != NULL; i++) {
|
|
|
|
if (EXT_ENABLED(ext[i].bit, supported)) {
|
|
|
|
(void) memcpy(point, ext[i].name, ext[i].name_len);
|
|
|
|
point += ext[i].name_len;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
*point = ' ';
|
|
|
|
point++;
|
|
|
|
}
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
*point = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
return ext_str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the string of client library supported extensions.
|
|
|
|
*/
|
|
|
|
const char *
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXGetClientExtensions(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
if (__glXGLXClientExtensions == NULL) {
|
2004-10-25 22:09:16 +01:00
|
|
|
__glXExtensionsCtr();
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXGLXClientExtensions = __glXGetStringFromTable(known_glx_extensions,
|
|
|
|
client_glx_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return __glXGLXClientExtensions;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the list of application usable extensions. The resulting
|
|
|
|
* string is stored in \c psc->effectiveGLXexts.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2004-10-25 22:09:16 +01:00
|
|
|
* \param psc Pointer to GLX per-screen record.
|
|
|
|
* \param display_is_direct_capable True if the display is capable of
|
|
|
|
* direct rendering.
|
|
|
|
* \param minor_version GLX minor version from the server.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
|
|
|
|
GLboolean display_is_direct_capable,
|
|
|
|
int minor_version)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
|
|
|
unsigned char server_support[8];
|
|
|
|
unsigned char usable[8];
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned i;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
__glXExtensionsCtr();
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtrScreen(psc);
|
2006-07-13 16:27:37 +01:00
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
(void) memset(server_support, 0, sizeof(server_support));
|
|
|
|
__glXProcessServerString(known_glx_extensions,
|
|
|
|
psc->serverGLXexts, server_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* This is a hack. Some servers support GLX 1.3 but don't export
|
|
|
|
* all of the extensions implied by GLX 1.3. If the server claims
|
|
|
|
* support for GLX 1.3, enable support for the extensions that can be
|
|
|
|
* "emulated" as well.
|
|
|
|
*/
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (minor_version >= 3) {
|
|
|
|
SET_BIT(server_support, EXT_visual_info_bit);
|
|
|
|
SET_BIT(server_support, EXT_visual_rating_bit);
|
|
|
|
SET_BIT(server_support, SGI_make_current_read_bit);
|
|
|
|
SET_BIT(server_support, SGIX_fbconfig_bit);
|
|
|
|
SET_BIT(server_support, SGIX_pbuffer_bit);
|
|
|
|
|
2004-10-25 22:09:16 +01:00
|
|
|
/* This one is a little iffy. GLX 1.3 doesn't incorporate all of this
|
|
|
|
* extension. However, the only part that is not strictly client-side
|
|
|
|
* is shared. That's the glXQueryContext / glXQueryContextInfoEXT
|
|
|
|
* function.
|
|
|
|
*/
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
SET_BIT(server_support, EXT_import_context_bit);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* An extension is supported if the client-side (i.e., libGL) supports
|
|
|
|
* it and the "server" supports it. In this case that means that either
|
|
|
|
* the true server supports it or it is only for direct-rendering and
|
|
|
|
* the direct rendering driver supports it.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2004-10-25 22:09:16 +01:00
|
|
|
* If the display is not capable of direct rendering, then the extension
|
|
|
|
* is enabled if and only if the client-side library and the server
|
|
|
|
* support it.
|
|
|
|
*/
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
if (display_is_direct_capable) {
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
usable[i] = (client_glx_support[i] & client_glx_only[i])
|
2009-08-12 11:41:22 +01:00
|
|
|
| (client_glx_support[i] & psc->direct_support[i] &
|
|
|
|
server_support[i])
|
|
|
|
| (client_glx_support[i] & psc->direct_support[i] &
|
|
|
|
direct_glx_only[i]);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
usable[i] = (client_glx_support[i] & client_glx_only[i])
|
|
|
|
| (client_glx_support[i] & server_support[i]);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
psc->effectiveGLXexts = __glXGetStringFromTable(known_glx_extensions,
|
|
|
|
usable);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the list of application usable extensions. The resulting
|
|
|
|
* string is stored in \c gc->extensions.
|
2009-08-12 11:41:22 +01:00
|
|
|
*
|
2004-10-25 22:09:16 +01:00
|
|
|
* \param gc Pointer to GLX context.
|
|
|
|
* \param server_string Extension string from the server.
|
|
|
|
* \param major_version GL major version from the server.
|
|
|
|
* \param minor_version GL minor version from the server.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXCalculateUsableGLExtensions(__GLXcontext * gc,
|
|
|
|
const char *server_string,
|
|
|
|
int major_version, int minor_version)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
unsigned char server_support[__GL_EXT_BYTES];
|
|
|
|
unsigned char usable[__GL_EXT_BYTES];
|
|
|
|
unsigned i;
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
__glXExtensionsCtr();
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
(void) memset(server_support, 0, sizeof(server_support));
|
|
|
|
__glXProcessServerString(known_gl_extensions, server_string,
|
|
|
|
server_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Handle lazy servers that don't export all the extensions strings that
|
|
|
|
* are part of the GL core version that they support.
|
|
|
|
*/
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; i < __GL_EXT_BYTES; i++) {
|
|
|
|
if ((known_gl_extensions[i].version_major != 0)
|
|
|
|
&& ((major_version > known_gl_extensions[i].version_major)
|
|
|
|
|| ((major_version == known_gl_extensions[i].version_major)
|
|
|
|
&& (minor_version >=
|
|
|
|
known_gl_extensions[i].version_minor)))) {
|
|
|
|
SET_BIT(server_support, known_gl_extensions[i].bit);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* An extension is supported if the client-side (i.e., libGL) supports
|
|
|
|
* it and the server supports it or the client-side library supports it
|
|
|
|
* and it only needs client-side support.
|
|
|
|
*/
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
for (i = 0; i < __GL_EXT_BYTES; i++) {
|
2004-10-25 22:09:16 +01:00
|
|
|
usable[i] = (client_gl_support[i] & client_gl_only[i])
|
2008-10-13 14:10:59 +01:00
|
|
|
| (client_gl_support[i] & server_support[i]);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
2008-10-13 14:10:59 +01:00
|
|
|
gc->extensions = (unsigned char *)
|
|
|
|
__glXGetStringFromTable(known_gl_extensions, usable);
|
|
|
|
(void) memcpy(gc->gl_extension_bits, usable, sizeof(usable));
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculates the maximum core GL version that can be supported for indirect
|
|
|
|
* rendering.
|
|
|
|
*/
|
|
|
|
void
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXGetGLVersion(int *major_version, int *minor_version)
|
|
|
|
{
|
|
|
|
__glXExtensionsCtr();
|
|
|
|
*major_version = gl_major;
|
|
|
|
*minor_version = gl_minor;
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a string representing the set of extensions supported by the client
|
|
|
|
* library. This is currently only used to send the list of extensions
|
|
|
|
* supported by the client to the server.
|
|
|
|
*/
|
|
|
|
char *
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXGetClientGLExtensionString(void)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2008-10-13 14:10:59 +01:00
|
|
|
__glXExtensionsCtr();
|
|
|
|
return __glXGetStringFromTable(known_gl_extensions, client_gl_support);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|