[cairo-commit] glitz/src glitz.c, 1.3, 1.4 glitz_agl_extension.c, 1.2, 1.3 glitz_agl_info.c, 1.1.1.1, 1.2 glitz_agl_pbuffer.c, 1.2, 1.3 glitz_agl_surface.c, 1.4, 1.5 glitz_aglint.h, 1.2, 1.3 glitz_glx_context.c, 1.3, 1.4 glitz_glx_format.c, 1.3, 1.4 glitz_glx_info.c, 1.2, 1.3 glitz_glx_surface.c, 1.4, 1.5 glitz_glxint.h, 1.4, 1.5 glitz_program.c, 1.4, 1.5 glitz_programmatic.c, 1.3, 1.4 glitz_surface.c, 1.5, 1.6 glitz_texture.c, 1.2, 1.3 glitzint.h, 1.6, 1.7

David Reveman commit at pdx.freedesktop.org
Thu May 6 07:55:05 PDT 2004


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv18503/src

Modified Files:
	glitz.c glitz_agl_extension.c glitz_agl_info.c 
	glitz_agl_pbuffer.c glitz_agl_surface.c glitz_aglint.h 
	glitz_glx_context.c glitz_glx_format.c glitz_glx_info.c 
	glitz_glx_surface.c glitz_glxint.h glitz_program.c 
	glitz_programmatic.c glitz_surface.c glitz_texture.c 
	glitzint.h 
Log Message:
Better texture handling

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz.c	30 Apr 2004 02:26:02 -0000	1.3
--- b/glitz.c	6 May 2004 14:55:03 -0000	1.4
***************
*** 102,105 ****
--- 102,110 ----
    mask_texture = glitz_surface_get_texture (mask);
  
+   /* Texture has not been allocated, hence source and the result of this
+      operation is undefined. So lets do nothing. */
+   if ((!src_texture) || (!mask_texture))
+     return 1;
+ 
    if (SURFACE_MANUALREPEAT (src, src_texture) ||
        SURFACE_MANUALREPEAT (mask, mask_texture))
***************
*** 293,299 ****
  
    dirty_region.x1 = floor (dst_region.x1);
!   dirty_region.x1 = floor (dst_region.y1);
    dirty_region.x2 = ceil (dst_region.x2);
!   dirty_region.x2 = ceil (dst_region.y2);
    glitz_surface_dirty (dst, &dirty_region);
      
--- 298,304 ----
  
    dirty_region.x1 = floor (dst_region.x1);
!   dirty_region.y1 = floor (dst_region.y1);
    dirty_region.x2 = ceil (dst_region.x2);
!   dirty_region.y2 = ceil (dst_region.y2);
    glitz_surface_dirty (dst, &dirty_region);
      
***************
*** 542,545 ****
--- 547,555 ----
  
    texture = glitz_surface_get_texture (src);
+   
+   /* Texture has not been allocated, hence source and the result of this
+      operation is undefined. So lets do nothing. */
+   if (!texture)
+     return;
  
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_agl_extension.c	28 Apr 2004 08:59:38 -0000	1.2
--- b/glitz_agl_extension.c	6 May 2004 14:55:03 -0000	1.3
***************
*** 107,114 ****
          GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
        thread_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
- 
-     if ((thread_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
-         (thread_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
-       thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    }
  }
--- 107,110 ----

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_agl_info.c	30 Mar 2004 17:07:19 -0000	1.1.1.1
--- b/glitz_agl_info.c	6 May 2004 14:55:03 -0000	1.2
***************
*** 184,187 ****
--- 184,204 ----
    
    glitz_agl_query_extensions (thread_info);
+ 
+   if ((thread_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
+       (thread_info->feature_mask &
+        GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)) {
+     glitz_gl_uint_t texture_indirections;
+     
+      _glitz_agl_gl_proc_address.get_program_iv_arb
+        (GLITZ_GL_FRAGMENT_PROGRAM_ARB,
+         GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
+         &texture_indirections);
+ 
+     /* Convolution filter programs require support for at least nine
+        texture indirections. */
+     if (texture_indirections >= 9)
+       thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
+   }
+   
    glitz_agl_query_formats (thread_info);
  

Index: glitz_agl_pbuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_pbuffer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_agl_pbuffer.c	28 Apr 2004 08:59:38 -0000	1.2
--- b/glitz_agl_pbuffer.c	6 May 2004 14:55:03 -0000	1.3
***************
*** 51,54 ****
--- 51,57 ----
                          glitz_format_t *format)
  {
+   _glitz_agl_gl_proc_address.gen_textures (1, &texture->name);
+   texture->allocated = 1;
+   
    glitz_texture_bind (&_glitz_agl_gl_proc_address, texture);
  

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_agl_surface.c	28 Apr 2004 08:59:38 -0000	1.4
--- b/glitz_agl_surface.c	6 May 2004 14:55:03 -0000	1.5
***************
*** 36,43 ****
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                  glitz_format_name_t format_name,
!                                  glitz_bool_t drawable,
!                                  int width,
!                                  int height);
  
  static void
--- 36,43 ----
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                    glitz_format_name_t format_name,
!                                    glitz_bool_t drawable,
!                                    int width,
!                                    int height);
  
  static void
***************
*** 55,59 ****
  static glitz_bool_t
  _glitz_agl_surface_push_current (void *abstract_surface,
!                                glitz_constraint_t constraint)
  {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
--- 55,59 ----
  static glitz_bool_t
  _glitz_agl_surface_push_current (void *abstract_surface,
!                                  glitz_constraint_t constraint)
  {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
***************
*** 97,129 ****
  };
  
- static void
- _glitz_agl_surface_ensure_texture (glitz_agl_surface_t *surface)
- {
-    if (!(surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK))
-     return;
-     
-   if (!surface->pbuffer)
-     glitz_texture_copy_surface (surface->base.texture, &surface->base,
-                               &surface->base.dirty_region);
-   
-   surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
- }
- 
  static glitz_texture_t *
  _glitz_agl_surface_get_texture (void *abstract_surface) {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (!surface->base.texture->allocated)
!     glitz_texture_allocate (surface->base.gl, surface->base.texture);
!   
!   _glitz_agl_surface_ensure_texture (surface);
!   
!   return surface->base.texture;
  }
  
  static void
  _glitz_agl_surface_update_size_for_window (WindowRef window,
!                                          int *width,
!                                          int *height)
  {
    Rect window_bounds;
--- 97,126 ----
  };
  
  static glitz_texture_t *
  _glitz_agl_surface_get_texture (void *abstract_surface) {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
!     if (surface->pbuffer) {
!       surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
!       
!       return &surface->base.texture;
!     } else 
!       glitz_texture_copy_surface (&surface->base.texture, &surface->base,
!                                   &surface->base.dirty_region);
!     
!     surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
!   }
! 
!   if (surface->base.texture.allocated)
!     return &surface->base.texture;
!   else
!     return NULL;
  }
  
  static void
  _glitz_agl_surface_update_size_for_window (WindowRef window,
!                                            int *width,
!                                            int *height)
  {
    Rect window_bounds;
***************
*** 145,180 ****
  
    if (surface->thread_info->feature_mask &
!       GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
!     glitz_gl_uint_t texture_indirections;
! 
!     surface->base.gl->get_program_iv_arb
!       (GLITZ_GL_FRAGMENT_PROGRAM_ARB,
!        GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
!        &texture_indirections);
! 
!     /* Convolution filter programs require support for at least nine
!        texture indirections. */
!     if (texture_indirections >= 9)
!       surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
!   }
  
!   if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
!     if (surface->thread_info->feature_mask &
!         GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
!       surface->base.feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
!   }
  }
  
  static glitz_surface_t *
  _glitz_agl_surface_create (glitz_agl_thread_info_t *thread_info,
!                          glitz_format_t *format,
!                          int width,
!                          int height)
  {
    glitz_agl_surface_t *surface;
    glitz_agl_context_t *context;
!   unsigned int texture_format;
!   long int texture_target_mask;
  
    context = glitz_agl_context_get (thread_info, format, 1);
--- 142,165 ----
  
    if (surface->thread_info->feature_mask &
!       GLITZ_FEATURE_CONVOLUTION_FILTER_MASK)
!     surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
  
!   if (surface->thread_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK)
      surface->base.feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
!   
!   if (surface->thread_info->feature_mask &
!       GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
!     surface->base.feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  }
  
  static glitz_surface_t *
  _glitz_agl_surface_create (glitz_agl_thread_info_t *thread_info,
!                            glitz_format_t *format,
!                            int width,
!                            int height)
  {
    glitz_agl_surface_t *surface;
    glitz_agl_context_t *context;
!   unsigned long texture_mask;
  
    context = glitz_agl_context_get (thread_info, format, 1);
***************
*** 186,245 ****
      return NULL;
  
!   glitz_surface_init (&surface->base, &glitz_agl_surface_backend);
    
    surface->thread_info = thread_info;
    surface->context = context;
  
-   surface->base.gl = &_glitz_agl_gl_proc_address;
-   surface->base.programs = &thread_info->programs;
-   surface->base.feature_mask = 0;
-   surface->base.format = format;
-   surface->base.width = width;
-   surface->base.height = height;
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
-   texture_format = glitz_get_gl_format_from_bpp (format->bpp);
- 
-   glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
- 
-   texture_target_mask = thread_info->texture_mask;
- 
-   /* Seems to be problem with binding a pbuffer to some power of two sized
-      textures. This will try to avoid the problem. */
-   if (((width > 1) && (width < 64)) ||
-       ((height > 1) && (height < 64)))
-     texture_target_mask &= ~GLITZ_TEXTURE_TARGET_2D_MASK;
- 
-   surface->base.texture =
-     glitz_texture_generate (surface->base.gl,
-                             width, height,
-                             texture_format,
-                             texture_target_mask);
- 
-   if (!surface->base.texture) {
-     glitz_surface_pop_current (&surface->base);
-     glitz_surface_destroy (&surface->base);
-     return NULL;
-   }
-   
-   if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
-     surface->pbuffer = glitz_agl_pbuffer_create (surface->base.texture);
-   
    _glitz_agl_set_features (surface);
  
!   if (!surface->pbuffer) {
!     glitz_texture_allocate (surface->base.gl, surface->base.texture);
!   } else {
!     glitz_surface_push_current (&surface->base,
!                                 GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     glitz_agl_pbuffer_bind (surface->pbuffer,
!                             surface->context->context,
!                             surface->base.texture,
!                             surface->base.format);
!     glitz_surface_pop_current (&surface->base);
    }
  
-   glitz_surface_pop_current (&surface->base);
- 
    return &surface->base;
  }
--- 171,213 ----
      return NULL;
  
!   texture_mask = thread_info->texture_mask;
! 
!   /* Seems to be a problem with binding a pbuffer to some power of two sized
!      textures. This will try to avoid the problem. */
!   if (((width > 1) && (width < 64)) ||
!       ((height > 1) && (height < 64))) {
!     if (texture_mask != GLITZ_TEXTURE_TARGET_2D_MASK)
!       texture_mask &= ~GLITZ_TEXTURE_TARGET_2D_MASK;
!   }
! 
!   glitz_surface_init (&surface->base,
!                       &glitz_agl_surface_backend,
!                       &_glitz_agl_gl_proc_address,
!                       format,
!                       width,
!                       height,
!                       &thread_info->programs,
!                       texture_mask);
    
    surface->thread_info = thread_info;
    surface->context = context;
  
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
    _glitz_agl_set_features (surface);
  
!   if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) {
!     surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
!     if (surface->pbuffer) {
!       glitz_surface_push_current (&surface->base,
!                                   GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!       glitz_agl_pbuffer_bind (surface->pbuffer,
!                               surface->context->context,
!                               &surface->base.texture,
!                               surface->base.format);
!       glitz_surface_pop_current (&surface->base);
!     }
    }
  
    return &surface->base;
  }
***************
*** 247,255 ****
  glitz_surface_t *
  glitz_agl_surface_create (glitz_format_t *format,
!                         int width,
!                         int height)
  {
    return _glitz_agl_surface_create (glitz_agl_thread_info_get (),
!                                   format, width, height);
  }
  slim_hidden_def(glitz_agl_surface_create_offscreen);
--- 215,223 ----
  glitz_surface_t *
  glitz_agl_surface_create (glitz_format_t *format,
!                           int width,
!                           int height)
  {
    return _glitz_agl_surface_create (glitz_agl_thread_info_get (),
!                                     format, width, height);
  }
  slim_hidden_def(glitz_agl_surface_create_offscreen);
***************
*** 257,261 ****
  glitz_surface_t *
  glitz_agl_surface_create_for_window (glitz_format_t *format,
!                                    WindowRef window)
  {
    glitz_agl_surface_t *surface;
--- 225,229 ----
  glitz_surface_t *
  glitz_agl_surface_create_for_window (glitz_format_t *format,
!                                      WindowRef window)
  {
    glitz_agl_surface_t *surface;
***************
*** 274,292 ****
      return NULL;
  
!   glitz_surface_init (&surface->base, &glitz_agl_surface_backend);
    
    surface->thread_info = thread_info;
    surface->context = context;
- 
-   surface->base.gl = &_glitz_agl_gl_proc_address;
-   surface->base.programs = &thread_info->programs;
-   surface->base.format = format;
-   surface->base.width = width;
-   surface->base.height = height;
- 
-   _glitz_agl_set_features (surface);
- 
    surface->window = window;
    surface->drawable = GetWindowPort (window);
    
    return &surface->base;
--- 242,260 ----
      return NULL;
  
!   glitz_surface_init (&surface->base,
!                       &glitz_agl_surface_backend,
!                       &_glitz_agl_gl_proc_address,
!                       format,
!                       width,
!                       height,
!                       &thread_info->programs,
!                       thread_info->texture_mask);
    
    surface->thread_info = thread_info;
    surface->context = context;
    surface->window = window;
    surface->drawable = GetWindowPort (window);
+ 
+   _glitz_agl_set_features (surface);
    
    return &surface->base;
***************
*** 342,352 ****
    }
    
-   if (surface->base.texture)
-     glitz_texture_destroy (surface->base.gl, surface->base.texture);
-   
    if (surface->pbuffer)
      glitz_agl_pbuffer_destroy (surface->pbuffer);
    
!   glitz_surface_deinit (&surface->base);
    
    free (surface);
--- 310,317 ----
    }
    
    if (surface->pbuffer)
      glitz_agl_pbuffer_destroy (surface->pbuffer);
    
!   glitz_surface_fini (&surface->base);
    
    free (surface);

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_aglint.h	28 Apr 2004 08:59:38 -0000	1.2
--- b/glitz_aglint.h	6 May 2004 14:55:03 -0000	1.3
***************
*** 58,61 ****
--- 58,62 ----
    AGLPixelFormat pixel_format;
    glitz_bool_t offscreen;
+   glitz_gl_uint_t texture_indirections;
  } glitz_agl_context_t;
  

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glx_context.c	2 May 2004 14:11:09 -0000	1.3
--- b/glitz_glx_context.c	6 May 2004 14:55:03 -0000	1.4
***************
*** 179,184 ****
    memset (&context->glx, 0, sizeof (glitz_glx_proc_address_list_t));
    
