[cairo-commit] libglc/src glc.h,1.11,1.12 glc_agl_extension.c,1.2,1.3 glc_agl_info.c,1.4,1.5 glc_glx_context.c,1.9,1.10 glc_glx_extension.c,1.8,1.9 glc_glx_format.c,1.14,1.15 glc_glx_info.c,1.9,1.10 glc_glx_pbuffer.c,1.6,1.7 glc_glx_surface.c,1.14,1.15 glc_surface.c,1.15,1.16 glc_texture.c,1.8,1.9 glcint.h,1.16,1.17

David Reveman commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005


Committed by: davidr

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

Modified Files:
	glc.h glc_agl_extension.c glc_agl_info.c glc_glx_context.c 
	glc_glx_extension.c glc_glx_format.c glc_glx_info.c 
	glc_glx_pbuffer.c glc_glx_surface.c glc_surface.c 
	glc_texture.c glcint.h 
Log Message:
Fixed dynamic lookup handling and texture rectangle support

Index: glc.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** a/glc.h	16 Feb 2004 22:02:40 -0000	1.11
--- b/glc.h	18 Feb 2004 14:52:45 -0000	1.12
***************
*** 131,140 ****
  
  #define GLC_FEATURE_OFFSCREEN_DRAWING_MASK     (1L << 0)
