[cairo-commit] libglc/src glc.c,1.10,1.11 glc_glx_extension.c,1.2,1.3 glc_trap.c,1.5,1.6 glc_tri.c,1.5,1.6 glc_util.c,1.4,1.5 glcint.h,1.8,1.9

David Reveman commit at pdx.freedesktop.org
Tue Dec 9 11:50:48 PST 2003


Committed by: davidr

Update of /cvs/cairo/libglc/src
In directory pdx:/tmp/cvs-serv26154/src

Modified Files:
	glc.c glc_glx_extension.c glc_trap.c glc_tri.c glc_util.c 
	glcint.h 
Log Message:
Extensions checking updates

Index: glc.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glc.c	8 Dec 2003 21:03:33 -0000	1.10
--- glc.c	9 Dec 2003 19:50:45 -0000	1.11
***************
*** 225,228 ****
--- 225,230 ----
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  
+   glDisable (GL_POLYGON_SMOOTH);
+ 
    switch (src->filter) {
    case GLC_FILTER_FAST:

Index: glc_glx_extension.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glc_glx_extension.c	5 Dec 2003 01:55:31 -0000	1.2
--- glc_glx_extension.c	9 Dec 2003 19:50:45 -0000	1.3
***************
*** 32,102 ****
  #include "glcint.h"
  
- #include <stdlib.h>
- #include <string.h>
- 
- typedef struct _glc_extension_map {
-   char *name;
-   int mask;
- } glc_extension_map;
- 
  static glc_extension_map glx_extensions[] = {
    { "GLX_SGIX_fbconfig", GLC_GLX_FEATURE_FBCONFIG_MASK },
    { "GLX_SGIX_pbuffer", GLC_GLX_FEATURE_PBUFFER_MASK },
    { NULL, 0 }
  }, gl_extensions[] = {
    { NULL, 0 }
  };
  
- static glc_bool_t
- _glc_extension_check (const char *extensions,
-                       const char *ext_name)
- {
-   char *end;
-   char *p = (char *) extensions;
-   int ext_name_len = strlen (ext_name);
- 
-   if (! p)
-     return 0;
- 
-   end = p + strlen (p);
- 
-   while (p < end) {
-     int n = strcspn (p, " ");
- 
-     if ((ext_name_len == n) && (strncmp (ext_name, p, n) == 0)) {
-       return 1;
-     }
-     p += (n + 1);
-   }
-   return 0;
- }
- 
  static long int
! _glc_extensions_query (const char *extensions_string,
!                        glc_extension_map *extensions_map)
  {
!   long int mask = 0;
!   int i;
    
!   for (i = 0; extensions_map[i].name; i++)
!     if (_glc_extension_check (extensions_string, extensions_map[i].name))
!       mask |= extensions_map[i].mask;
! 
!   return mask;
  }
  
  static long int
! _glc_extension_query_glx (Display *display,
!                           int screen)
  {
!   const char *glx_extensions_strings;
    
!   glx_extensions_strings = glXQueryExtensionsString (display, screen);
    
!   return _glc_extensions_query (glx_extensions_strings, glx_extensions);
  }
  
  static long int
! _glc_extension_query_gl (void)
  {
    const char *gl_extensions_strings;
--- 32,71 ----
  #include "glcint.h"
  
  static glc_extension_map glx_extensions[] = {
    { "GLX_SGIX_fbconfig", GLC_GLX_FEATURE_FBCONFIG_MASK },
    { "GLX_SGIX_pbuffer", GLC_GLX_FEATURE_PBUFFER_MASK },
    { NULL, 0 }
+ }, client_glx_extensions[] = {
+   { "GLX_ATI_render_texture",
+     GLC_GLX_FEATURE_FBCONFIG_MASK | GLC_GLX_FEATURE_PBUFFER_MASK },
+   { NULL, 0 }
  }, gl_extensions[] = {
    { NULL, 0 }
  };
  
  static long int
! _glc_glx_extension_query_glx (Display *display,
!                               int screen)
  {
!   const char *glx_extensions_strings;
    
!   glx_extensions_strings = glXQueryExtensionsString (display, screen);
!   
!   return glc_extensions_query (glx_extensions_strings, glx_extensions);
  }
  
  static long int
! _glc_glx_extension_query_client_glx (Display *display)
  {
!   const char *client_glx_extensions_strings;
    
!   client_glx_extensions_strings = glXGetClientString (display, GLX_EXTENSIONS);
    
!   return glc_extensions_query (client_glx_extensions_strings,
!                                 client_glx_extensions);
  }
  
  static long int
! _glc_glx_extension_query_gl (void)
  {
    const char *gl_extensions_strings;
***************
*** 104,108 ****
    gl_extensions_strings = (const char *) glGetString (GL_EXTENSIONS);
  
!   return _glc_extensions_query (gl_extensions_strings, gl_extensions);
  }
  
--- 73,77 ----
    gl_extensions_strings = (const char *) glGetString (GL_EXTENSIONS);
  
!   return glc_extensions_query (gl_extensions_strings, gl_extensions);
  }
  
***************
*** 113,119 ****
    
    screen_info->feature_mask |=
!     _glc_extension_query_glx (screen_info->display_info->display,
!                               screen_info->screen);
    
!   screen_info->feature_mask |= _glc_extension_query_gl ();
  }
--- 82,133 ----
    
    screen_info->feature_mask |=
!     _glc_glx_extension_query_glx (screen_info->display_info->display,
!                                   screen_info->screen);
    