!   if (_glitz_glx_proc_address.supported)
!     context->gl.supported = context->glx.supported = 1;
    
    return context;
--- 179,183 ----
    memset (&context->glx, 0, sizeof (glitz_glx_proc_address_list_t));
    
!   context->gl.need_lookup = context->glx.need_lookup = 1;
    
    return context;
***************
*** 221,226 ****
      glitz_glx_get_proc_address ("glGetProgramivARB");
  
!   context->gl.supported = 0;
!   context->glx.supported = 0;
  }
  
--- 220,231 ----
      glitz_glx_get_proc_address ("glGetProgramivARB");
  
!   if (context->gl.get_program_iv_arb) {
!     context->gl.get_program_iv_arb (GLITZ_GL_FRAGMENT_PROGRAM_ARB,
!                                     GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
!                                     &context->texture_indirections);
!   }
!   
!   context->gl.need_lookup = 0;
!   context->glx.need_lookup = 0;
  }
  
***************
*** 256,260 ****
                    drawable, context);
  
!   if (surface->drawable && surface->context->gl.supported)
      glitz_glx_context_proc_address_lookup (surface->context);
  }
--- 261,265 ----
                    drawable, context);
  
!   if (surface->context->gl.need_lookup)
      glitz_glx_context_proc_address_lookup (surface->context);
  }

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glx_format.c	2 May 2004 14:11:09 -0000	1.3
--- b/glitz_glx_format.c	6 May 2004 14:55:03 -0000	1.4
***************
*** 65,71 ****
      if (format[i]->drawable.offscreen &&
          format[i]->drawable.onscreen)
