From c9254615bf9a774410118ab6460723ea652ccc4c Mon Sep 17 00:00:00 2001 From: idr Date: Fri, 11 Jun 2004 21:03:31 +0000 Subject: Dynamically generate client-side extension string instead of using __glXGLClientExtensions. This makes it so that the list of extensions supported by the client only has to be maintained in one place. --- xc/lib/GL/glx/glxclient.h | 8 +-- xc/lib/GL/glx/glxcmds.c | 150 ++++++------------------------------------ xc/lib/GL/glx/glxextensions.c | 13 ++++ xc/lib/GL/glx/glxextensions.h | 1 + 4 files changed, 37 insertions(+), 135 deletions(-) diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index b4552bbf0..e0ae017c7 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -665,8 +665,8 @@ struct __GLXdisplayPrivateRec { * be filled in on demand. */ /*@{*/ - char *serverGLXvendor; - char *serverGLXversion; + const char *serverGLXvendor; + const char *serverGLXversion; /*@}*/ /** @@ -815,8 +815,8 @@ extern void _XSend(Display*, const void*, long); extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags ); -extern char * __glXGetStringFromServer( Display * dpy, int opcode, - CARD32 glxCode, CARD32 for_whom, CARD32 name ); +extern char *__glXInternalQueryServerString( Display *dpy, int opcode, + int screen, int name ); extern char *__glXstrdup(const char *str); diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index 05af76fd7..df9ddf99f 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -58,117 +58,6 @@ #define GLX_PREFIX(x) x #endif /* IN_DOXYGEN */ -const char __glXGLClientExtensions[] = - "GL_ARB_depth_texture " - "GL_ARB_imaging " - "GL_ARB_multisample " - "GL_ARB_multitexture " - "GL_ARB_point_parameters " - "GL_ARB_point_sprite " - "GL_ARB_shadow " - "GL_ARB_shadow_ambient " - "GL_ARB_texture_border_clamp " - "GL_ARB_texture_cube_map " - "GL_ARB_texture_env_add " - "GL_ARB_texture_env_combine " - "GL_ARB_texture_env_crossbar " - "GL_ARB_texture_env_dot3 " - "GL_ARB_texture_mirrored_repeat " - "GL_ARB_texture_non_power_of_two " - "GL_ARB_transpose_matrix " - "GL_ARB_window_pos " - "GL_EXT_abgr " - "GL_EXT_bgra " - "GL_EXT_blend_color " - "GL_EXT_blend_func_separate " - "GL_EXT_blend_logic_op " - "GL_EXT_blend_minmax " - "GL_EXT_blend_subtract " - "GL_EXT_clip_volume_hint " - "GL_EXT_copy_texture " - "GL_EXT_draw_range_elements " - "GL_EXT_fog_coord " - "GL_EXT_multi_draw_arrays " - "GL_EXT_packed_pixels " - "GL_EXT_paletted_texture " - "GL_EXT_polygon_offset " - "GL_EXT_rescale_normal " - "GL_EXT_secondary_color " - "GL_EXT_separate_specular_color " - "GL_EXT_shadow_funcs " - "GL_EXT_shared_texture_palette " - "GL_EXT_stencil_two_side " - "GL_EXT_stencil_wrap " - "GL_EXT_subtexture " - "GL_EXT_texture " - "GL_EXT_texture3D " - "GL_EXT_texture_edge_clamp " - "GL_EXT_texture_env_add " - "GL_EXT_texture_env_combine " - "GL_EXT_texture_env_dot3 " - "GL_EXT_texture_filter_anisotropic " - "GL_EXT_texture_lod " - "GL_EXT_texture_lod_bias " - "GL_EXT_texture_mirror_clamp " - "GL_EXT_texture_object " - "GL_EXT_texture_rectangle " - "GL_EXT_vertex_array " - "GL_APPLE_packed_pixels " - "GL_APPLE_ycbcr_422 " - "GL_ATI_texture_env_combine3 " - "GL_ATI_texture_float " - "GL_ATI_texture_mirror_once " - "GL_ATIX_texture_env_combine3 " - "GL_HP_convolution_border_modes " -#if 0 - /* 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 " -#endif - "GL_IBM_cull_vertex " - "GL_IBM_pixel_filter_hint " - "GL_IBM_rasterpos_clip " - "GL_IBM_texture_clamp_nodraw " - "GL_IBM_texture_mirrored_repeat " - "GL_INGR_blend_func_separate " - "GL_INGR_interlace_read " - "GL_MESA_pack_invert " - "GL_MESA_ycbcr_texture " - "GL_NV_blend_square " - "GL_NV_copy_depth_to_color " - "GL_NV_depth_clamp " - "GL_NV_fog_distance " - "GL_NV_light_max_exponent " - "GL_NV_multisample_filter_hint " - "GL_NV_point_sprite " - "GL_NV_texgen_reflection " - "GL_NV_texture_env_combine4 " - "GL_NV_texture_rectangle " - "GL_SGIS_generate_mipmap " - "GL_SGIS_multisample " - "GL_SGIS_texture_border_clamp " - "GL_SGIS_texture_edge_clamp " - "GL_SGIS_texture_lod " - "GL_SGIX_blend_alpha_minmax " - "GL_SGIX_clipmap " - "GL_SGIX_depth_texture " - "GL_SGIX_fog_offset " - "GL_SGIX_shadow " - "GL_SGIX_shadow_ambient " - "GL_SGIX_texture_coordinate_clamp " - "GL_SGIX_texture_lod_bias " - "GL_SGIX_texture_range " - "GL_SGIX_texture_scale_bias " - "GL_SGIX_vertex_preclip " - "GL_SGIX_vertex_preclip_hint " - "GL_SGIX_ycrcb " - "GL_SUN_convolution_border_modes " - "GL_SUN_multi_draw_arrays " - "GL_SUN_slice_accum " - ; - static const char __glXGLXClientVendorName[] = "SGI"; static const char __glXGLXClientVersion[] = "1.4"; @@ -1511,6 +1400,7 @@ const char *GLX_PREFIX(glXQueryServerString)( Display *dpy, int screen, int name { __GLXscreenConfigs *psc; __GLXdisplayPrivate *priv; + const char ** str; if ( GetGLXPrivScreenConfig( dpy, screen, & priv, & psc ) != Success ) { @@ -1519,35 +1409,31 @@ const char *GLX_PREFIX(glXQueryServerString)( Display *dpy, int screen, int name switch(name) { case GLX_VENDOR: - if (!priv->serverGLXvendor) { - priv->serverGLXvendor = - __glXGetStringFromServer(dpy, priv->majorOpcode, X_GLXQueryServerString, - screen, GLX_VENDOR); - } - return(priv->serverGLXvendor); + str = & priv->serverGLXvendor; + break; case GLX_VERSION: - if (!priv->serverGLXversion) { - priv->serverGLXversion = - __glXGetStringFromServer(dpy, priv->majorOpcode, X_GLXQueryServerString, - screen, GLX_VERSION); - } - return(priv->serverGLXversion); + str = & priv->serverGLXversion; + break; case GLX_EXTENSIONS: - if (!psc->serverGLXexts) { - psc->serverGLXexts = - __glXGetStringFromServer(dpy, priv->majorOpcode, X_GLXQueryServerString, - screen, GLX_EXTENSIONS); - } - return(psc->serverGLXexts); + str = & psc->serverGLXexts; + break; default: return NULL; } + + if ( *str == NULL ) { + *str = __glXGetStringFromServer(dpy, priv->majorOpcode, + X_GLXQueryServerString, screen, name); + } + + return *str; } void __glXClientInfo ( Display *dpy, int opcode ) { xGLXClientInfoReq *req; int size; + char * ext_str = __glXGetClientGLExtensionString(); /* Send the glXClientInfo request */ LockDisplay(dpy); @@ -1557,13 +1443,15 @@ void __glXClientInfo ( Display *dpy, int opcode ) req->major = GLX_MAJOR_VERSION; req->minor = GLX_MINOR_VERSION; - size = strlen(__glXGLClientExtensions) + 1; + size = strlen( ext_str ) + 1; req->length += (size + 3) >> 2; req->numbytes = size; - Data(dpy, __glXGLClientExtensions, size); + Data(dpy, ext_str, size); UnlockDisplay(dpy); SyncHandle(); + + Xfree( ext_str ); } diff --git a/xc/lib/GL/glx/glxextensions.c b/xc/lib/GL/glx/glxextensions.c index d4c2e0578..c3367addb 100644 --- a/xc/lib/GL/glx/glxextensions.c +++ b/xc/lib/GL/glx/glxextensions.c @@ -683,3 +683,16 @@ __glXGetGLVersion( int * major_version, int * minor_version ) *major_version = gl_major; *minor_version = gl_minor; } + + +/** + * 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 * +__glXGetClientGLExtensionString( void ) +{ + __glXExtensionsCtr(); + return __glXGetStringFromTable( known_gl_extensions, client_gl_support ); +} diff --git a/xc/lib/GL/glx/glxextensions.h b/xc/lib/GL/glx/glxextensions.h index cf6163a04..1ee873107 100644 --- a/xc/lib/GL/glx/glxextensions.h +++ b/xc/lib/GL/glx/glxextensions.h @@ -218,6 +218,7 @@ extern void __glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name extern void __glXCalculateUsableGLExtensions( __GLXcontext * gc, const char * server_string, int major_version, int minor_version ); extern void __glXGetGLVersion( int * major_version, int * minor_version ); +extern char * __glXGetClientGLExtensionString( void ); /* Source-level backwards compatibility with old drivers. They won't * find the respective functions, though. -- cgit v1.2.3