!   screen_info->feature_mask |=
!     _glc_glx_extension_query_client_glx (screen_info->display_info->display);
!   
!   screen_info->feature_mask |= _glc_glx_extension_query_gl ();
! 
!   /* Test to make sure that fbconfigs and pbuffers are really working. */
!   if (screen_info->feature_mask & GLC_GLX_FEATURE_FBCONFIG_MASK) {
!     GLXFBConfig *fbconfig;
!     int nelements;
!     
!     fbconfig = glXGetFBConfigs (screen_info->display_info->display,
!                                 screen_info->screen,
!                                 &nelements);
!     if (fbconfig) {
!       if (screen_info->feature_mask & GLC_GLX_FEATURE_PBUFFER_MASK) {
!         GLXPbuffer pbuffer = None;
!         int i;
! 
!         for (i = 0; i < nelements; i++) {
!           int value;
!           
!           glXGetFBConfigAttrib (screen_info->display_info->display,
!                                 fbconfig[i], GLX_DRAWABLE_TYPE, &value);
!           
!           if (value & GLX_PBUFFER_BIT) {
!             pbuffer =
!               glc_glx_pbuffer_create (screen_info->display_info->display,
!                                       fbconfig[i],
!                                       1, 1);
!             break;
!           }
!         }
! 
!         if (pbuffer)
!           glc_glx_pbuffer_destroy (screen_info->display_info->display,
!                                    pbuffer);
!         else
!           screen_info->feature_mask &= ~GLC_GLX_FEATURE_PBUFFER_MASK;
!       }
!     } else
!       screen_info->feature_mask &=
!         ~(GLC_GLX_FEATURE_FBCONFIG_MASK | GLC_GLX_FEATURE_PBUFFER_MASK);
! 
!     if (fbconfig)
!       free (fbconfig);
!   }
  }

Index: glc_trap.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_trap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glc_trap.c	7 Dec 2003 02:42:29 -0000	1.5
--- glc_trap.c	9 Dec 2003 19:50:45 -0000	1.6
***************
*** 191,194 ****
--- 191,196 ----
    glEnd ();
  
+   glDisable (GL_POLYGON_SMOOTH);
+ 
    glc_surface_pop_current (mask);
  
***************
*** 358,363 ****
    }
  
    glShadeModel (GL_FLAT);
! 
    if (intermediate) {
      glBindTexture (GL_TEXTURE_2D, dst->texture);
--- 360,366 ----
    }
  
+   glDisable (GL_POLYGON_SMOOTH);
    glShadeModel (GL_FLAT);
!   
    if (intermediate) {
      glBindTexture (GL_TEXTURE_2D, dst->texture);

Index: glc_tri.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_tri.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glc_tri.c	7 Dec 2003 02:42:29 -0000	1.5
--- glc_tri.c	9 Dec 2003 19:50:45 -0000	1.6
***************
*** 142,145 ****
--- 142,147 ----
    
    glEnd ();
+ 
+   glDisable (GL_POLYGON_SMOOTH);
    
    glc_surface_pop_current (mask);
***************
*** 235,238 ****
--- 237,242 ----
    
    glEnd ();
+ 
+   glDisable (GL_POLYGON_SMOOTH);
    
    glc_surface_pop_current (mask);
***************
*** 328,331 ****
--- 332,337 ----
    
    glEnd ();
+ 
+   glDisable (GL_POLYGON_SMOOTH);
    
    glc_surface_pop_current (mask);
***************
*** 502,505 ****
--- 508,512 ----
    }
  
+   glDisable (GL_POLYGON_SMOOTH);
    glShadeModel (GL_FLAT);
  

Index: glc_util.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glc_util.c	8 Dec 2003 21:03:33 -0000	1.4
--- glc_util.c	9 Dec 2003 19:50:45 -0000	1.5
***************
*** 32,35 ****
--- 32,38 ----
  #include "glcint.h"
  
+ #include <stdlib.h>
+ #include <string.h>
+ 
  void
  glc_intermediate_bounds (glc_surface_t *surface,
***************
*** 137,138 ****
--- 140,179 ----
      return GL_UNSIGNED_BYTE;
  }
+ 
+ static glc_bool_t
+ _glc_extension_check (const char *extensions,
+                       const char *ext_name)
+ {
+   char *end;
+   char *p = (char *) extensions;
+   int ext_name_len = strlen (ext_name);
+ 
+   if (! p)
+     return 0;
+ 
+   end = p + strlen (p);
+ 
+   while (p < end) {
+     int n = strcspn (p, " ");
+ 
+     if ((ext_name_len == n) && (strncmp (ext_name, p, n) == 0)) {
+       return 1;
+     }
+     p += (n + 1);
+   }
+   return 0;
+ }
+ 
+ long int
+ glc_extensions_query (const char *extensions_string,
+                       glc_extension_map *extensions_map)
+ {
+   long int mask = 0;
+   int i;
+   
+   for (i = 0; extensions_map[i].name; i++)
+     if (_glc_extension_check (extensions_string, extensions_map[i].name))
+       mask |= extensions_map[i].mask;
+ 
+   return mask;
+ }

Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glcint.h	8 Dec 2003 21:03:33 -0000	1.8
--- glcint.h	9 Dec 2003 19:50:45 -0000	1.9
***************
*** 95,98 ****
--- 95,103 ----
  };
  
+ typedef struct _glc_extension_map {
+   char *name;
+   int mask;
+ } glc_extension_map;
+ 
  extern void __internal_linkage
  glc_matrix_transform_point (glc_matrix_t *matrix,
***************
*** 128,131 ****
--- 133,141 ----
  glc_get_texture_data_type_from_pixelsize (int pixelsize);
  
+ extern long int __internal_linkage
+ glc_extensions_query (const char *extensions_string,
+                       glc_extension_map *extensions_map);
+ 
+ 
  extern GLuint __internal_linkage
  glc_texture_create (int width,





More information about the cairo-commit mailing list