!       score[i] += 10;
      if (format[i]->multisample.supported) 
!       score[i] += (5 + format[i]->multisample.samples);
    }
    
--- 65,71 ----
      if (format[i]->drawable.offscreen &&
          format[i]->drawable.onscreen)
!       score[i] += 5;
      if (format[i]->multisample.supported) 
!       score[i] += (10 + format[i]->multisample.samples);
    }
    

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glx_info.c	1 May 2004 20:36:35 -0000	1.2
--- b/glitz_glx_info.c	6 May 2004 14:55:03 -0000	1.3
***************
*** 96,100 ****
    (glitz_gl_program_local_param_4d_arb_t) 0,
    (glitz_gl_get_program_iv_arb_t) 0,
!   0
  };
  
--- 96,100 ----
    (glitz_gl_program_local_param_4d_arb_t) 0,
    (glitz_gl_get_program_iv_arb_t) 0,
!   1
  };
  
***************
*** 105,109 ****
    (glitz_glx_create_pbuffer_t) 0,
    (glitz_glx_destroy_pbuffer_t) 0,
!   0
  };
  
--- 105,109 ----
    (glitz_glx_create_pbuffer_t) 0,
    (glitz_glx_destroy_pbuffer_t) 0,
!   1
  };
  
***************
*** 135,139 ****
  glitz_glx_proc_address_lookup (void)
  {
-   _glitz_glx_proc_address.supported = 1;
    glitz_glx_get_proc_address_arb =
      (glitz_glx_get_proc_address_arb_t)
--- 135,138 ----
***************
*** 154,157 ****
--- 153,157 ----
      (glitz_glx_destroy_pbuffer_t)
      glitz_glx_get_proc_address ("glXDestroyPbuffer");
+   _glitz_glx_proc_address.need_lookup = 0;
  }
  
***************
*** 173,177 ****
      info->displays = NULL;
      info->n_displays = 0;
!     if (!_glitz_glx_proc_address.supported)
        glitz_glx_proc_address_lookup ();
      xthread_key_create (&info_tsd, NULL);
--- 173,177 ----
      info->displays = NULL;
      info->n_displays = 0;
!     if (_glitz_glx_proc_address.need_lookup)
        glitz_glx_proc_address_lookup ();
      xthread_key_create (&info_tsd, NULL);
***************
*** 298,303 ****
            sizeof (glitz_glx_proc_address_list_t));
    
!   screen_info->root_context.gl.supported =
!     screen_info->root_context.glx.supported = 1;
  }
  
--- 298,303 ----
            sizeof (glitz_glx_proc_address_list_t));
    
!   screen_info->root_context.gl.need_lookup =
!     screen_info->root_context.glx.need_lookup = 1;
  }
  

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_glx_surface.c	28 Apr 2004 08:59:38 -0000	1.4
--- b/glitz_glx_surface.c	6 May 2004 14:55:03 -0000	1.5
***************
*** 115,141 ****
  }
  
- static void
- _glitz_glx_surface_ensure_texture (glitz_glx_surface_t *surface)
- {
-   if (!(surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK))
-     return;
-   
-   glitz_texture_copy_surface (surface->base.texture, &surface->base,
-                               &surface->base.dirty_region);
- 
-   surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
- }
- 
  static glitz_texture_t *
  _glitz_glx_surface_get_texture (void *abstract_surface)
  {
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
- 
-   if (!surface->base.texture->allocated)
-     glitz_texture_allocate (surface->base.gl, surface->base.texture);
    
!   _glitz_glx_surface_ensure_texture (surface);
    
!   return surface->base.texture;
  }
  
--- 115,133 ----
  }
  
  static glitz_texture_t *
  _glitz_glx_surface_get_texture (void *abstract_surface)
  {
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
    
!   if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
!     glitz_texture_copy_surface (&surface->base.texture, &surface->base,
!                                 &surface->base.dirty_region);
!     surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
!   }
    
!   if (surface->base.texture.allocated)
!     return &surface->base.texture;
!   else
!     return NULL;
  }
  
***************
*** 151,155 ****
    surface->base.feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  
!   if (surface->context->glx.supported) {
      glitz_surface_push_current (&surface->base,
                                  GLITZ_CN_SURFACE_CONTEXT_CURRENT);
--- 143,147 ----
    surface->base.feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  
!   if (surface->context->glx.need_lookup) {
      glitz_surface_push_current (&surface->base,
                                  GLITZ_CN_SURFACE_CONTEXT_CURRENT);
***************
*** 172,206 ****
          GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
        surface->base.feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!   
      if (surface->screen_info->feature_mask &
          GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK)
        surface->base.feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
      
!     if ((surface->base.feature_mask &
!          GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
          (surface->base.feature_mask &
           GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) &&
          surface->context->gl.program_local_param_4d_arb &&
!         surface->context->gl.get_program_iv_arb) {
!       glitz_gl_uint_t texture_indirections;
! 
!       surface->context->gl.get_program_iv_arb
!         (GLITZ_GL_FRAGMENT_PROGRAM_ARB,
!          GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB,
!          &texture_indirections);
! 
        /* Convolution filter programs require support for at least nine
           texture indirections. */
!       if (texture_indirections >= 9)
!         surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
      }
    }
  
!   if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
!     if (surface->screen_info->feature_mask &
!         GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
!       surface->base.feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
!   }
  }
  
--- 164,189 ----
          GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
        surface->base.feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!     
      if (surface->screen_info->feature_mask &
          GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK)
        surface->base.feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
      
!     if ((surface->base.feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
          (surface->base.feature_mask &
           GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) &&
          surface->context->gl.program_local_param_4d_arb &&
!         surface->context->texture_indirections >= 9) {
        /* Convolution filter programs require support for at least nine
           texture indirections. */
!       surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
      }
    }
  
!   if (surface->screen_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK)
      surface->base.feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
!   
!   if (surface->screen_info->feature_mask &
!       GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
!     surface->base.feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  }
  
***************
*** 213,217 ****
    glitz_glx_surface_t *surface;
    glitz_glx_context_t *context;
-   unsigned int texture_format;
  
    context = glitz_glx_context_get (screen_info, format);
--- 196,199 ----
***************
*** 223,265 ****
      return NULL;
  
!   glitz_surface_init (&surface->base, &glitz_glx_surface_backend);
! 
    surface->screen_info = screen_info;
    surface->context = context;
    
-   surface->base.programs = &screen_info->programs;
-   surface->base.format = format;
-   surface->base.width = width;
-   surface->base.height = height;
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
-   surface->base.gl = &context->gl;
- 
-   texture_format = glitz_get_gl_format_from_bpp (format->bpp);
- 
-   glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
  
!   surface->base.texture =
!     glitz_texture_generate (surface->base.gl,
!                             width, height,
!                             texture_format,
!                             screen_info->texture_mask);
! 
!   if (!surface->base.texture) {
!     glitz_surface_destroy (&surface->base);
!     return NULL;
!   }
! 
!   if (screen_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
      surface->drawable = surface->pbuffer =
        glitz_glx_pbuffer_create (screen_info->display_info->display,
                                  surface->context->fbconfig,
!                                 surface->base.texture);
  
    _glitz_glx_set_features (surface);
-   
-   if (!surface->pbuffer)
-     glitz_texture_allocate (surface->base.gl, surface->base.texture);
- 
-   glitz_surface_pop_current (&surface->base);
  
    return &surface->base;
--- 205,234 ----
      return NULL;
  
!   glitz_surface_init (&surface->base,
!                       &glitz_glx_surface_backend,
!                       &context->gl,
!                       format,
!                       width,
!                       height,
!                       &screen_info->programs,
!                       screen_info->texture_mask);
!   
    surface->screen_info = screen_info;
    surface->context = context;
    
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (screen_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) {
!     glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
!     
      surface->drawable = surface->pbuffer =
        glitz_glx_pbuffer_create (screen_info->display_info->display,
                                  surface->context->fbconfig,
!                                 &surface->base.texture);
!     
!     glitz_surface_pop_current (&surface->base);
!   }
  
    _glitz_glx_set_features (surface);
  
    return &surface->base;
***************
*** 305,319 ****
      return NULL;
  
!   glitz_surface_init (&surface->base, &glitz_glx_surface_backend);
    
    surface->screen_info = screen_info;
    surface->context = context;
- 
-   surface->base.programs = &screen_info->programs;
-   surface->base.format = format;
-   surface->base.width = width;
-   surface->base.height = height;
-   surface->base.gl = &context->gl;
-   
    surface->drawable = window;
  
--- 274,288 ----
      return NULL;
  
!   glitz_surface_init (&surface->base,
!                       &glitz_glx_surface_backend,
!                       &context->gl,
!                       format,
!                       width,
!                       height,
!                       &screen_info->programs,
!                       screen_info->texture_mask);
    
    surface->screen_info = screen_info;
    surface->context = context;
    surface->drawable = window;
  
***************
*** 356,362 ****
    glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
  
-   if (surface->base.texture)
-     glitz_texture_destroy (surface->base.gl, surface->base.texture);
- 
    if (surface->pbuffer)
      glitz_glx_pbuffer_destroy (surface->screen_info->display_info->display,
--- 325,328 ----
***************
*** 370,374 ****
    }
    
!   glitz_surface_deinit (&surface->base);
    
    free (surface);
--- 336,340 ----
    }
    
!   glitz_surface_fini (&surface->base);
    
    free (surface);

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_glxint.h	2 May 2004 14:11:09 -0000	1.4
--- b/glitz_glxint.h	6 May 2004 14:55:03 -0000	1.5
***************
*** 60,64 ****
    glitz_glx_create_pbuffer_t create_pbuffer;
    glitz_glx_destroy_pbuffer_t destroy_pbuffer;
!   glitz_bool_t supported;
  } glitz_glx_static_proc_address_list_t;
  
