summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridr <idr>2004-06-11 00:12:23 +0000
committeridr <idr>2004-06-11 00:12:23 +0000
commit02c30fcb647f8db556197a6d1be6ec3e17650eda (patch)
tree5b868f7896b5d2f4fe8f5aa46f2f2afe713cae9e
parent85e4d378ef7ffdd106b4756100d43862d0b93ed3 (diff)
Generalize the existing GLX extension tracking mechanism so that it
can also be used for GL extensions. Modify glGetString to use the new mechanism. This allows us to, among other things, enable extensions that are implemented entirely client-side (i.e., GL_ARB_transpose_matrix).
-rw-r--r--xc/lib/GL/glx/glxextensions.c333
-rw-r--r--xc/lib/GL/glx/glxextensions.h148
-rw-r--r--xc/lib/GL/glx/single2.c3
3 files changed, 430 insertions, 54 deletions
diff --git a/xc/lib/GL/glx/glxextensions.c b/xc/lib/GL/glx/glxextensions.c
index 7bea8f21f..4d34156a1 100644
--- a/xc/lib/GL/glx/glxextensions.c
+++ b/xc/lib/GL/glx/glxextensions.c
@@ -1,5 +1,5 @@
/*
- * (c) Copyright IBM Corporation 2002
+ * (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -20,9 +20,12 @@
* 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
*
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
+ * \author Ian Romanick <idr@us.ibm.com>
*/
/* $XFree86:$ */
@@ -39,12 +42,14 @@
#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) ((bit < 255) && IS_SET( supported, bit ))
+#define EXT_ENABLED(bit,supported) (IS_SET( supported, bit ))
+
-static const struct {
+struct extension_info {
const char * const name;
unsigned name_len;
@@ -63,7 +68,9 @@ static const struct {
unsigned char direct_only; /** Is the extension for direct
* contexts only?
*/
-} known_glx_extensions[] = {
+};
+
+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 },
@@ -104,24 +111,160 @@ static const struct {
{ NULL }
};
+static const struct extension_info known_gl_extensions[] = {
+ { GL(ARB_depth_texture), VER(1,4), Y, N, N, N },
+ { GL(ARB_fragment_program), VER(0,0), N, N, N, N },
+ { 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 },
+ { GL(ARB_occlusion_query), VER(1,5), N, N, N, N },
+ { 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 },
+ { GL(ARB_texture_compression), VER(1,3), N, N, N, N },
+ { 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 },
+ { GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
+ { GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
+ { 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 },
+ { GL(EXT_blend_equation_separate), VER(0,0), N, N, N, N },
+ { 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 },
+ { GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N },
+ { 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 },
+ { GL(EXT_texture_compression_s3tc), VER(0,0), N, N, N, N },
+ { 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 },
+ { GL(3DFX_texture_compression_FXT1), VER(0,0), N, N, N, N },
+ { GL(APPLE_packed_pixels), VER(1,2), Y, N, N, N },
+ { GL(APPLE_ycbcr_422), VER(0,0), Y, N, N, N },
+ { 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 },
+
+ /* This is currently removed because there seem to be some problems with
+ * it and the software-only indirect rendering path. At this point, I'm
+ * not sure which side (client or server) has the problem. - idr
+ */
+ { GL(HP_occlusion_test), VER(0,0), N, N, N, N },
+
+ { 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 },
+ { GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
+ { GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
+ { GL(NV_point_sprite), VER(0,0), Y, N, N, N },
+ { GL(NV_texgen_reflection), VER(0,0), Y, N, N, N },
+ { GL(NV_texture_env_combine4), VER(0,0), Y, N, N, N },
+ { GL(NV_texture_rectangle), VER(0,0), Y, N, N, N },
+ { 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 }
+};
+
+
+#define __GL_EXT_BYTES ((__NUM_GL_EXTS + 7) / 8)
+
/* global bit-fields of available extensions and their characteristics */
-static unsigned char client_support[8];
-static unsigned char client_only[8];
-static unsigned char direct_only[8];
+static unsigned char client_glx_support[8];
+static unsigned char client_glx_only[8];
+static unsigned char direct_glx_only[8];
+static unsigned char client_gl_support[ __GL_EXT_BYTES ];
+static unsigned char client_gl_only[ __GL_EXT_BYTES ];
/**
* Bits representing the set of extensions that are enabled by default in all
* direct rendering drivers.
*/
-static unsigned char direct_support[8];
+static unsigned char direct_glx_support[8];
+
+/**
+ * Highest core GL version that can be supported for indirect rendering.
+ */
+static unsigned gl_major = 0;
+static unsigned gl_minor = 0;
/* client extensions string */
static const char * __glXGLXClientExtensions = NULL;
static void __glXExtensionsCtr( void );
static void __glXExtensionsCtrScreen( __GLXscreenConfigs *psc );
-static void __glXProcessServerString( const char * server_string,
- unsigned char * server_support );
+static void __glXProcessServerString( const struct extension_info * ext,
+ const char * server_string, unsigned char * server_support );
/**
* Set the state of a GLX extension.
@@ -132,20 +275,21 @@ static void __glXProcessServerString( const char * server_string,
* \param supported Table in which the state of the extension is to be set.
*/
static void
-set_glx_extension( const char * name, unsigned name_len, GLboolean state,
+set_glx_extension( const struct extension_info * ext,
+ const char * name, unsigned name_len, GLboolean state,
unsigned char * supported )
{
unsigned i;
- for ( i = 0 ; known_glx_extensions[i].name != NULL ; i++ ) {
- if ( (name_len == known_glx_extensions[i].name_len)
- && (strncmp( known_glx_extensions[i].name, name, name_len ) == 0) ) {
+ 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, known_glx_extensions[i].bit );
+ SET_BIT( supported, ext[i].bit );
}
else {
- CLR_BIT( supported, known_glx_extensions[i].bit );
+ CLR_BIT( supported, ext[i].bit );
}
return;
@@ -164,7 +308,8 @@ set_glx_extension( const char * name, unsigned name_len, GLboolean state,
* \param server_support Bit-field of supported extensions.
*/
static void
-__glXProcessServerString( const char * server_string,
+__glXProcessServerString( const struct extension_info * ext,
+ const char * server_string,
unsigned char * server_support )
{
unsigned base;
@@ -184,9 +329,10 @@ __glXProcessServerString( const char * server_string,
/* Set the bit for the extension in the server_support table.
*/
- set_glx_extension( & server_string[ base ], len, GL_TRUE,
+ set_glx_extension( ext, & server_string[ base ], len, GL_TRUE,
server_support );
-
+
+
/* Advance to the next extension string. This means that we skip
* over the previous string and any trialing white-space.
*/
@@ -217,7 +363,8 @@ __glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name )
{
__glXExtensionsCtr();
__glXExtensionsCtrScreen(psc);
- set_glx_extension( name, strlen( name ), GL_TRUE, psc->direct_support );
+ set_glx_extension( known_glx_extensions, name, strlen( name ), GL_TRUE,
+ psc->direct_support );
}
@@ -228,37 +375,68 @@ __glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name )
static void
__glXExtensionsCtr( void )
{
+ static const char major_table[32] = { 1, 1, 1, 1, 1, 1, 2, };
+ static const char minor_table[32] = { 0, 1, 2, 3, 4, 5, 0, };
unsigned i;
static GLboolean ext_list_first_time = GL_TRUE;
+ unsigned full_support = ~0;
if ( ext_list_first_time ) {
ext_list_first_time = GL_FALSE;
- (void) memset( client_support, 0, sizeof( client_support ) );
- (void) memset( direct_support, 0, sizeof( direct_support ) );
- (void) memset( client_only, 0, sizeof( client_only ) );
- (void) memset( direct_only, 0, sizeof( direct_only ) );
+ (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 ) );
+
+ (void) memset( client_gl_support, 0, sizeof( client_gl_support ) );
+ (void) memset( client_gl_only, 0, sizeof( client_gl_only ) );
for ( i = 0 ; known_glx_extensions[i].name != NULL ; i++ ) {
const unsigned bit = known_glx_extensions[i].bit;
if ( known_glx_extensions[i].client_support ) {
- SET_BIT( client_support, bit );
+ SET_BIT( client_glx_support, bit );
}
if ( known_glx_extensions[i].direct_support ) {
- SET_BIT( direct_support, bit );
+ SET_BIT( direct_glx_support, bit );
}
if ( known_glx_extensions[i].client_only ) {
- SET_BIT( client_only, bit );
+ SET_BIT( client_glx_only, bit );
}
if ( known_glx_extensions[i].direct_only ) {
- SET_BIT( direct_only, bit );
+ SET_BIT( direct_glx_only, bit );
+ }
+ }
+
+ for ( i = 0 ; known_gl_extensions[i].name != NULL ; i++ ) {
+ const unsigned bit = known_gl_extensions[i].bit;
+
+ if ( known_gl_extensions[i].client_support ) {
+ SET_BIT( client_gl_support, bit );
+ }
+ else if ( known_gl_extensions[i].version_major != 0 ) {
+ unsigned ver_bit = (6 * (known_gl_extensions[i].version_major - 1))
+ + (known_gl_extensions[i].version_minor);
+
+ full_support &= ~(1U << ver_bit);
+ }
+
+ if ( known_gl_extensions[i].client_only ) {
+ SET_BIT( client_gl_only, bit );
}
}
+
+ for ( i = 0 ; (full_support & (1 << i)) != 0 ; i++ )
+ /* empty */ ;
+
+ i--;
+ gl_major = major_table[i];
+ gl_minor = minor_table[i];
}
}
@@ -274,8 +452,8 @@ __glXExtensionsCtrScreen( __GLXscreenConfigs *psc )
{
if (psc->ext_list_first_time) {
psc->ext_list_first_time = GL_FALSE;
- (void) memcpy( psc->direct_support, direct_support,
- sizeof( direct_support ) );
+ (void) memcpy( psc->direct_support, direct_glx_support,
+ sizeof( direct_glx_support ) );
}
}
@@ -308,7 +486,8 @@ __glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit )
* Convert a bit-field to a string of supported extensions.
*/
static char *
-__glXGetStringFromTable( const unsigned char * supported )
+__glXGetStringFromTable( const struct extension_info * ext,
+ const unsigned char * supported )
{
unsigned i;
unsigned ext_str_len;
@@ -317,9 +496,9 @@ __glXGetStringFromTable( const unsigned char * supported )
ext_str_len = 0;
- for ( i = 0 ; known_glx_extensions[i].name != NULL ; i++ ) {
- if ( EXT_ENABLED( known_glx_extensions[i].bit, supported ) ) {
- ext_str_len += known_glx_extensions[i].name_len + 1;
+ for ( i = 0 ; ext[i].name != NULL ; i++ ) {
+ if ( EXT_ENABLED( ext[i].bit, supported ) ) {
+ ext_str_len += ext[i].name_len + 1;
}
}
@@ -327,11 +506,10 @@ __glXGetStringFromTable( const unsigned char * supported )
if ( ext_str != NULL ) {
point = ext_str;
- for ( i = 0 ; known_glx_extensions[i].name != NULL ; i++ ) {
- if ( EXT_ENABLED( known_glx_extensions[i].bit, supported ) ) {
- (void) memcpy( point, known_glx_extensions[i].name,
- known_glx_extensions[i].name_len );
- point += known_glx_extensions[i].name_len;
+ 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;
*point = ' ';
point++;
@@ -353,7 +531,8 @@ __glXGetClientExtensions( void )
{
if ( __glXGLXClientExtensions == NULL ) {
__glXExtensionsCtr();
- __glXGLXClientExtensions = __glXGetStringFromTable( client_support );
+ __glXGLXClientExtensions = __glXGetStringFromTable( known_glx_extensions,
+ client_glx_support );
}
return __glXGLXClientExtensions;
@@ -381,7 +560,8 @@ __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
__glXExtensionsCtr();
__glXExtensionsCtrScreen( psc );
- __glXProcessServerString( psc->serverGLXexts, server_support );
+ __glXProcessServerString( known_glx_extensions,
+ psc->serverGLXexts, server_support );
/* This is a hack. Some servers support GLX 1.3 but don't export
@@ -419,17 +599,72 @@ __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
if ( display_is_direct_capable ) {
for ( i = 0 ; i < 8 ; i++ ) {
- usable[i] = (client_support[i] & client_only[i])
- | (client_support[i] & psc->direct_support[i] & server_support[i])
- | (client_support[i] & psc->direct_support[i] & direct_only[i]);
+ usable[i] = (client_glx_support[i] & client_glx_only[i])
+ | (client_glx_support[i] & psc->direct_support[i] & server_support[i])
+ | (client_glx_support[i] & psc->direct_support[i] & direct_glx_only[i]);
}
}
else {
for ( i = 0 ; i < 8 ; i++ ) {
- usable[i] = (client_support[i] & client_only[i])
- | (client_support[i] & server_support[i]);
+ usable[i] = (client_glx_support[i] & client_glx_only[i])
+ | (client_glx_support[i] & server_support[i]);
}
}
- psc->effectiveGLXexts = __glXGetStringFromTable( usable );
+ psc->effectiveGLXexts = __glXGetStringFromTable( known_glx_extensions,
+ usable );
+}
+
+
+/**
+ * Calculate the list of application usable extensions. The resulting
+ * string is stored in \c gc->extensions.
+ *
+ * \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
+__glXCalculateUsableGLExtensions( __GLXcontext * gc,
+ const char * server_string,
+ int major_version, int minor_version )
+{
+ unsigned char server_support[ __GL_EXT_BYTES ];
+ unsigned char usable[ __GL_EXT_BYTES ];
+ unsigned i;
+
+
+ __glXExtensionsCtr();
+ __glXProcessServerString( known_gl_extensions, server_string,
+ server_support );
+
+
+ /* Handle lazy servers that don't export all the extensions strings that
+ * are part of the GL core version that they support.
+ */
+
+ 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 );
+ }
+ }
+
+
+ /* 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.
+ */
+
+ for ( i = 0 ; i < __GL_EXT_BYTES ; i++ ) {
+ usable[i] = (client_gl_support[i] & client_gl_only[i])
+ | (client_gl_support[i] & server_support[i]);
+ }
+
+ gc->extensions = (unsigned char *)
+ __glXGetStringFromTable( known_gl_extensions, usable );
}
diff --git a/xc/lib/GL/glx/glxextensions.h b/xc/lib/GL/glx/glxextensions.h
index b75c5539d..28d068242 100644
--- a/xc/lib/GL/glx/glxextensions.h
+++ b/xc/lib/GL/glx/glxextensions.h
@@ -1,5 +1,5 @@
/*
- * (c) Copyright IBM Corporation 2002
+ * (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -20,9 +20,12 @@
* 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.h
*
- * Authors:
- * Ian Romanick <idr@us.ibm.com>
+ * \author Ian Romanick <idr@us.ibm.com>
*/
/* $XFree86:$ */
@@ -70,11 +73,150 @@ enum {
SUN_get_transparent_index_bit
};
+enum {
+ GL_ARB_depth_texture_bit = 0,
+ GL_ARB_fragment_program_bit,
+ GL_ARB_imaging_bit,
+ GL_ARB_multisample_bit,
+ GL_ARB_multitexture_bit,
+ GL_ARB_occlusion_query_bit,
+ GL_ARB_point_parameters_bit,
+ GL_ARB_point_sprite_bit,
+ GL_ARB_shadow_bit,
+ GL_ARB_shadow_ambient_bit,
+ GL_ARB_texture_border_clamp_bit,
+ GL_ARB_texture_cube_map_bit,
+ GL_ARB_texture_compression_bit,
+ GL_ARB_texture_env_add_bit,
+ GL_ARB_texture_env_combine_bit,
+ GL_ARB_texture_env_crossbar_bit,
+ GL_ARB_texture_env_dot3_bit,
+ GL_ARB_texture_mirrored_repeat_bit,
+ GL_ARB_texture_non_power_of_two_bit,
+ GL_ARB_transpose_matrix_bit,
+ GL_ARB_vertex_buffer_object_bit,
+ GL_ARB_vertex_program_bit,
+ GL_ARB_window_pos_bit,
+ GL_EXT_abgr_bit,
+ GL_EXT_bgra_bit,
+ GL_EXT_blend_color_bit,
+ GL_EXT_blend_equation_separate_bit,
+ GL_EXT_blend_func_separate_bit,
+ GL_EXT_blend_logic_op_bit,
+ GL_EXT_blend_minmax_bit,
+ GL_EXT_blend_subtract_bit,
+ GL_EXT_clip_volume_hint_bit,
+ GL_EXT_compiled_vertex_array_bit,
+ GL_EXT_convolution_bit,
+ GL_EXT_copy_texture_bit,
+ GL_EXT_cull_vertex_bit,
+ GL_EXT_depth_bounds_test_bit,
+ GL_EXT_draw_range_elements_bit,
+ GL_EXT_fog_coord_bit,
+ GL_EXT_multi_draw_arrays_bit,
+ GL_EXT_packed_pixels_bit,
+ GL_EXT_paletted_texture_bit,
+ GL_EXT_pixel_buffer_object_bit,
+ GL_EXT_polygon_offset_bit,
+ GL_EXT_rescale_normal_bit,
+ GL_EXT_secondary_color_bit,
+ GL_EXT_separate_specular_color_bit,
+ GL_EXT_shadow_funcs_bit,
+ GL_EXT_shared_texture_palette_bit,
+ GL_EXT_stencil_two_side_bit,
+ GL_EXT_stencil_wrap_bit,
+ GL_EXT_subtexture_bit,
+ GL_EXT_texture_bit,
+ GL_EXT_texture3D_bit,
+ GL_EXT_texture_compression_s3tc_bit,
+ GL_EXT_texture_edge_clamp_bit,
+ GL_EXT_texture_env_combine_bit,
+ GL_EXT_texture_env_dot3_bit,
+ GL_EXT_texture_filter_anisotropic_bit,
+ GL_EXT_texture_lod_bit,
+ GL_EXT_texture_lod_bias_bit,
+ GL_EXT_texture_mirror_clamp_bit,
+ GL_EXT_texture_object_bit,
+ GL_EXT_texture_rectangle_bit,
+ GL_EXT_vertex_array_bit,
+ GL_3DFX_texture_compression_FXT1_bit,
+ GL_APPLE_packed_pixels_bit,
+ GL_APPLE_ycbcr_422_bit,
+ GL_ATI_texture_env_combine3_bit,
+ GL_ATI_texture_float_bit,
+ GL_ATI_texture_mirror_once_bit,
+ GL_HP_convolution_border_modes_bit,
+ GL_HP_occlusion_test_bit,
+ GL_IBM_cull_vertex_bit,
+ GL_IBM_pixel_filter_hint_bit,
+ GL_IBM_rasterpos_clip_bit,
+ GL_IBM_texture_clamp_nodraw_bit,
+ GL_INGR_interlace_read_bit,
+ GL_MESA_pack_invert_bit,
+ GL_MESA_ycbcr_texture_bit,
+ GL_NV_blend_square_bit,
+ GL_NV_copy_depth_to_color_bit,
+ GL_NV_depth_clamp_bit,
+ GL_NV_fog_distance_bit,
+ GL_NV_light_max_exponent_bit,
+ GL_NV_multisample_filter_hint_bit,
+ GL_NV_point_sprite_bit,
+ GL_NV_texgen_reflection_bit,
+ GL_NV_texture_env_combine4_bit,
+ GL_SGIS_generate_mipmap_bit,
+ GL_SGIS_multisample_bit,
+ GL_SGIS_texture_lod_bit,
+ GL_SGIX_blend_alpha_minmax_bit,
+ GL_SGIX_clipmap_bit,
+ GL_SGIX_depth_texture_bit,
+ GL_SGIX_fog_offset_bit,
+ GL_SGIX_shadow_bit,
+ GL_SGIX_texture_coordinate_clamp_bit,
+ GL_SGIX_texture_lod_bias_bit,
+ GL_SGIX_texture_range_bit,
+ GL_SGIX_texture_scale_bias_bit,
+ GL_SGIX_vertex_preclip_bit,
+ GL_SGIX_vertex_preclip_hint_bit,
+ GL_SGIX_ycrcb_bit,
+ GL_SUN_convolution_border_modes_bit,
+ GL_SUN_slice_accum_bit,
+
+ /* This *MUST* go here. If it gets put after the duplicate values it will
+ * get the value after the last duplicate.
+ */
+ __NUM_GL_EXTS,
+
+
+ /* Alias extension bits. These extensions exist in either vendor-specific
+ * or EXT form and were later promoted to either EXT or ARB form. In all
+ * cases, the meaning is *exactly* the same. That's why
+ * EXT_texture_env_combine is *NOT* an alias of ARB_texture_env_combine and
+ * EXT_texture_env_dot3 is *NOT* an alias of ARB_texture_env_dot3. Be
+ * careful! When in doubt, src/mesa/main/extensions.c in the Mesa tree
+ * is a great reference.
+ */
+
+ GL_ATI_blend_equation_separate_bit = GL_EXT_blend_equation_separate_bit,
+ GL_ATIX_texture_env_combine3_bit = GL_ATI_texture_env_combine3_bit,
+ GL_EXT_point_parameters_bit = GL_ARB_point_parameters_bit,
+ GL_EXT_texture_env_add_bit = GL_ARB_texture_env_add_bit,
+ GL_IBM_texture_mirrored_repeat_bit = GL_ARB_texture_mirrored_repeat_bit,
+ GL_INGR_blend_func_separate_bit = GL_EXT_blend_func_separate_bit,
+ GL_MESA_window_pos_bit = GL_ARB_window_pos_bit,
+ GL_NV_texture_rectangle_bit = GL_EXT_texture_rectangle_bit,
+ GL_SGIS_texture_border_clamp_bit = GL_ARB_texture_border_clamp_bit,
+ GL_SGIS_texture_edge_clamp_bit = GL_EXT_texture_edge_clamp_bit,
+ GL_SGIX_shadow_ambient_bit = GL_ARB_shadow_ambient_bit,
+ GL_SUN_multi_draw_arrays_bit = GL_EXT_multi_draw_arrays_bit
+};
+
extern GLboolean __glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit );
extern const char * __glXGetClientExtensions( void );
extern void __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
GLboolean display_is_direct_capable, int server_minor_version );
extern void __glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name );
+extern void __glXCalculateUsableGLExtensions( __GLXcontext * gc,
+ const char * server_string, int major_version, int minor_version );
/* Source-level backwards compatibility with old drivers. They won't
* find the respective functions, though.
diff --git a/xc/lib/GL/glx/single2.c b/xc/lib/GL/glx/single2.c
index a5fa80f3e..e932a1d76 100644
--- a/xc/lib/GL/glx/single2.c
+++ b/xc/lib/GL/glx/single2.c
@@ -932,8 +932,7 @@ const GLubyte *glGetString(GLenum name)
break;
}
case GL_EXTENSIONS:
- gc->extensions = (GLubyte *)__glXCombineExtensionStrings( (char *)s,
- __glXGLClientExtensions );
+ __glXCalculateUsableGLExtensions( gc, s, 1, 0 );
XFree( s );
s = gc->extensions;
break;