! #define GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK (1L << 1)
! #define GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK  (1L << 2)
! #define GLC_FEATURE_MULTISAMPLE_MASK           (1L << 3)
! #define GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK (1L << 4)
! #define GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK  (1L << 5)
! #define GLC_FEATURE_ATI_RENDER_TEXTURE_MASK    (1L << 6)
  
  typedef enum {  
--- 131,139 ----
  
  #define GLC_FEATURE_OFFSCREEN_DRAWING_MASK     (1L << 0)
! #define GLC_FEATURE_TEXTURE_RECTANGLE_MASK     (1L << 1)
! #define GLC_FEATURE_MULTISAMPLE_MASK           (1L << 2)
! #define GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK (1L << 3)
! #define GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK  (1L << 4)
! #define GLC_FEATURE_ATI_RENDER_TEXTURE_MASK    (1L << 5)
  
  typedef enum {  
***************
*** 294,297 ****
--- 293,299 ----
  glc_surface_get_status (glc_surface_t *surface);
  
+ unsigned long
+ glc_surface_features (glc_surface_t *surface);
+ 
    
  /* glc_rect.c */

Index: glc_agl_extension.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glc_agl_extension.c	10 Feb 2004 23:38:36 -0000	1.2
--- b/glc_agl_extension.c	18 Feb 2004 14:52:45 -0000	1.3
***************
*** 34,46 ****
  static glc_extension_map gl_extensions[] = {
    { "GL_APPLE_pixel_buffer", GLC_AGL_FEATURE_PBUFFER_MASK },
! 
! #if GL_EXT_texture_rectangle
!   { "GL_EXT_texture_rectangle", GLC_AGL_FEATURE_EXT_TEXTURE_RECTANGLE_MASK },
! #endif
!   
! #if GL_NV_texture_rectangle
!   { "GL_NV_texture_rectangle", GLC_AGL_FEATURE_NV_TEXTURE_RECTANGLE_MASK },
! #endif
! 
    { "GL_ARB_multisample", GLC_AGL_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint", GLC_AGL_FEATURE_MULTISAMPLE_FILTER_MASK },
--- 34,39 ----
  static glc_extension_map gl_extensions[] = {
    { "GL_APPLE_pixel_buffer", GLC_AGL_FEATURE_PBUFFER_MASK },
!   { "GL_EXT_texture_rectangle", GLC_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_NV_texture_rectangle", GLC_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_ARB_multisample", GLC_AGL_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint", GLC_AGL_FEATURE_MULTISAMPLE_FILTER_MASK },
***************
*** 82,95 ****
    }
  
!   if (thread_info->agl_feature_mask &
!       GLC_AGL_FEATURE_EXT_TEXTURE_RECTANGLE_MASK) {
!     thread_info->texture_mask |= GLC_TEXTURE_TARGET_EXT_RECTANGLE_MASK;
!     thread_info->feature_mask |= GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK;
!   }
! 
!   if (thread_info->agl_feature_mask &
!       GLC_AGL_FEATURE_NV_TEXTURE_RECTANGLE_MASK) {
!     thread_info->texture_mask |= GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK;
!     thread_info->feature_mask |= GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK;
    }
  
--- 75,81 ----
    }
  
!   if (thread_info->agl_feature_mask & GLC_AGL_FEATURE_TEXTURE_RECTANGLE_MASK) {
!     thread_info->texture_mask |= GLC_TEXTURE_TARGET_RECTANGLE_MASK;
!     thread_info->feature_mask |= GLC_FEATURE_TEXTURE_RECTANGLE_MASK;
    }
  

Index: glc_agl_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_info.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glc_agl_info.c	16 Feb 2004 22:02:40 -0000	1.4
--- b/glc_agl_info.c	18 Feb 2004 14:52:45 -0000	1.5
***************
*** 42,46 ****
  };
  
- 
  static void
  _glc_agl_thread_info_init (glc_agl_thread_info_t *thread_info);
--- 42,45 ----
***************
*** 115,122 ****
    thread_info->contexts = NULL;
    thread_info->n_contexts = 0;
!   thread_info->programs.program_2d_2d = 0;
!   thread_info->programs.program_rect_2d = 0;
!   thread_info->programs.program_2d_rect = 0;
!   thread_info->programs.program_rect_rect = 0;
    thread_info->root_context.pixel_format =
      aglChoosePixelFormat (NULL, 0, attrib);
--- 114,120 ----
    thread_info->contexts = NULL;
    thread_info->n_contexts = 0;
! 
!   memset (&thread_info->programs, 0, sizeof (glc_fragment_programs_t));
!   
    thread_info->root_context.pixel_format =
      aglChoosePixelFormat (NULL, 0, attrib);
***************
*** 150,158 ****
  
  #ifdef GL_EXT_texture_rectangle
!           | GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK
  #endif
            
  #ifdef GL_NV_texture_rectangle
!           | GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK
  #endif
            
--- 148,156 ----
  
  #ifdef GL_EXT_texture_rectangle
!           | GLC_FEATURE_TEXTURE_RECTANGLE_MASK
  #endif
            
  #ifdef GL_NV_texture_rectangle
!           | GLC_FEATURE_TEXTURE_RECTANGLE_MASK
  #endif
            

Index: glc_glx_context.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/glc_glx_context.c	16 Feb 2004 22:02:40 -0000	1.9
--- b/glc_glx_context.c	18 Feb 2004 14:52:45 -0000	1.10
***************
*** 34,38 ****
  #include <stdlib.h>
  
! extern glc_glx_proc_address_list_t _glc_glx_proc_address;
  
  static void
--- 34,38 ----
  #include <stdlib.h>
  
! extern glc_glx_static_proc_address_list_t _glc_glx_proc_address;
  
  static void
***************
*** 133,137 ****
    screen_info->contexts[index] = context;
  
!   if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_GLX13_MASK)
      _glc_glx_context_create_glx13 (screen_info,
                                     screen_info->format_ids[format->id],
--- 133,137 ----
    screen_info->contexts[index] = context;
  
!   if (screen_info->feature_mask & GLC_FEATURE_OFFSCREEN_DRAWING_MASK)
      _glc_glx_context_create_glx13 (screen_info,
                                     screen_info->format_ids[format->id],
***************
*** 143,150 ****
--- 143,199 ----
                                     screen_info->root_context.context,
                                     context);
+ 
+   memset (&context->gl_proc_address, 0, sizeof (glc_gl_proc_address_list_t));
+   memset (&context->glx_proc_address, 0, sizeof (glc_glx_proc_address_list_t));
+   
+   if (_glc_glx_proc_address.supported) {
+     context->gl_proc_address.supported =
+       context->glx_proc_address.supported = 1;
+   }
    
    return context;
  }
  
+ void
+ glc_glx_context_proc_address_lookup (glc_glx_context_t *context)
+ {
+   
+ #ifdef GLX_ATI_render_texture
+   context->glx_proc_address.glx_bind_tex_image_ati =
+     (glc_proc_ptr_bind_tex_image_ati_t)
+     glc_glx_get_proc_address ("glXBindTexImageATI");
+   context->glx_proc_address.glx_release_tex_image_ati =
+     (glc_proc_ptr_release_tex_image_ati_t)
+     glc_glx_get_proc_address ("glXReleaseTexImageATI");
+ #endif
+ 
+ #ifdef GL_ARB_multitexture
+   context->gl_proc_address.gl_active_texture_arb =
+     (glc_proc_ptr_gl_active_texture_arb_t)
+     glc_glx_get_proc_address ("glActiveTextureARB");
+   context->gl_proc_address.gl_multi_tex_coord_2d_arb =
+     (glc_proc_ptr_gl_multi_tex_coord_2d_arb_t)
+     glc_glx_get_proc_address ("glMultiTexCoord2dARB");
+ #endif
+ 
+ #ifdef GL_ARB_fragment_program
+   context->gl_proc_address.gl_gen_programs_arb =
+     (glc_proc_ptr_gl_gen_programs_arb_t)
+     glc_glx_get_proc_address ("glGenProgramsARB");
+   context->gl_proc_address.gl_delete_programs_arb =
+     (glc_proc_ptr_gl_delete_programs_arb_t)
+     glc_glx_get_proc_address ("glDeleteProgramsARB");
+   context->gl_proc_address.gl_program_string_arb =
+     (glc_proc_ptr_gl_program_string_arb_t)
+     glc_glx_get_proc_address ("glProgramStringARB");
+   context->gl_proc_address.gl_bind_program_arb =
+     (glc_proc_ptr_gl_bind_program_arb_t)
+     glc_glx_get_proc_address ("glBindProgramARB");
+ #endif
+ 
+   context->gl_proc_address.supported = 0;
+   context->glx_proc_address.supported = 0;
+ }
+ 
  static void
  glc_glx_context_set_surface_anti_aliasing (glc_glx_surface_t *surface)
***************
*** 183,186 ****
--- 232,238 ----
    glXMakeCurrent (surface->screen_info->display_info->display,
                    drawable, context);
+ 
+   if (surface->drawable && surface->context->gl_proc_address.supported)
+     glc_glx_context_proc_address_lookup (surface->context);
  }
  

Index: glc_glx_extension.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_extension.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/glc_glx_extension.c	16 Feb 2004 22:02:40 -0000	1.8
--- b/glc_glx_extension.c	18 Feb 2004 14:52:45 -0000	1.9
***************
*** 32,37 ****
  #include "glcint.h"
  
! extern glc_gl_proc_address_list_t _glc_glx_gl_proc_address;
! extern glc_glx_proc_address_list_t _glc_glx_proc_address;
  
  static glc_extension_map client_glx_extensions[] = {
--- 32,36 ----
  #include "glcint.h"
  
! extern glc_glx_static_proc_address_list_t _glc_glx_proc_address;
  
  static glc_extension_map client_glx_extensions[] = {
***************
*** 40,45 ****
    { NULL, 0 }
  }, gl_extensions[] = {
!   { "GL_EXT_texture_rectangle", GLC_GLX_FEATURE_EXT_TEXTURE_RECTANGLE_MASK },
!   { "GL_NV_texture_rectangle", GLC_GLX_FEATURE_NV_TEXTURE_RECTANGLE_MASK },
    { "GL_ARB_multisample", GLC_GLX_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint", GLC_GLX_FEATURE_MULTISAMPLE_FILTER_MASK },
--- 39,44 ----
    { NULL, 0 }
  }, gl_extensions[] = {
!   { "GL_EXT_texture_rectangle", GLC_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_NV_texture_rectangle", GLC_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_ARB_multisample", GLC_GLX_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint", GLC_GLX_FEATURE_MULTISAMPLE_FILTER_MASK },
***************
*** 79,82 ****
--- 78,84 ----
    screen_info->glx_feature_mask |= _glc_glx_extension_query_gl ();
  
+   screen_info->feature_mask = 0;
+   screen_info->texture_mask = GLC_TEXTURE_TARGET_2D_MASK;
+ 
  #ifdef GLX_VERSION_1_3
    if (_glc_glx_proc_address.glx_get_fbconfigs &&
***************
*** 85,96 ****
        _glc_glx_proc_address.glx_create_pbuffer &&
        _glc_glx_proc_address.glx_destroy_pbuffer)
-     screen_info->glx_feature_mask |= GLC_GLX_FEATURE_GLX13_MASK;
- #endif
- 
-   screen_info->feature_mask = 0;
-   screen_info->texture_mask = GLC_TEXTURE_TARGET_2D_MASK;
-   
-   if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_GLX13_MASK)
      screen_info->feature_mask |= GLC_FEATURE_OFFSCREEN_DRAWING_MASK;
  
  #ifdef GL_ARB_multisample
--- 87,92 ----
        _glc_glx_proc_address.glx_create_pbuffer &&
        _glc_glx_proc_address.glx_destroy_pbuffer)
      screen_info->feature_mask |= GLC_FEATURE_OFFSCREEN_DRAWING_MASK;
+ #endif
  
  #ifdef GL_ARB_multisample
***************
*** 106,122 ****
  #endif
  
! #ifdef GL_EXT_texture_rectangle
!   if (screen_info->glx_feature_mask &
!       GLC_GLX_FEATURE_EXT_TEXTURE_RECTANGLE_MASK) {
!     screen_info->texture_mask |= GLC_TEXTURE_TARGET_EXT_RECTANGLE_MASK;
!     screen_info->feature_mask |= GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK;
!   }
! #endif
! 
! #ifdef GL_NV_texture_rectangle
!   if (screen_info->glx_feature_mask &
!       GLC_GLX_FEATURE_NV_TEXTURE_RECTANGLE_MASK) {
!     screen_info->texture_mask |= GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK;
!     screen_info->feature_mask |= GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK;
    }
  #endif
--- 102,109 ----
  #endif
  
! #if defined(GL_EXT_texture_rectangle) || defined(GL_NV_texture_rectangle)  
!   if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_TEXTURE_RECTANGLE_MASK) {
!     screen_info->texture_mask |= GLC_TEXTURE_TARGET_RECTANGLE_MASK;
!     screen_info->feature_mask |= GLC_FEATURE_TEXTURE_RECTANGLE_MASK;
    }
  #endif
***************
*** 127,141 ****
  
  #ifdef GLX_ATI_render_texture
!     if (_glc_glx_proc_address.glx_bind_tex_image_ati &&
!         _glc_glx_proc_address.glx_release_tex_image_ati) {
!       screen_info->glx_feature_mask |= GLC_GLX_FEATURE_ATI_RENDER_TEXTURE_MASK;
!       screen_info->feature_mask |= GLC_FEATURE_ATI_RENDER_TEXTURE_MASK;
  
!       /* ATI render texture doesn't seem to support texture rectangle */
!       screen_info->texture_mask &= ~GLC_TEXTURE_TARGET_EXT_RECTANGLE_MASK;
!       screen_info->feature_mask &= ~GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK;
!       screen_info->texture_mask &= ~GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK;
!       screen_info->feature_mask &= ~GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK;
!     }
  #endif
      
--- 114,123 ----
  
  #ifdef GLX_ATI_render_texture
!     screen_info->glx_feature_mask |= GLC_GLX_FEATURE_ATI_RENDER_TEXTURE_MASK;
!     screen_info->feature_mask |= GLC_FEATURE_ATI_RENDER_TEXTURE_MASK;
  
!     /* ATI render texture doesn't seem to support texture rectangle */
!     screen_info->texture_mask &= ~GLC_TEXTURE_TARGET_RECTANGLE_MASK;
!     screen_info->feature_mask &= ~GLC_FEATURE_TEXTURE_RECTANGLE_MASK;
  #endif
      
***************
*** 148,161 ****
      
  #if defined(GL_ARB_multitexture) && defined(GL_ARB_fragment_program)
!     if (_glc_glx_gl_proc_address.gl_active_texture_arb &&
!         _glc_glx_gl_proc_address.gl_multi_tex_coord_2d_arb &&
!         _glc_glx_gl_proc_address.gl_gen_programs_arb &&
!         _glc_glx_gl_proc_address.gl_delete_programs_arb &&
!         _glc_glx_gl_proc_address.gl_program_string_arb &&
!         _glc_glx_gl_proc_address.gl_bind_program_arb) {
!       screen_info->glx_feature_mask |=
!         GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!       screen_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!     }
  #endif
      
--- 130,136 ----
      
  #if defined(GL_ARB_multitexture) && defined(GL_ARB_fragment_program)
!     screen_info->glx_feature_mask |=
!       GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!     screen_info->feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
  #endif
      

Index: glc_glx_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_format.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/glc_glx_format.c	16 Feb 2004 22:02:40 -0000	1.14
--- b/glc_glx_format.c	18 Feb 2004 14:52:45 -0000	1.15
***************
*** 35,39 ****
  #include <string.h>
  
! extern glc_glx_proc_address_list_t _glc_glx_proc_address;
  
  static int
--- 35,39 ----
  #include <string.h>
  
! extern glc_glx_static_proc_address_list_t _glc_glx_proc_address;
  
  static int
***************
*** 224,228 ****
    /* GLX 1.3 is not support, falling back to GLX 1.2 */
    if (!fbconfigs) {
-     screen_info->glx_feature_mask &= ~GLC_GLX_FEATURE_GLX13_MASK;
      screen_info->feature_mask &= ~GLC_FEATURE_OFFSCREEN_DRAWING_MASK;
      return 1;
--- 224,227 ----
***************
*** 345,349 ****
  
  #ifdef GLX_VERSION_1_3
!   if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_GLX13_MASK)
      status = glc_glx_query_formats_glx13 (screen_info);
  #endif
--- 344,348 ----
  
  #ifdef GLX_VERSION_1_3
!   if (screen_info->feature_mask & GLC_FEATURE_OFFSCREEN_DRAWING_MASK)
      status = glc_glx_query_formats_glx13 (screen_info);
  #endif
***************
*** 394,398 ****
      glc_glx_screen_info_get (display, screen);
  
!   if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_GLX13_MASK) {
  
  #ifdef GLX_VERSION_1_3
--- 393,397 ----
      glc_glx_screen_info_get (display, screen);
  
!   if (screen_info->feature_mask & GLC_FEATURE_OFFSCREEN_DRAWING_MASK) {
  
  #ifdef GLX_VERSION_1_3

Index: glc_glx_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_info.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/glc_glx_info.c	16 Feb 2004 22:02:40 -0000	1.9
--- b/glc_glx_info.c	18 Feb 2004 14:52:45 -0000	1.10
***************
*** 34,55 ****
  #include <dlfcn.h>
  
! glc_gl_proc_address_list_t _glc_glx_gl_proc_address = {
! 
! #ifdef GL_ARB_multitexture
!   NULL,
!   NULL,
! #endif
! 
! #ifdef GL_ARB_fragment_program
!   NULL,
!   NULL,
!   NULL,
!   NULL,
! #endif
!   
!   0
! };
! 
! glc_glx_proc_address_list_t _glc_glx_proc_address = {
  
  #ifdef GLX_VERSION_1_3
--- 34,38 ----
  #include <dlfcn.h>
  
! glc_glx_static_proc_address_list_t _glc_glx_proc_address = {
  
  #ifdef GLX_VERSION_1_3
***************
*** 61,69 ****
  #endif
    
- #ifdef GLX_ATI_render_texture
-   NULL,
-   NULL,
- #endif
- 
    0
  };
--- 44,47 ----
***************
*** 73,77 ****
  glc_proc_ptr_get_proc_address_arb_t glc_glx_get_proc_address_arb = NULL;
  
! static void *
  glc_glx_get_proc_address (const char *name)
  {
--- 51,55 ----
  glc_proc_ptr_get_proc_address_arb_t glc_glx_get_proc_address_arb = NULL;
  
! void *
  glc_glx_get_proc_address (const char *name)
  {
***************
*** 96,100 ****
  glc_glx_proc_address_lookup (void)
  {
-   _glc_glx_gl_proc_address.supported = 1;
    _glc_glx_proc_address.supported = 1;
    
--- 74,77 ----
***************
*** 105,132 ****
  #endif
  
- #ifdef GL_ARB_multitexture
-   _glc_glx_gl_proc_address.gl_active_texture_arb =
-     (glc_proc_ptr_gl_active_texture_arb_t)
-     glc_glx_get_proc_address ("glActiveTextureARB");
-   _glc_glx_gl_proc_address.gl_multi_tex_coord_2d_arb =
-     (glc_proc_ptr_gl_multi_tex_coord_2d_arb_t)
-     glc_glx_get_proc_address ("glMultiTexCoord2dARB");
- #endif
- 
- #ifdef GL_ARB_fragment_program
-   _glc_glx_gl_proc_address.gl_gen_programs_arb =
-     (glc_proc_ptr_gl_gen_programs_arb_t)
-     glc_glx_get_proc_address ("glGenProgramsARB");
-   _glc_glx_gl_proc_address.gl_delete_programs_arb =
-     (glc_proc_ptr_gl_delete_programs_arb_t)
-     glc_glx_get_proc_address ("glDeleteProgramsARB");
-   _glc_glx_gl_proc_address.gl_program_string_arb =
-     (glc_proc_ptr_gl_program_string_arb_t)
-     glc_glx_get_proc_address ("glProgramStringARB");
-   _glc_glx_gl_proc_address.gl_bind_program_arb =
-     (glc_proc_ptr_gl_bind_program_arb_t)
-     glc_glx_get_proc_address ("glBindProgramARB");
- #endif
- 
  #ifdef GLX_VERSION_1_3
    _glc_glx_proc_address.glx_get_fbconfigs =
--- 82,85 ----
***************
*** 147,159 ****
  #endif
    
- #ifdef GLX_ATI_render_texture
-   _glc_glx_proc_address.glx_bind_tex_image_ati =
-     (glc_proc_ptr_bind_tex_image_ati_t)
-     glc_glx_get_proc_address ("glXBindTexImageATI");
-   _glc_glx_proc_address.glx_release_tex_image_ati =
-     (glc_proc_ptr_release_tex_image_ati_t)
-     glc_glx_get_proc_address ("glXReleaseTexImageATI");
- #endif
-   
  }
  
--- 100,103 ----
***************
*** 267,270 ****
--- 211,224 ----
    
    screen_info->root_context.id = vinfo->visualid;
+ 
+   memset (&screen_info->root_context.gl_proc_address, 0,
+           sizeof (glc_gl_proc_address_list_t));
+   memset (&screen_info->root_context.glx_proc_address, 0,
+           sizeof (glc_glx_proc_address_list_t));
+   
+   if (_glc_glx_proc_address.supported) {
+     screen_info->root_context.gl_proc_address.supported =
+       screen_info->root_context.glx_proc_address.supported = 1;
+   }
    
    XFree (vinfo);
***************
*** 302,309 ****
    screen_info->n_contexts = 0;
  
!   screen_info->programs.program_2d_2d = 0;
!   screen_info->programs.program_rect_2d = 0;
!   screen_info->programs.program_2d_rect = 0;
!   screen_info->programs.program_rect_rect = 0;
  
    glc_glx_create_root_context (screen_info);
--- 256,260 ----
    screen_info->n_contexts = 0;
  
!   memset (&screen_info->programs, 0, sizeof (glc_fragment_programs_t));
  
    glc_glx_create_root_context (screen_info);
***************
*** 317,320 ****
--- 268,274 ----
    glc_glx_query_extensions (screen_info);
    glc_glx_query_formats (screen_info);
+ 
+   if (screen_info->root_context.gl_proc_address.supported)
+     glc_glx_context_proc_address_lookup (&screen_info->root_context);
    
    screen_info->context_stack = malloc (sizeof (glc_glx_context_info_t));
***************
*** 344,352 ****
  
  #ifdef GL_EXT_texture_rectangle
!           | GLC_FEATURE_EXT_TEXTURE_RECTANGLE_MASK
  #endif
  
  #ifdef GL_NV_texture_rectangle
!           | GLC_FEATURE_NV_TEXTURE_RECTANGLE_MASK
  #endif
            
--- 298,306 ----
  
  #ifdef GL_EXT_texture_rectangle
!           | GLC_FEATURE_TEXTURE_RECTANGLE_MASK
  #endif
  
  #ifdef GL_NV_texture_rectangle
!           | GLC_FEATURE_TEXTURE_RECTANGLE_MASK
  #endif
            

Index: glc_glx_pbuffer.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_pbuffer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/glc_glx_pbuffer.c	16 Feb 2004 22:02:40 -0000	1.6
--- b/glc_glx_pbuffer.c	18 Feb 2004 14:52:45 -0000	1.7
***************
*** 32,36 ****
  #include "glcint.h"
  
! extern glc_glx_proc_address_list_t _glc_glx_proc_address;
  
  #ifdef GLX_VERSION_1_3
--- 32,36 ----
  #include "glcint.h"
  
! extern glc_glx_static_proc_address_list_t _glc_glx_proc_address;
  
  #ifdef GLX_VERSION_1_3

Index: glc_glx_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_surface.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/glc_glx_surface.c	16 Feb 2004 22:02:40 -0000	1.14
--- b/glc_glx_surface.c	18 Feb 2004 14:52:45 -0000	1.15
***************
*** 32,38 ****
  #include "glcint.h"
  
- extern glc_gl_proc_address_list_t _glc_glx_gl_proc_address;
- extern glc_glx_proc_address_list_t _glc_glx_proc_address;
- 
  static glc_surface_t *
  _glc_glx_surface_create_similar (void *abstract_templ,
--- 32,35 ----
***************
*** 63,72 ****
        
  #ifdef GLX_ATI_render_texture
!     _glc_glx_proc_address.glx_release_tex_image_ati
!       (surface->screen_info->display_info->display, surface->pbuffer,
!        (surface->base.format->doublebuffer)?
!        GLX_BACK_LEFT_ATI: GLX_FRONT_LEFT_ATI);
  #endif
!     
      }
      if (!surface->drawable)
--- 60,69 ----
        
  #ifdef GLX_ATI_render_texture
!       surface->context->glx_proc_address.glx_release_tex_image_ati
!         (surface->screen_info->display_info->display, surface->pbuffer,
!          (surface->base.format->doublebuffer)?
!          GLX_BACK_LEFT_ATI: GLX_FRONT_LEFT_ATI);
  #endif
!       
      }
      if (!surface->drawable)
***************
*** 135,139 ****
      
  #ifdef GLX_ATI_render_texture
!     _glc_glx_proc_address.glx_bind_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
         (surface->base.format->doublebuffer)?
--- 132,136 ----
      
  #ifdef GLX_ATI_render_texture
!     surface->context->glx_proc_address.glx_bind_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
         (surface->base.format->doublebuffer)?
***************
*** 151,155 ****
  
  static glc_texture_t *
! _glc_glx_surface_get_texture (void *abstract_surface) {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;
  
--- 148,153 ----
  
  static glc_texture_t *
! _glc_glx_surface_get_texture (void *abstract_surface)
! {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;
  
***************
*** 162,165 ****
--- 160,198 ----
  }
  
+ static void
+ _glc_glx_set_features (glc_glx_surface_t *surface)
+ {
+   surface->base.feature_mask = surface->screen_info->feature_mask;
+ 
+   surface->base.feature_mask &= ~GLC_FEATURE_ATI_RENDER_TEXTURE_MASK;
+   surface->base.feature_mask &= ~GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
+ 
+   if (surface->context->glx_proc_address.supported) {
+     glc_surface_push_current (&surface->base, GLC_CN_SURFACE_CONTEXT_CURRENT);
+     glc_surface_pop_current (&surface->base);
+   }
+   
+ #ifdef GLX_ATI_render_texture
+   if ((surface->screen_info->feature_mask &
+        GLC_FEATURE_ATI_RENDER_TEXTURE_MASK) &&
+       surface->context->glx_proc_address.glx_bind_tex_image_ati &&
+       surface->context->glx_proc_address.glx_release_tex_image_ati)
+     surface->base.feature_mask |= GLC_FEATURE_ATI_RENDER_TEXTURE_MASK;
+ #endif
+ 
+ #if defined(GL_ARB_multitexture) && defined(GL_ARB_fragment_program)
+   if ((surface->screen_info->feature_mask &
+        GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) &&
+       surface->context->gl_proc_address.gl_active_texture_arb &&
+       surface->context->gl_proc_address.gl_multi_tex_coord_2d_arb &&
+       surface->context->gl_proc_address.gl_gen_programs_arb &&
+       surface->context->gl_proc_address.gl_delete_programs_arb &&
+       surface->context->gl_proc_address.gl_program_string_arb &&
+       surface->context->gl_proc_address.gl_bind_program_arb)
+     surface->base.feature_mask |= GLC_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
+ #endif
+   
+ }
+ 
  static glc_surface_t *
  _glc_glx_surface_create (glc_glx_screen_info_t *screen_info,
***************
*** 184,191 ****
    surface->screen_info = screen_info;
    surface->context = context;
! 
!   surface->base.proc_address = &_glc_glx_gl_proc_address;
    surface->base.programs = &screen_info->programs;
-   surface->base.feature_mask = screen_info->feature_mask;
    surface->base.format = format;
    surface->base.width = width;
--- 217,222 ----
    surface->screen_info = screen_info;
    surface->context = context;
!   
    surface->base.programs = &screen_info->programs;
    surface->base.format = format;
    surface->base.width = width;
***************
*** 194,203 ****
    texture_format = glc_get_gl_format_from_bpp (format->bpp);
  
!   if (screen_info->glx_feature_mask &
!       GLC_GLX_FEATURE_ATI_RENDER_TEXTURE_MASK) {
      surface->render_texture = 1;
-     if (format->red_size || format->green_size || format->blue_size)
-       surface->base.requires_flipping = 0;
-   }
    
    glc_surface_push_current (&surface->base, GLC_CN_ANY_CONTEXT_CURRENT);
--- 225,230 ----
    texture_format = glc_get_gl_format_from_bpp (format->bpp);
  
!   if (screen_info->feature_mask & GLC_FEATURE_ATI_RENDER_TEXTURE_MASK)
      surface->render_texture = 1;
    
    glc_surface_push_current (&surface->base, GLC_CN_ANY_CONTEXT_CURRENT);
***************
*** 221,224 ****
--- 248,261 ----
                                surface->render_texture);
  #endif
+ 
+   _glc_glx_set_features (surface);
+   
+   surface->base.proc_address = &context->gl_proc_address;
+ 
+   if (surface->base.feature_mask & GLC_FEATURE_ATI_RENDER_TEXTURE_MASK) {
+     if (format->red_size || format->green_size || format->blue_size)
+       surface->base.requires_flipping = 0;
+   } else
+     surface->render_texture = 0;
    
    if ((!surface->render_texture) && (!surface->pbuffer))
***************
*** 273,279 ****
    surface->context = context;
  
-   surface->base.proc_address = &_glc_glx_gl_proc_address;
    surface->base.programs = &screen_info->programs;
-   surface->base.feature_mask = screen_info->feature_mask;
    surface->base.format = format;
    surface->base.width = width;
--- 310,314 ----
***************
*** 281,284 ****
--- 316,323 ----
    
    surface->drawable = window;
+ 
+   _glc_glx_set_features (surface);
+ 
+   surface->base.proc_address = &context->gl_proc_address;
    
    return &surface->base;
***************
*** 323,327 ****
      
  #ifdef GLX_ATI_render_texture
!     _glc_glx_proc_address.glx_release_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
         (surface->base.format->doublebuffer)?
--- 362,366 ----
      
  #ifdef GLX_ATI_render_texture
!     surface->context->glx_proc_address.glx_release_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
         (surface->base.format->doublebuffer)?

Index: glc_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_surface.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** a/glc_surface.c	16 Feb 2004 22:02:40 -0000	1.15
--- b/glc_surface.c	18 Feb 2004 14:52:45 -0000	1.16
***************
*** 544,545 ****
--- 544,552 ----
  }
  slim_hidden_def(glc_surface_gl_end);
+ 
+ unsigned long
+ glc_surface_features (glc_surface_t *surface)
+ {
+   return surface->feature_mask;
+ }
+ slim_hidden_def(glc_surface_features);

Index: glc_texture.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_texture.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/glc_texture.c	16 Feb 2004 22:02:40 -0000	1.8
--- b/glc_texture.c	18 Feb 2004 14:52:45 -0000	1.9
***************
*** 55,68 ****
        (!_glc_texture_is_power_of_two (width)) ||
        (!_glc_texture_is_power_of_two (height))) {
!     if (target_mask & GLC_TEXTURE_TARGET_EXT_RECTANGLE_MASK) {
  
  #ifdef GL_EXT_texture_rectangle
        *target = GL_TEXTURE_RECTANGLE_EXT;
        *proxy_target = GL_PROXY_TEXTURE_RECTANGLE_EXT;
! #endif
! 
!     } else if (target_mask & GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK) {
!       
! #ifdef GL_NV_texture_rectangle
        *target = GL_TEXTURE_RECTANGLE_NV;
        *proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV;
--- 55,64 ----
        (!_glc_texture_is_power_of_two (width)) ||
        (!_glc_texture_is_power_of_two (height))) {
!     if (target_mask & GLC_TEXTURE_TARGET_RECTANGLE_MASK) {
  
  #ifdef GL_EXT_texture_rectangle
        *target = GL_TEXTURE_RECTANGLE_EXT;
        *proxy_target = GL_PROXY_TEXTURE_RECTANGLE_EXT;
! #else
        *target = GL_TEXTURE_RECTANGLE_NV;
        *proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV;
***************
*** 199,207 ****
  {
  
! #ifdef GL_EXT_texture_rectangle
    glDisable (GL_TEXTURE_RECTANGLE_EXT);
! #endif
!   
! #ifdef GL_NV_texture_rectangle
    glDisable (GL_TEXTURE_RECTANGLE_NV);
  #endif
--- 195,201 ----
  {
  
! #if defined(GL_EXT_texture_rectangle)
    glDisable (GL_TEXTURE_RECTANGLE_EXT);
! #elif defined(GL_NV_texture_rectangle)
    glDisable (GL_TEXTURE_RECTANGLE_NV);
  #endif

Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** a/glcint.h	16 Feb 2004 22:02:40 -0000	1.16
--- b/glcint.h	18 Feb 2004 14:52:45 -0000	1.17
***************
*** 73,79 ****
  #define GLC_STATUS_INVALID_MATRIX_MASK     (1L << 6)
  
! #define GLC_TEXTURE_TARGET_2D_MASK            (1L << 0)
! #define GLC_TEXTURE_TARGET_EXT_RECTANGLE_MASK (1L << 1)
! #define GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK  (1L << 2)
  
  #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1 << 16) - 2)
--- 73,78 ----
  #define GLC_STATUS_INVALID_MATRIX_MASK     (1L << 6)
  
! #define GLC_TEXTURE_TARGET_2D_MASK        (1L << 0)
! #define GLC_TEXTURE_TARGET_RECTANGLE_MASK (1L << 1)
  
  #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1 << 16) - 2)
***************
*** 425,428 ****
--- 424,428 ----
  slim_hidden_proto(glc_surface_gl_begin)
  slim_hidden_proto(glc_surface_gl_end)
+ slim_hidden_proto(glc_surface_features)
  slim_hidden_proto(glc_fill_rectangle)
  slim_hidden_proto(glc_fill_rectangles)
***************
*** 444,455 ****
  #endif
  
! #define GLC_GLX_FEATURE_GLX13_MASK                 (1L << 0)
! #define GLC_GLX_FEATURE_EXT_TEXTURE_RECTANGLE_MASK (1L << 1)
! #define GLC_GLX_FEATURE_NV_TEXTURE_RECTANGLE_MASK  (1L << 2)
! #define GLC_GLX_FEATURE_MULTISAMPLE_MASK           (1L << 3)
! #define GLC_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK    (1L << 4)
! #define GLC_GLX_FEATURE_MULTISAMPLE_FILTER_MASK    (1L << 5)
! #define GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK  (1L << 6)
! #define GLC_GLX_FEATURE_ATI_RENDER_TEXTURE_MASK    (1L << 7)
  
  typedef struct _glc_glx_surface glc_glx_surface_t;
--- 444,453 ----
  #endif
  
! #define GLC_GLX_FEATURE_TEXTURE_RECTANGLE_MASK     (1L << 0)
! #define GLC_GLX_FEATURE_MULTISAMPLE_MASK           (1L << 1)
! #define GLC_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK    (1L << 2)
! #define GLC_GLX_FEATURE_MULTISAMPLE_FILTER_MASK    (1L << 3)
! #define GLC_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK  (1L << 4)
! #define GLC_GLX_FEATURE_ATI_RENDER_TEXTURE_MASK    (1L << 5)
  
  typedef struct _glc_glx_surface glc_glx_surface_t;
***************
*** 477,481 ****
  #endif
  
! typedef struct _glc_glx_proc_address_list_t {
  
  #ifdef GLX_VERSION_1_3
--- 475,479 ----
  #endif
  
! typedef struct _glc_glx_static_proc_address_list_t {
  
  #ifdef GLX_VERSION_1_3
***************
*** 487,490 ****
--- 485,493 ----
  #endif
    
+   glc_bool_t supported;
+ } glc_glx_static_proc_address_list_t;
+ 
+ typedef struct _glc_glx_proc_address_list_t {
+ 
  #ifdef GLX_ATI_render_texture
    glc_proc_ptr_bind_tex_image_ati_t glx_bind_tex_image_ati;
***************
*** 515,518 ****
--- 518,523 ----
    GLXContext context;
    XID id;
+   glc_gl_proc_address_list_t gl_proc_address;
+   glc_glx_proc_address_list_t glx_proc_address;
    
  #ifdef GLX_VERSION_1_3
***************
*** 569,572 ****
--- 574,580 ----
                           int screen);
  
+ extern void *__internal_linkage
+ glc_glx_get_proc_address (const char *name);
+ 
  extern glc_glx_context_t *__internal_linkage
  glc_glx_context_get (glc_glx_screen_info_t *screen_info,
***************
*** 587,590 ****
--- 595,601 ----
  
  extern void __internal_linkage
+ glc_glx_context_proc_address_lookup (glc_glx_context_t *context);
+ 
+ extern void __internal_linkage
  glc_glx_query_formats (glc_glx_screen_info_t *screen_info);
  
***************
*** 620,629 ****
  #include <AGL/agl.h>
  
! #define GLC_AGL_FEATURE_PBUFFER_MASK               (1L << 0)
! #define GLC_AGL_FEATURE_NV_TEXTURE_RECTANGLE_MASK  (1L << 1)
! #define GLC_AGL_FEATURE_EXT_TEXTURE_RECTANGLE_MASK (1L << 2)
! #define GLC_AGL_FEATURE_MULTISAMPLE_MASK           (1L << 3)
! #define GLC_AGL_FEATURE_MULTISAMPLE_FILTER_MASK    (1L << 4)
! #define GLC_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK  (1L << 5)
  
  typedef struct _glc_agl_surface_t glc_agl_surface_t;
--- 631,639 ----
  #include <AGL/agl.h>
  
! #define GLC_AGL_FEATURE_PBUFFER_MASK              (1L << 0)
! #define GLC_AGL_FEATURE_TEXTURE_RECTANGLE_MASK    (1L << 1)
! #define GLC_AGL_FEATURE_MULTISAMPLE_MASK          (1L << 2)
! #define GLC_AGL_FEATURE_MULTISAMPLE_FILTER_MASK   (1L << 3)
! #define GLC_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK (1L << 4)
  
  typedef struct _glc_agl_surface_t glc_agl_surface_t;





More information about the cairo-commit mailing list