--- 60,64 ----
    glitz_glx_create_pbuffer_t create_pbuffer;
    glitz_glx_destroy_pbuffer_t destroy_pbuffer;
!   glitz_bool_t need_lookup;
  } glitz_glx_static_proc_address_list_t;
  
***************
*** 66,70 ****
    glitz_glx_bind_tex_image_arb_t bind_tex_image_arb;
    glitz_glx_release_tex_image_arb_t release_tex_image_arb;
!   glitz_bool_t supported;
  } glitz_glx_proc_address_list_t;
  
--- 66,70 ----
    glitz_glx_bind_tex_image_arb_t bind_tex_image_arb;
    glitz_glx_release_tex_image_arb_t release_tex_image_arb;
!   glitz_bool_t need_lookup;
  } glitz_glx_proc_address_list_t;
  
***************
*** 92,95 ****
--- 92,96 ----
    glitz_glx_proc_address_list_t glx;
    GLXFBConfig fbconfig;
+   glitz_gl_uint_t texture_indirections;
  } glitz_glx_context_t;
  

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_program.c	30 Apr 2004 02:26:02 -0000	1.4
--- b/glitz_program.c	6 May 2004 14:55:03 -0000	1.5
***************
*** 796,800 ****
      if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
        type = GLITZ_PROGRAM_TYPE_SIMPLE;
!     } else if ((mask->texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA) &&
                 (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK)) {
        type = GLITZ_PROGRAM_TYPE_SIMPLE;
--- 796,800 ----
      if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
        type = GLITZ_PROGRAM_TYPE_SIMPLE;
!     } else if ((mask->texture.internal_format == GLITZ_GL_LUMINANCE_ALPHA) &&
                 (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK)) {
        type = GLITZ_PROGRAM_TYPE_SIMPLE;

Index: glitz_programmatic.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_programmatic.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_programmatic.c	30 Apr 2004 02:26:02 -0000	1.3
--- b/glitz_programmatic.c	6 May 2004 14:55:03 -0000	1.4
***************
*** 60,64 ****
    }
    
!   glitz_surface_deinit (&surface->base);
    
    free (surface);
--- 60,64 ----
    }
    
!   glitz_surface_fini (&surface->base);
    
    free (surface);
***************
*** 86,90 ****
      (glitz_programmatic_surface_t *) abstract_surface;
    
!   return &surface->texture;
  }
  
--- 86,90 ----
      (glitz_programmatic_surface_t *) abstract_surface;
    
!   return &surface->base.texture;
  }
  
***************
*** 123,137 ****
      return NULL;
    
!   glitz_surface_init (&surface->base, &glitz_programmatic_surface_backend);
!   
    surface->base.hint_mask |= GLITZ_HINT_PROGRAMMATIC_MASK;
!   surface->base.texture = &surface->texture;
!   surface->texture.name = 0;
!   surface->texture.target = GLITZ_GL_TEXTURE_2D;
!   surface->texture.format = GLITZ_GL_RGBA;
!   surface->texture.filter = surface->base.filter;
!   surface->texture.texcoord_width =
!     surface->texture.texcoord_height = 1.0;
!   surface->texture.repeatable = surface->texture.repeat = 1;
    surface->transform = identity;
    
--- 123,138 ----
      return NULL;
    
!   glitz_surface_init (&surface->base,
!                       &glitz_programmatic_surface_backend,
!                       NULL, NULL, 1, 1, NULL, 0);
! 
    surface->base.hint_mask |= GLITZ_HINT_PROGRAMMATIC_MASK;
!   
!   surface->base.texture.target = GLITZ_GL_TEXTURE_2D;
!   surface->base.texture.format = GLITZ_GL_RGBA;
!   surface->base.texture.filter = surface->base.filter;
!   surface->base.texture.texcoord_width =
!     surface->base.texture.texcoord_height = 1.0;
!   surface->base.texture.repeatable = surface->base.texture.repeat = 1;
    surface->transform = identity;
    
***************
*** 147,154 ****
      (glitz_programmatic_surface_t *) abstract_surface;
    
!   surface->texture.texcoord_width = surface->base.width =
!     surface->texture.width = width;
!   surface->texture.texcoord_height = surface->base.height =
!     surface->texture.height = height;
  }
  
--- 148,155 ----
      (glitz_programmatic_surface_t *) abstract_surface;
    
!   surface->base.texture.texcoord_width = surface->base.width =
!     surface->base.texture.width = width;
!   surface->base.texture.texcoord_height = surface->base.height =
!     surface->base.texture.height = height;
  }
  

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_surface.c	30 Apr 2004 02:26:02 -0000	1.5
--- b/glitz_surface.c	6 May 2004 14:55:03 -0000	1.6
***************
*** 37,41 ****
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     const glitz_surface_backend_t *backend)
  {
    surface->backend = backend;
--- 37,47 ----
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     const glitz_surface_backend_t *backend,
!                     glitz_gl_proc_address_list_t *gl,
!                     glitz_format_t *format,
!                     int width,
!                     int height,
!                     glitz_programs_t *programs,
!                     unsigned long texture_mask)
  {
    surface->backend = backend;
***************
*** 43,51 ****
    surface->filter = GLITZ_FILTER_NEAREST;
    surface->polyedge = GLITZ_POLYEDGE_SMOOTH;
  }
  
  void
