⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glxextensions.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 2 页
字号:
      }   }}void__glXEnableDirectExtension(__GLXscreenConfigs *psc, const char *name){    __glXExtensionsCtr();    __glXExtensionsCtrScreen(psc);    set_glx_extension(known_glx_extensions,		      name, strlen(name), GL_TRUE, psc->direct_support);}/** * Initialize global extension support tables. */static void__glXExtensionsCtr( void ){   unsigned   i;   static GLboolean ext_list_first_time = GL_TRUE;   if ( ext_list_first_time ) {      ext_list_first_time = GL_FALSE;      (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_glx_support, bit );	 }	 if ( known_glx_extensions[i].direct_support ) {	    SET_BIT( direct_glx_support, bit );	 }	 if ( known_glx_extensions[i].client_only ) {	    SET_BIT( client_glx_only, bit );	 }	 if ( known_glx_extensions[i].direct_only ) {	    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 );	 }	 if ( known_gl_extensions[i].client_only ) {	    SET_BIT( client_gl_only, bit );	 }      }      #if 0      fprintf( stderr, "[%s:%u] Maximum client library version: %u.%u\n",	       __func__, __LINE__, gl_major, gl_minor );#endif   }}/** * Make sure that per-screen direct-support table is initialized. * * \param psc  Pointer to GLX per-screen record. */static void__glXExtensionsCtrScreen( __GLXscreenConfigs *psc ){    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 ) );    }}/** * 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__glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit ){   GLboolean enabled = GL_FALSE;   if ( psc != NULL ) {      __glXExtensionsCtr();      __glXExtensionsCtrScreen( psc );      enabled = EXT_ENABLED( bit, psc->direct_support );   }   return enabled;}/** * Check if a certain extension is enabled in a given context. * */GLboolean__glExtensionBitIsEnabled( const __GLXcontext * gc, unsigned bit ){   GLboolean enabled = GL_FALSE;   if ( gc != NULL ) {      enabled = EXT_ENABLED( bit, gc->gl_extension_bits );   }   return enabled;}/** * Convert a bit-field to a string of supported extensions. */static char *__glXGetStringFromTable( const struct extension_info * ext,			 const unsigned char * supported ){   unsigned   i;   unsigned   ext_str_len;   char * ext_str;   char * point;   ext_str_len = 0;   for ( i = 0 ; ext[i].name != NULL ; i++ ) {      if ( EXT_ENABLED( ext[i].bit, supported ) ) {	 ext_str_len += ext[i].name_len + 1;      }   }   ext_str = Xmalloc( ext_str_len + 1 );   if ( ext_str != NULL ) {      point = ext_str;      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++;	 }      }      *point = '\0';   }   return ext_str;}/** * Get the string of client library supported extensions. */const char *__glXGetClientExtensions( void ){   if ( __glXGLXClientExtensions == NULL ) {      __glXExtensionsCtr();      __glXGLXClientExtensions = __glXGetStringFromTable( known_glx_extensions,							  client_glx_support );   }   return __glXGLXClientExtensions;}/** * Calculate the list of application usable extensions.  The resulting * string is stored in \c psc->effectiveGLXexts. *  * \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__glXCalculateUsableExtensions( __GLXscreenConfigs *psc,				GLboolean display_is_direct_capable,				int minor_version ){   unsigned char server_support[8];   unsigned char usable[8];   unsigned      i;   __glXExtensionsCtr();   __glXExtensionsCtrScreen( psc );   (void) memset( server_support, 0, sizeof( server_support ) );   __glXProcessServerString( known_glx_extensions,			     psc->serverGLXexts, server_support );   /* 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.    */   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 );             /* 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.       */      SET_BIT( server_support, EXT_import_context_bit );   }   /* 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.    *     * 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.    */   if ( display_is_direct_capable ) {      for ( i = 0 ; i < 8 ; 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_glx_support[i] & client_glx_only[i])	     | (client_glx_support[i] & server_support[i]);      }   }   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();   (void) memset( server_support, 0, sizeof( server_support ) );   __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 );   (void) memcpy( gc->gl_extension_bits, usable, sizeof( usable ) );}/** * Calculates the maximum core GL version that can be supported for indirect * rendering. */void__glXGetGLVersion( int * major_version, int * minor_version ){		       __glXExtensionsCtr();    *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 );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -