[cairo-commit] libglxc/src glxc.c,1.1.1.1,1.2 glxc.h,1.1.1.1,1.2 glxc_extension.c,1.1.1.1,1.2 glxc_rect.c,1.1.1.1,1.2 glxc_surface.c,1.1.1.1,1.2 glxc_texture.c,1.1.1.1,1.2 glxc_trap.c,1.1.1.1,1.2 glxc_tri.c,1.1.1.1,1.2 glxcint.h,1.1.1.1,1.2

David Reveman commit at pdx.freedesktop.org
Mon Nov 24 03:06:16 PST 2003


Committed by: c99drn

Update of /cvs/cairo/libglxc/src
In directory pdx:/tmp/cvs-serv22155/src

Modified Files:
	glxc.c glxc.h glxc_extension.c glxc_rect.c glxc_surface.c 
	glxc_texture.c glxc_trap.c glxc_tri.c glxcint.h 
Log Message:
added GL_NV_texture_rectangle support

Index: glxc.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc.c	22 Nov 2003 00:06:44 -0000	1.1.1.1
--- glxc.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 97,100 ****
--- 97,101 ----
    glxc_surface_t *intermediate = NULL, *mask_intermediate = NULL;
    GLuint texture = 0;
+   GLenum texture_target;
    double width_factor, height_factor;
    double tx1, tx2, ty1, ty2;
***************
*** 213,217 ****
    
    if (src->type == GLXC_SURFACE_TEXTURE_TYPE) {
!     glBindTexture (GL_TEXTURE_2D, src->id.texture);
      width_factor = (double) src->width / (double) src->real_width;
      height_factor = (double) src->height / (double) src->real_height;
--- 214,219 ----
    
    if (src->type == GLXC_SURFACE_TEXTURE_TYPE) {
!     texture_target = src->texture_target;
!     glBindTexture (texture_target, src->id.texture);
      width_factor = (double) src->width / (double) src->real_width;
      height_factor = (double) src->height / (double) src->real_height;
***************
*** 219,225 ****
      int texture_width, texture_height;
  
      texture = glxc_texture_create (src->width, src->height,
                                     &texture_width,
!                                    &texture_height);
  
      width_factor = (double) width / (double) texture_width;
--- 221,233 ----
      int texture_width, texture_height;
  
+     if (src->screen_info->feature_mask & GLXC_FEATURE_RECTANGULAR_TEXTURE_MASK)
+       texture_target = GL_TEXTURE_RECTANGLE_NV;
+     else
+       texture_target = GL_TEXTURE_2D;
+     
      texture = glxc_texture_create (src->width, src->height,
                                     &texture_width,
!                                    &texture_height,
!                                    &texture_target);
  
      width_factor = (double) width / (double) texture_width;
***************
*** 228,233 ****
      glxc_surface_push_current (src);
  
!     glBindTexture (GL_TEXTURE_2D, texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           0, 0,
                           0, 0,
--- 236,241 ----
      glxc_surface_push_current (src);
  
!     glBindTexture (texture_target, texture);
!     glCopyTexSubImage2D (texture_target, 0,
                           0, 0,
                           0, 0,
***************
*** 236,259 ****
      glxc_surface_pop_current (src);
      
!     glBindTexture (GL_TEXTURE_2D, texture);
    }  
  
!   glEnable (GL_TEXTURE_2D);
  
    switch (src->filter) {
    case GLXC_FILTER_FAST:
    case GLXC_FILTER_NEAREST:
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      break;
    case GLXC_FILTER_GOOD:
    case GLXC_FILTER_BEST:
    case GLXC_FILTER_BILINEAR:
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      break;
    }
  
!   if (src->repeat) {
      double repeat_factor_x, repeat_factor_y; 
      int tx1i, ty1i;
--- 244,267 ----
      glxc_surface_pop_current (src);
      
!     glBindTexture (texture_target, texture);
    }  
  
!   glEnable (texture_target);
  
    switch (src->filter) {
    case GLXC_FILTER_FAST:
    case GLXC_FILTER_NEAREST:
!     glTexParameteri (texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
!     glTexParameteri (texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
      break;
    case GLXC_FILTER_GOOD:
    case GLXC_FILTER_BEST:
    case GLXC_FILTER_BILINEAR:
!     glTexParameteri (texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
!     glTexParameteri (texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      break;
    }
  
!   if (src->repeat && texture_target == GL_TEXTURE_2D) {
      double repeat_factor_x, repeat_factor_y; 
      int tx1i, ty1i;
***************
*** 263,268 ****
         power of two sized. 
      */
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
      
      vx1 = x_dst;
--- 271,276 ----
         power of two sized. 
      */
!     glTexParameteri (texture_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
!     glTexParameteri (texture_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
      
      vx1 = x_dst;
***************
*** 286,291 ****
      int tx1i, tx2i, ty1i, ty2i;
   
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
!     glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
  
      /* Calulate texture and vertex coordinates. Y is flipped in
--- 294,299 ----
      int tx1i, tx2i, ty1i, ty2i;
   
!     glTexParameteri (texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP);
!     glTexParameteri (texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP);
  
      /* Calulate texture and vertex coordinates. Y is flipped in
***************
*** 346,350 ****
    glEnd ();
  
!   glDisable (GL_TEXTURE_2D);
  
    if (src->transform)
--- 354,358 ----
    glEnd ();
  
!   glDisable (texture_target);
  
    if (src->transform)
***************
*** 355,360 ****
    
    if (intermediate) { 
!     glBindTexture (GL_TEXTURE_2D, dst->id.texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
--- 363,368 ----
    
    if (intermediate) { 
!     glBindTexture (texture_target, dst->id.texture);
!     glCopyTexSubImage2D (texture_target, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),

Index: glxc.h
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc.h	22 Nov 2003 00:06:43 -0000	1.1.1.1
--- glxc.h	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 146,152 ****
                   int screen);
    
! #define GLXC_FEATURE_FBCONFIG_MASK (1L << 0)
! #define GLXC_FEATURE_PBUFFER_MASK  (1L << 1)
! 
  extern long int __external_linkage
  glxc_features (Display *display,
--- 146,153 ----
                   int screen);
    
! #define GLXC_FEATURE_FBCONFIG_MASK             (1L << 0)
! #define GLXC_FEATURE_PBUFFER_MASK              (1L << 1)
! #define GLXC_FEATURE_RECTANGULAR_TEXTURE_MASK  (1L << 2)
!   
  extern long int __external_linkage
  glxc_features (Display *display,

Index: glxc_extension.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_extension.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_extension.c	22 Nov 2003 00:06:46 -0000	1.1.1.1
--- glxc_extension.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 45,48 ****
--- 45,49 ----
    { NULL, 0 }
  }, gl_extensions[] = {
+   { "GL_NV_texture_rectangle", GLXC_FEATURE_RECTANGULAR_TEXTURE_MASK },
    { NULL, 0 }
  };

Index: glxc_rect.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_rect.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_rect.c	22 Nov 2003 00:06:41 -0000	1.1.1.1
--- glxc_rect.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 149,154 ****
    
    if (intermediate) {
!     glBindTexture (GL_TEXTURE_2D, dst->id.texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
--- 149,154 ----
    
    if (intermediate) {
!     glBindTexture (dst->texture_target, dst->id.texture);
!     glCopyTexSubImage2D (dst->texture_target, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
***************
*** 239,244 ****
    
    if (intermediate) { 
!     glBindTexture (GL_TEXTURE_2D, dst->id.texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
--- 239,244 ----
    
    if (intermediate) { 
!     glBindTexture (dst->texture_target, dst->id.texture);
!     glCopyTexSubImage2D (dst->texture_target, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),

Index: glxc_surface.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_surface.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_surface.c	22 Nov 2003 00:06:47 -0000	1.1.1.1
--- glxc_surface.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 82,85 ****
--- 82,90 ----
    surface->context = context;
    surface->polyedge = GLXC_POLYEDGE_SHARP;
+   if (surface->screen_info->feature_mask &
+       GLXC_FEATURE_RECTANGULAR_TEXTURE_MASK)
+     surface->texture_target = GL_TEXTURE_RECTANGLE_NV;
+   else
+     surface->texture_target = GL_TEXTURE_2D;
    
    glxc_surface_push_current (surface);
***************
*** 87,91 ****
    surface->id.texture = glxc_texture_create (surface->width, surface->height,
                                               &surface->real_width,
!                                              &surface->real_height);
    
    glxc_surface_pop_current (surface);
--- 92,97 ----
    surface->id.texture = glxc_texture_create (surface->width, surface->height,
                                               &surface->real_width,
!                                              &surface->real_height,
!                                              &surface->texture_target);
    
    glxc_surface_pop_current (surface);
***************
*** 619,626 ****
      dst = surface;
    
!   glEnable (GL_TEXTURE_2D);
!   glBindTexture (GL_TEXTURE_2D, dst->id.texture);
    
!   glTexSubImage2D (GL_TEXTURE_2D,
                     0,
                     x, TL2BL (y) - height,
--- 625,632 ----
      dst = surface;
    
!   glEnable (dst->texture_target);
!   glBindTexture (dst->texture_target, dst->id.texture);
    
!   glTexSubImage2D (dst->texture_target,
                     0,
                     x, TL2BL (y) - height,

Index: glxc_texture.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_texture.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_texture.c	22 Nov 2003 00:06:40 -0000	1.1.1.1
--- glxc_texture.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 50,78 ****
                                int height,
                                int *real_width,
!                               int *real_height)
  {
    int test_width = width;
    int test_height = height;
  
    while (test_width <= TEXTURE_MAX_SIZE) {
      GLint w_ok, h_ok;
  
!     glTexImage2D (GL_PROXY_TEXTURE_2D, 0, GL_RGBA4,
                    test_width, test_height,
                    0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
        
      w_ok = h_ok = 0;
!     glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0,
!                               GL_TEXTURE_WIDTH, &w_ok);
!     glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0,
!                               GL_TEXTURE_HEIGHT, &h_ok);
      
      if (w_ok != test_width || h_ok != test_height) {
!       if (test_width < test_height)
!         test_width++;
!       else
!         test_height++;
!       _glxc_texture_next_size (&test_width, &test_height);
      } else {
        *real_width = test_width;
        *real_height = test_height;
--- 50,85 ----
                                int height,
                                int *real_width,
!                               int *real_height,
!                               GLenum *target)
  {
    int test_width = width;
    int test_height = height;
+   GLenum proxy_target = GL_PROXY_TEXTURE_2D;
  
    while (test_width <= TEXTURE_MAX_SIZE) {
      GLint w_ok, h_ok;
  
!     glTexImage2D (proxy_target, 0, GL_RGBA4,
                    test_width, test_height,
                    0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
        
      w_ok = h_ok = 0;
!     glGetTexLevelParameteriv (proxy_target, 0, GL_TEXTURE_WIDTH, &w_ok);
!     glGetTexLevelParameteriv (proxy_target, 0, GL_TEXTURE_HEIGHT, &h_ok);
      
      if (w_ok != test_width || h_ok != test_height) {
!       if (*target == GL_TEXTURE_RECTANGLE_NV) {
!         proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV;
!       } else {
!         if (test_width < test_height)
!           test_width++;
!         else
!           test_height++;
!         _glxc_texture_next_size (&test_width, &test_height);
!       }
      } else {
+       if (proxy_target == GL_PROXY_TEXTURE_2D)
+         *target = GL_TEXTURE_2D;
+ 
        *real_width = test_width;
        *real_height = test_height;
***************
*** 89,103 ****
                       int height,
                       int *texture_width,
!                      int *texture_height)
  {
    GLuint texture;
    
    if (_glxc_texture_find_best_size (width, height,
!                                     texture_width, texture_height)) {
!       
      glGenTextures (1, &texture);
!     glBindTexture (GL_TEXTURE_2D, texture);
      
!     glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA4,
                    *texture_width, *texture_height,
                    0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
--- 96,112 ----
                       int height,
                       int *texture_width,
!                      int *texture_height,
!                      GLenum *target)
  {
    GLuint texture;
    
    if (_glxc_texture_find_best_size (width, height,
!                                     texture_width, texture_height,
!                                     target)) {
!     
      glGenTextures (1, &texture);
!     glBindTexture (*target, texture);
      
!     glTexImage2D (*target, 0, GL_RGBA4,
                    *texture_width, *texture_height,
                    0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

Index: glxc_trap.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_trap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_trap.c	22 Nov 2003 00:06:49 -0000	1.1.1.1
--- glxc_trap.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 362,367 ****
  
    if (intermediate) { 
!     glBindTexture (GL_TEXTURE_2D, dst->id.texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
--- 362,367 ----
  
    if (intermediate) { 
!     glBindTexture (dst->texture_target, dst->id.texture);
!     glCopyTexSubImage2D (dst->texture_target, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),

Index: glxc_tri.c
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxc_tri.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxc_tri.c	22 Nov 2003 00:06:45 -0000	1.1.1.1
--- glxc_tri.c	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 514,519 ****
  
    if (intermediate) { 
!     glBindTexture (GL_TEXTURE_2D, dst->id.texture);
!     glCopyTexSubImage2D (GL_TEXTURE_2D, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),
--- 514,519 ----
  
    if (intermediate) { 
!     glBindTexture (dst->texture_target, dst->id.texture);
!     glCopyTexSubImage2D (dst->texture_target, 0,
                           ibounds.x1,
                           dst->real_width - (ibounds.y1 + intermediate->height),

Index: glxcint.h
===================================================================
RCS file: /cvs/cairo/libglxc/src/glxcint.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glxcint.h	22 Nov 2003 00:06:46 -0000	1.1.1.1
--- glxcint.h	24 Nov 2003 11:06:13 -0000	1.2
***************
*** 123,126 ****
--- 123,127 ----
    double *transform;
    Pixmap owned_pixmap;
+   GLenum texture_target;
    union {
      GLuint texture;
***************
*** 192,196 ****
                       int height,
                       int *texture_width,
!                      int *texture_height);
  
  extern void __internal_linkage
--- 193,198 ----
                       int height,
                       int *texture_width,
!                      int *texture_height,
!                      GLenum *texture_target);
  
  extern void __internal_linkage





More information about the cairo-commit mailing list