! glitz_surface_deinit (glitz_surface_t *surface)
  {
    if (surface->transforms)
      free (surface->transforms);
--- 49,72 ----
    surface->filter = GLITZ_FILTER_NEAREST;
    surface->polyedge = GLITZ_POLYEDGE_SMOOTH;
+ 
+   surface->programs = programs;
+   surface->format = format;
+   surface->width = width;
+   surface->height = height;
+   surface->gl = gl;
+ 
+   if (surface->gl)
+     glitz_texture_init (gl, &surface->texture,
+                         width, height,
+                         glitz_get_gl_format_from_bpp (format->bpp),
+                         texture_mask);
  }
  
  void
! glitz_surface_fini (glitz_surface_t *surface)
  {
+   if (surface->gl)
+     glitz_texture_fini (surface->gl, &surface->texture);
+   
    if (surface->transforms)
      free (surface->transforms);
***************
*** 569,572 ****
--- 590,599 ----
  
      texture = glitz_surface_get_texture (surface);
+ 
+     /* Texture has not been allocated, hence pixel data of this surface
+        is undefined. */
+     if (!texture)
+       return;
+     
      glitz_texture_bind (surface->gl, texture);
  
***************
*** 700,712 ****
        _glitz_set_raster_pos (surface->gl, x, surface->height - y);
      }
!     
      surface->gl->draw_pixels (width, height, format, type, pixels);
  
      glitz_surface_dirty (surface, &bounds);
    } else {
!     glitz_texture_t *texture;
! 
!     texture = glitz_surface_get_texture (surface);
!     glitz_texture_bind (surface->gl, texture);
      
      surface->gl->pixel_store_i (GLITZ_GL_PACK_ROW_LENGTH, 0);
--- 727,736 ----
        _glitz_set_raster_pos (surface->gl, x, surface->height - y);
      }
! 
      surface->gl->draw_pixels (width, height, format, type, pixels);
  
      glitz_surface_dirty (surface, &bounds);
    } else {
!     glitz_texture_bind (surface->gl, &surface->texture);
      
      surface->gl->pixel_store_i (GLITZ_GL_PACK_ROW_LENGTH, 0);
***************
*** 714,718 ****
      surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_PIXELS, 0);
  
!     surface->gl->tex_sub_image_2d (texture->target, 0,
                                     x, surface->height - y - height,
                                     width, height,
--- 738,742 ----
      surface->gl->pixel_store_i (GLITZ_GL_PACK_SKIP_PIXELS, 0);
  
!     surface->gl->tex_sub_image_2d (surface->texture.target, 0,
                                     x, surface->height - y - height,
                                     width, height,
***************
*** 721,725 ****
      surface->gl->flush ();
  
!     glitz_texture_unbind (surface->gl, texture);
    }
  
--- 745,749 ----
      surface->gl->flush ();
  
!     glitz_texture_unbind (surface->gl, &surface->texture);
    }
  

Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_texture.c	28 Apr 2004 08:59:38 -0000	1.2
--- b/glitz_texture.c	6 May 2004 14:55:03 -0000	1.3
***************
*** 33,37 ****
  
  static void
! _glitz_texture_find_best_target (unsigned int width, unsigned int height,
                                   long int target_mask,
                                   unsigned int *target)
--- 33,38 ----
  
  static void
! _glitz_texture_find_best_target (unsigned int width,
!                                  unsigned int height,
                                   long int target_mask,
                                   unsigned int *target)
***************
*** 47,63 ****
  }
  
! glitz_texture_t *
! glitz_texture_generate (glitz_gl_proc_address_list_t *gl,
!                         unsigned int width,
!                         unsigned int height,
!                         unsigned int texture_format,
!                         long int target_mask)
  {
-   glitz_texture_t *texture;
- 
-   texture = (glitz_texture_t *) malloc (sizeof (glitz_texture_t));
-   if (texture == NULL)
-     return NULL;
- 
    texture->filter = -1;
    texture->repeat = -1;
--- 48,59 ----
  }
  
! void
! glitz_texture_init (glitz_gl_proc_address_list_t *gl,
!                     glitz_texture_t *texture,
!                     unsigned int width,
!                     unsigned int height,
!                     unsigned int texture_format,
!                     unsigned long target_mask)
  {
    texture->filter = -1;
    texture->repeat = -1;
***************
*** 66,69 ****
--- 62,66 ----
    texture->format = texture_format;
    texture->allocated = 0;
+   texture->name = 0;
  
    switch (texture->format) {
***************
*** 87,92 ****
      texture->target = GLITZ_GL_TEXTURE_2D;
    
-   gl->gen_textures (1, &texture->name);
-   
    if (texture->target == GLITZ_GL_TEXTURE_2D &&
        texture->width == width && texture->height == height) {
--- 84,87 ----
***************
*** 103,116 ****
      }
    }
-   
-   return texture;
  }
  
! void
! glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
!                         glitz_texture_t *texture)
  {
!   if (texture->allocated)
!     return;
  
    glitz_texture_bind (gl, texture);
--- 98,111 ----
      }
    }
  }
  
! static void
! _glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
!                          glitz_texture_t *texture)
  {
!   if (!texture->name)
!     gl->gen_textures (1, &texture->name);
! 
!   texture->allocated = 1;
  
    glitz_texture_bind (gl, texture);
***************
*** 122,135 ****
  
    glitz_texture_unbind (gl, texture);
- 
-   texture->allocated = 1;
  }
  
  void 
! glitz_texture_destroy (glitz_gl_proc_address_list_t *gl,
!                        glitz_texture_t *texture)
! { 
!   gl->delete_textures (1, &texture->name);
!   free (texture);
  }
  
--- 117,128 ----
  
    glitz_texture_unbind (gl, texture);
  }
  
  void 
! glitz_texture_fini (glitz_gl_proc_address_list_t *gl,
!                     glitz_texture_t *texture)
! {
!   if (texture->name)
!     gl->delete_textures (1, &texture->name);
  }
  
***************
*** 141,144 ****
--- 134,140 ----
    if (!texture->target)
      return;
+ 
+   if (!texture->allocated)
+     _glitz_texture_allocate (gl, texture);
      
    if (texture->filter != filter) {
***************
*** 171,174 ****
--- 167,173 ----
    if (!texture->target)
      return;
+ 
+   if (!texture->allocated)
+     _glitz_texture_allocate (gl, texture);
    
    if (texture->repeat != repeat) {
***************
*** 191,196 ****
  glitz_texture_bind (glitz_gl_proc_address_list_t *gl,
                      glitz_texture_t *texture)
! {
!   
    gl->disable (GLITZ_GL_TEXTURE_RECTANGLE_EXT);
    gl->disable (GLITZ_GL_TEXTURE_2D);
--- 190,194 ----
  glitz_texture_bind (glitz_gl_proc_address_list_t *gl,
                      glitz_texture_t *texture)
! {  
    gl->disable (GLITZ_GL_TEXTURE_RECTANGLE_EXT);
    gl->disable (GLITZ_GL_TEXTURE_2D);
***************
*** 198,201 ****
--- 196,202 ----
    if (!texture->target)
      return;
+ 
+   if (!texture->allocated)
+     _glitz_texture_allocate (gl, texture);
    
    gl->enable (texture->target);
***************
*** 220,223 ****
--- 221,227 ----
    glitz_texture_bind (surface->gl, texture);
  
+   if (!texture->allocated)
+     _glitz_texture_allocate (surface->gl, texture);
+ 
    if (region->x1 < 0) region->x1 = 0;
    if (region->y1 < 0) region->y1 = 0;

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/glitzint.h	30 Apr 2004 02:26:02 -0000	1.6
--- b/glitzint.h	6 May 2004 14:55:03 -0000	1.7
***************
*** 143,147 ****
    glitz_gl_program_local_param_4d_arb_t program_local_param_4d_arb;
    glitz_gl_get_program_iv_arb_t get_program_iv_arb;
!   glitz_bool_t supported;
  } glitz_gl_proc_address_list_t;
  
--- 143,147 ----
    glitz_gl_program_local_param_4d_arb_t program_local_param_4d_arb;
    glitz_gl_get_program_iv_arb_t get_program_iv_arb;
!   glitz_bool_t need_lookup;
  } glitz_gl_proc_address_list_t;
  
***************
*** 297,301 ****
  
    glitz_format_t *format;
!   glitz_texture_t *texture;
    unsigned long status_mask;
    unsigned long feature_mask;
--- 297,301 ----
  
    glitz_format_t *format;
!   glitz_texture_t texture;
    unsigned long status_mask;
    unsigned long feature_mask;
***************
*** 333,337 ****
    glitz_surface_t base;
    
-   glitz_texture_t texture;
    glitz_matrix_t transform;
    
--- 333,336 ----
***************
*** 441,458 ****
  glitz_uint_to_power_of_two (unsigned int *value);
  
- glitz_texture_t *
- glitz_texture_generate (glitz_gl_proc_address_list_t *gl,
-                         unsigned int width,
-                         unsigned int height,
-                         unsigned int texture_format,
-                         long int target_mask);
- 
  void
! glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
!                         glitz_texture_t *texture);
  
  void
! glitz_texture_destroy (glitz_gl_proc_address_list_t *gl,
!                        glitz_texture_t *texture);
  
  extern void __internal_linkage
--- 440,454 ----
  glitz_uint_to_power_of_two (unsigned int *value);
  
  void
! glitz_texture_init (glitz_gl_proc_address_list_t *gl,
!                     glitz_texture_t *texture,
!                     unsigned int width,
!                     unsigned int height,
!                     unsigned int texture_format,
!                     unsigned long target_mask);
  
  void
! glitz_texture_fini (glitz_gl_proc_address_list_t *gl,
!                     glitz_texture_t *texture);
  
  extern void __internal_linkage
***************
*** 481,485 ****
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     const glitz_surface_backend_t *backend);
  
  extern void __internal_linkage
--- 477,490 ----
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     const glitz_surface_backend_t *backend,
!                     glitz_gl_proc_address_list_t *gl,
!                     glitz_format_t *format,
!                     int width,
!                     int height,
!                     glitz_programs_t *programs,
!                     unsigned long texture_mask);
! 
! void
! glitz_surface_fini (glitz_surface_t *surface);
  
  extern void __internal_linkage
***************
*** 489,495 ****
  glitz_surface_pop_transform (glitz_surface_t *surface);
  
- void
- glitz_surface_deinit (glitz_surface_t *surface);
- 
  extern glitz_texture_t *__internal_linkage
  glitz_surface_get_texture (glitz_surface_t *surface);
--- 494,497 ----





More information about the cairo-commit mailing list