[cairo-commit] glitz/src glitz.c, 1.22, 1.23 glitz_agl_extension.c, 1.9, 1.10 glitz_agl_info.c, 1.11, 1.12 glitz_agl_surface.c, 1.18, 1.19 glitz_compose.c, 1.4, 1.5 glitz_filter.c, 1.4, 1.5 glitz_format.c, 1.7, 1.8 glitz_gl.h, 1.8, 1.9 glitz_glx_extension.c, 1.12, 1.13 glitz_glx_info.c, 1.17, 1.18 glitz_pixel.c, 1.6, 1.7 glitz_program.c, 1.12, 1.13 glitz_surface.c, 1.20, 1.21 glitz_texture.c, 1.12, 1.13 glitzint.h, 1.25, 1.26

David Reveman commit at pdx.freedesktop.org
Thu Sep 9 02:50:28 PDT 2004


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory gabe:/tmp/cvs-serv17635/src

Modified Files:
	glitz.c glitz_agl_extension.c glitz_agl_info.c 
	glitz_agl_surface.c glitz_compose.c glitz_filter.c 
	glitz_format.c glitz_gl.h glitz_glx_extension.c 
	glitz_glx_info.c glitz_pixel.c glitz_program.c glitz_surface.c 
	glitz_texture.c glitzint.h 
Log Message:
Added transformation support for hardware without GL_ARB_texture_clamp_to_border and improved error checking when compiling fragment programs

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** glitz.c	6 Sep 2004 22:23:29 -0000	1.22
--- glitz.c	9 Sep 2004 09:50:26 -0000	1.23
***************
*** 186,191 ****
        textures[0].transform = 1;
        gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_TEXTURE_COORDS (mask)?
!                          mask->transform->t: mask->transform->m);
        gl->matrix_mode (GLITZ_GL_MODELVIEW);
        
--- 186,191 ----
        textures[0].transform = 1;
        gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_EYE_COORDS (mask)?
!                          mask->transform->m: mask->transform->t);
        gl->matrix_mode (GLITZ_GL_MODELVIEW);
        
***************
*** 231,236 ****
        textures[texture_nr].transform = 1;
        gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_TEXTURE_COORDS (src)?
!                          src->transform->t: src->transform->m);
        gl->matrix_mode (GLITZ_GL_MODELVIEW);
        
--- 231,236 ----
        textures[texture_nr].transform = 1;
        gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_EYE_COORDS (src)?
!                          src->transform->m: src->transform->t);
        gl->matrix_mode (GLITZ_GL_MODELVIEW);
        
***************
*** 468,472 ****
          glitz_texture_bind (gl, texture);
  
!         glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, ~0); 
  
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
--- 468,472 ----
          glitz_texture_bind (gl, texture);
  
!         glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, 0); 
  
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_agl_extension.c	7 Sep 2004 14:28:21 -0000	1.9
--- glitz_agl_extension.c	9 Sep 2004 09:50:26 -0000	1.10
***************
*** 41,45 ****
      GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
    { 0.0, "GL_NV_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { 0.0, "GL_ARB_texture_non_power_of_two",
      GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { 1.4, "GL_ARB_texture_mirrored_repeat",
--- 41,45 ----
      GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
    { 0.0, "GL_NV_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { 2.0, "GL_ARB_texture_non_power_of_two",
      GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { 1.4, "GL_ARB_texture_mirrored_repeat",
***************
*** 49,53 ****
    { 1.3, "GL_ARB_texture_env_combine",
      GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { 1.3, "GL_EXT_texture_env_combine",
      GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
    { 1.3, "GL_ARB_texture_env_dot3", GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK },
--- 49,53 ----
    { 1.3, "GL_ARB_texture_env_combine",
      GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { 0.0, "GL_EXT_texture_env_combine",
      GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
    { 1.3, "GL_ARB_texture_env_dot3", GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK },
***************
*** 91,98 ****
    thread_info->agl_feature_mask = 0;
    
!   thread_info->agl_feature_mask |= _glitz_agl_extension_query_gl ();
  
    thread_info->feature_mask = 0;
-   thread_info->texture_mask = GLITZ_TEXTURE_TARGET_2D_MASK;
  
    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {
--- 91,97 ----
    thread_info->agl_feature_mask = 0;
    
!   thread_info->agl_feature_mask |= _glitz_agl_extension_query_gl (gl_version);
  
    thread_info->feature_mask = 0;
  
    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz_agl_info.c	7 Sep 2004 14:28:21 -0000	1.11
--- glitz_agl_info.c	9 Sep 2004 09:50:26 -0000	1.12
***************
*** 37,40 ****
--- 37,41 ----
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
+   (glitz_gl_get_error_t) glGetError,
    (glitz_gl_enable_client_state_t) glEnableClientState,
    (glitz_gl_disable_client_state_t) glDisableClientState,

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** glitz_agl_surface.c	6 Sep 2004 22:52:03 -0000	1.18
--- glitz_agl_surface.c	9 Sep 2004 09:50:26 -0000	1.19
***************
*** 81,85 ****
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (surface->base.flags & GLITZ_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
--- 81,85 ----
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (surface->base.flags & GLITZ_SURFACE_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_compose.c	6 Sep 2004 22:23:29 -0000	1.4
--- glitz_compose.c	9 Sep 2004 09:50:26 -0000	1.5
***************
*** 418,427 ****
      ) \
     : \
!    ((SURFACE_PAD (surface))? \
      (TEXTURE_PADABLE (&(surface)->texture)) \
-     : \
-     (SURFACE_SIMPLE_TRANSFORM (surface) || \
-      ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
-     ) \
     ) \
    )
--- 418,423 ----
      ) \
     : \
!    ((!SURFACE_PAD (surface)) || \
      (TEXTURE_PADABLE (&(surface)->texture)) \
     ) \
    )

Index: glitz_filter.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_filter.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_filter.c	6 Sep 2004 22:23:29 -0000	1.4
--- glitz_filter.c	9 Sep 2004 09:50:26 -0000	1.5
***************
*** 282,289 ****
        glitz_clamp_value (&vecs[i].v[1], 0.5f, surface->height - 0.5f);
  
        vecs[i].v[0] *= surface->texture.texcoord_width_unit;
        vecs[i].v[1] *= surface->texture.texcoord_height_unit;
        
-       vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
        vecs[i].v[3] = i;
      }
--- 282,291 ----
        glitz_clamp_value (&vecs[i].v[1], 0.5f, surface->height - 0.5f);
  
+       vecs[i].v[0] += surface->texture.box.x1;
+       vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
+ 
        vecs[i].v[0] *= surface->texture.texcoord_width_unit;
        vecs[i].v[1] *= surface->texture.texcoord_height_unit;
        
        vecs[i].v[3] = i;
      }
***************
*** 350,354 ****
        else
          surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REPEAT;
!     } else if (SURFACE_PAD (surface)) {
        surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_NEAREST;
      } else
--- 352,356 ----
        else
          surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REPEAT;
!     } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
        surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_NEAREST;
      } else
***************
*** 361,365 ****
        else
          surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REPEAT;
!     } else if (SURFACE_PAD (surface)) {
        surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_NEAREST;
      } else
--- 363,367 ----
        else
          surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REPEAT;
!     } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
        surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_NEAREST;
      } else

Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_format.c	9 Aug 2004 22:57:35 -0000	1.7
--- glitz_format.c	9 Sep 2004 09:50:26 -0000	1.8
***************
*** 77,89 ****
                                        void *ptr)
  {
-   glitz_gl_uint_t name;
    glitz_gl_int_t value;
    int i, n_texture_formats =
      sizeof (_texture_formats) / sizeof (glitz_format_t);
  
-   gl->gen_textures (1, &name);
-   gl->enable (GLITZ_GL_PROXY_TEXTURE_2D);
-   gl->bind_texture (GLITZ_GL_PROXY_TEXTURE_2D, name);
-   
    for (i = 0; i < n_texture_formats; i++) {
      gl->tex_image_2d (GLITZ_GL_PROXY_TEXTURE_2D, 0,
--- 77,84 ----
***************
*** 112,119 ****
      call_back (&_texture_formats[i], ptr);
    }
- 
-   gl->bind_texture (GLITZ_GL_PROXY_TEXTURE_2D, 0);
-   gl->disable (GLITZ_GL_PROXY_TEXTURE_2D);
-   gl->delete_textures (1, &name);
  }
  
--- 107,110 ----

Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_gl.h	3 Sep 2004 14:27:58 -0000	1.8
--- glitz_gl.h	9 Sep 2004 09:50:26 -0000	1.9
***************
*** 51,54 ****
--- 51,57 ----
  #define GLITZ_GL_TRUE  0x1
  
+ #define GLITZ_GL_NO_ERROR          0x0
+ #define GLITZ_GL_INVALID_OPERATION 0x0502
+ 
  #define GLITZ_GL_UNSIGNED_BYTE               0x1401
  #define GLITZ_GL_FLOAT                       0x1406
***************
*** 234,243 ****
  #define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
  
! #define GLITZ_GL_FRAGMENT_PROGRAM            0x8804
! #define GLITZ_GL_PROGRAM_STRING              0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII        0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION      0x864B
! #define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS 0x88B6
! #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
  
  #define GLITZ_GL_ARRAY_BUFFER        0x8892
--- 237,247 ----
  #define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
  
! #define GLITZ_GL_FRAGMENT_PROGRAM             0x8804
! #define GLITZ_GL_PROGRAM_STRING               0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII         0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION       0x864B
! #define GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS 0x88B4
! #define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS  0x88B6
! #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS  0x88A2
  
  #define GLITZ_GL_ARRAY_BUFFER        0x8892
***************
*** 264,267 ****
--- 268,273 ----
  typedef glitz_gl_void_t (* glitz_gl_disable_t)
       (glitz_gl_enum_t cap);
+ typedef glitz_gl_enum_t (* glitz_gl_get_error_t)
+      (glitz_gl_void_t);
  typedef glitz_gl_void_t (* glitz_gl_enable_client_state_t)
       (glitz_gl_enum_t cap);
***************
*** 421,425 ****
       (glitz_gl_enum_t, glitz_gl_uint_t, const glitz_gl_float_t *);
  typedef glitz_gl_void_t (* glitz_gl_get_program_iv_t)
!      (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_uint_t *);
  typedef glitz_gl_void_t (* glitz_gl_gen_buffers_t)
       (glitz_gl_sizei_t, glitz_gl_uint_t *buffers);
--- 427,431 ----
       (glitz_gl_enum_t, glitz_gl_uint_t, const glitz_gl_float_t *);
  typedef glitz_gl_void_t (* glitz_gl_get_program_iv_t)
!      (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_int_t *);
  typedef glitz_gl_void_t (* glitz_gl_gen_buffers_t)
       (glitz_gl_sizei_t, glitz_gl_uint_t *buffers);

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_glx_extension.c	7 Sep 2004 14:28:21 -0000	1.12
--- glitz_glx_extension.c	9 Sep 2004 09:50:26 -0000	1.13
***************
*** 41,45 ****
      GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
    { 0.0, "GL_NV_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { 0.0, "GL_ARB_texture_non_power_of_two",
      GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { 1.4, "GL_ARB_texture_mirrored_repeat",
--- 41,45 ----
      GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
    { 0.0, "GL_NV_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { 2.0, "GL_ARB_texture_non_power_of_two",
      GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { 1.4, "GL_ARB_texture_mirrored_repeat",
***************
*** 49,53 ****
    { 1.3, "GL_ARB_texture_env_combine",
      GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { 1.3, "GL_EXT_texture_env_combine",
      GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
    { 1.3, "GL_ARB_texture_env_dot3", GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK },
--- 49,53 ----
    { 1.3, "GL_ARB_texture_env_combine",
      GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { 0.0, "GL_EXT_texture_env_combine",
      GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
    { 1.3, "GL_ARB_texture_env_dot3", GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK },

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** glitz_glx_info.c	7 Sep 2004 14:28:21 -0000	1.17
--- glitz_glx_info.c	9 Sep 2004 09:50:26 -0000	1.18
***************
*** 38,41 ****
--- 38,42 ----
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
+   (glitz_gl_get_error_t) glGetError,
    (glitz_gl_enable_client_state_t) glEnableClientState,
    (glitz_gl_disable_client_state_t) glDisableClientState,

Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_pixel.c	6 Sep 2004 22:23:29 -0000	1.6
--- glitz_pixel.c	9 Sep 2004 09:50:26 -0000	1.7
***************
*** 528,532 ****
  
    if (to_drawable) {
!     glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, ~0); 
  
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
--- 528,532 ----
  
    if (to_drawable) {
!     glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, 0); 
  
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_program.c	3 Sep 2004 14:27:58 -0000	1.12
--- glitz_program.c	9 Sep 2004 09:50:26 -0000	1.13
***************
*** 104,108 ****
   */
  static const char *_convolution_header[] = {
-   "!!ARBfp1.0",
    "PARAM p[%d] = { program.local[0..%d] };",
    "ATTRIB pos = fragment.texcoord[%s];",
--- 104,107 ----
***************
*** 134,138 ****
   */
  static const char *_gradient_header[] = {
-   "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
    "PARAM stops[%d] = { program.local[1..%d] };",
--- 133,136 ----
***************
*** 224,232 ****
  static glitz_gl_int_t
  _glitz_compile_arb_fragment_program (glitz_gl_proc_address_list_t *gl,
!                                      char *program_string)
  {
    glitz_gl_int_t error, pid = -1;
!   glitz_gl_uint_t value, program;
  
    gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
  
--- 222,234 ----
  static glitz_gl_int_t
  _glitz_compile_arb_fragment_program (glitz_gl_proc_address_list_t *gl,
!                                      char *program_string,
!                                      int n_parameters)
  {
    glitz_gl_int_t error, pid = -1;
!   glitz_gl_uint_t program;
  
+   /* clear error flags */
+   while (gl->get_error () != GLITZ_GL_NO_ERROR);
+   
    gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
  
***************
*** 237,261 ****
                        strlen (program_string),
                        program_string);
  
!   gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!   if (error == -1) {
!     gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                         GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
!                         &value);
!     if (value > 0) {
        gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                           GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS,
                            &value);
!       if (value == GLITZ_GL_TRUE)
!         pid = program;
      }
    }
    
    if (pid == -1) {
      gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
      gl->delete_programs (1, &program);
    }
- 
-   gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
    
    return pid;
--- 239,267 ----
                        strlen (program_string),
                        program_string);
+   if (gl->get_error () == GLITZ_GL_NO_ERROR) {
+     gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
  
!     if (error == -1) {
!       glitz_gl_int_t value;
!       
        gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                           GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
                            &value);
!       if (value > 0) {
!         gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                             GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS,
!                             &value);
!         if (value >= n_parameters)
!           pid = program;
!       }
      }
    }
    
+   gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
+   
    if (pid == -1) {
      gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
      gl->delete_programs (1, &program);
    }
    
    return pid;
***************
*** 314,317 ****
--- 320,325 ----
      p = program;
      
+     p += sprintf (p, "!!ARBfp1.0");
+     
      _string_array_to_char_array (buffer, _convolution_header);
      p += sprintf (p, buffer, id, id - 1, tex, expand->declarations);
***************
*** 341,344 ****
--- 349,354 ----
      p = program;
      
+     p += sprintf (p, "!!ARBfp1.0");
+     
      _string_array_to_char_array (buffer, _gradient_header);
      p += sprintf (p, buffer, id, id, tex, expand->declarations);
***************
*** 386,389 ****
--- 396,401 ----
      _string_array_to_char_array (buffer, _gradient_fetch_and_interpolate);
      p += sprintf (p, buffer, tex, expand->texture, tex, expand->texture);
+     
+     id++;
      break;
    default:
***************
*** 397,401 ****
    sprintf (p, "END");
  
!   fp = _glitz_compile_arb_fragment_program (op->gl, program);
    
    free (program);
--- 409,413 ----
    sprintf (p, "END");
  
!   fp = _glitz_compile_arb_fragment_program (op->gl, program, id);
    
    free (program);

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** glitz_surface.c	6 Sep 2004 22:23:29 -0000	1.20
--- glitz_surface.c	9 Sep 2004 09:50:26 -0000	1.21
***************
*** 71,77 ****
    }
  
-   surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
-   surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
- 
    glitz_texture_init (&surface->texture,
                        width, height,
--- 71,74 ----
***************
*** 339,348 ****
      t[15] -= t[7] * height;
  
!     if (t[0] == 1.0 && t[4] == 0.0 &&
!         t[1] == 0.0 && t[5] == 1.0 &&
!         t[3] == 0.0 && t[7] == 0.0 && t[15] == 1.0)
!       surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
!     else
!       surface->flags &= ~GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
    } else {
      if (surface->transform)
--- 336,349 ----
      t[15] -= t[7] * height;
  
!     height = surface->texture.texcoord_height_unit * surface->texture.box.y1;
!     
!     /* translate coordinates into texture. this only makes a difference when
!        GL_ARB_texture_border_clamp is missing as box.x1 and box.y1 are
!        otherwise always zero. hmm, does this break projective
!        transformations? affine transformations should be fine */
!     t[12] += surface->texture.texcoord_width_unit * surface->texture.box.x1;
!     t[13] += surface->texture.texcoord_height_unit * surface->texture.box.y1;
! 
!     surface->flags |= GLITZ_SURFACE_FLAG_TRANSFORM_MASK;
    } else {
      if (surface->transform)
***************
*** 350,354 ****
      
      surface->transform = NULL;
!     surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
    }
  }
--- 351,355 ----
      
      surface->transform = NULL;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_TRANSFORM_MASK;
    }
  }
***************
*** 413,424 ****
        surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
        surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
--- 414,425 ----
        surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_EYE_COORDS_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
        surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_EYE_COORDS_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
***************
*** 426,431 ****
        surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
--- 427,432 ----
        surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_EYE_COORDS_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
***************
*** 433,438 ****
        surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      }
--- 434,439 ----
        surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
        surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_EYE_COORDS_MASK;
        break;
      }

Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_texture.c	6 Sep 2004 22:23:29 -0000	1.12
--- glitz_texture.c	9 Sep 2004 09:50:26 -0000	1.13
***************
*** 218,230 ****
    glitz_vec4_t plane;
  
!   if (flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK) {
!     plane.v[1] = plane.v[2] = 0.0f;
!     plane.v[0] = texture->texcoord_width_unit;
!     plane.v[3] = -(x_src - texture->box.x1) * texture->texcoord_width_unit;
!   } else {
!     plane.v[1] = plane.v[2] = 0.0f;
!     plane.v[0] = 1.0;
      plane.v[3] = -x_src;
!   }   
    
    gl->tex_gen_i (GLITZ_GL_S, GLITZ_GL_TEXTURE_GEN_MODE,
--- 218,234 ----
    glitz_vec4_t plane;
  
!   plane.v[1] = plane.v[2] = 0.0f;
!   
!   if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK) {
!     plane.v[0] = 1.0f;
      plane.v[3] = -x_src;
!   } else {
!     plane.v[0] = texture->texcoord_width_unit;
!     
!     if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
!       plane.v[3] = -(x_src) * texture->texcoord_width_unit;
!     else
!       plane.v[3] = -(x_src - texture->box.x1) * texture->texcoord_width_unit;
!   }  
    
    gl->tex_gen_i (GLITZ_GL_S, GLITZ_GL_TEXTURE_GEN_MODE,
***************
*** 233,244 ****
    gl->enable (GLITZ_GL_TEXTURE_GEN_S);
  
!   if (flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK) {
!     plane.v[0] = 0.0f;
!     plane.v[1] = -texture->texcoord_height_unit;
!     plane.v[3] = (y_src + texture->box.y2) * texture->texcoord_height_unit;
    } else {
!     plane.v[0] = 0.0f;
!     plane.v[1] = 1.0;
!     plane.v[3] = y_src;
    }
    
--- 237,252 ----
    gl->enable (GLITZ_GL_TEXTURE_GEN_S);
  
!   plane.v[0] = 0.0f;
!   if (flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK) {
!     plane.v[1] = 1.0f;
!     plane.v[3] = -y_src;
    } else {
!     plane.v[1] = -texture->texcoord_height_unit;
!     
!     if (flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
!       plane.v[3] = (y_src + texture->box.y2 - texture->box.y1) *
!         texture->texcoord_height_unit;
!     else
!       plane.v[3] = (y_src + texture->box.y2) * texture->texcoord_height_unit;
    }
    

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** glitzint.h	7 Sep 2004 14:28:21 -0000	1.25
--- glitzint.h	9 Sep 2004 09:50:26 -0000	1.26
***************
*** 77,80 ****
--- 77,81 ----
    glitz_gl_enable_t enable;
    glitz_gl_disable_t disable;
+   glitz_gl_get_error_t get_error;
    glitz_gl_enable_client_state_t enable_client_state;
    glitz_gl_disable_client_state_t disable_client_state;
***************
*** 332,338 ****
  #define GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK (1L << 12)
  #define GLITZ_SURFACE_FLAG_DRAWABLE_MASK                (1L << 13)
! #define GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK           (1L << 14)
! #define GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK          (1L << 15)
! #define GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK        (1L << 16)
  
  #define SURFACE_OFFSCREEN(surface) \
--- 333,339 ----
  #define GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK (1L << 12)
  #define GLITZ_SURFACE_FLAG_DRAWABLE_MASK                (1L << 13)
! #define GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK             (1L << 14)
! #define GLITZ_SURFACE_FLAG_EYE_COORDS_MASK              (1L << 15)
! #define GLITZ_SURFACE_FLAG_TRANSFORM_MASK               (1L << 16)
  
  #define SURFACE_OFFSCREEN(surface) \
***************
*** 344,348 ****
  #define SURFACE_REPEAT(surface) \
    (((surface)->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) && \
!    (!((surface)->flags & GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
--- 345,349 ----
  #define SURFACE_REPEAT(surface) \
    (((surface)->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) && \
!    (!((surface)->flags & GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
***************
*** 350,354 ****
  
  #define SURFACE_PAD(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_PAD_MASK)
  
  #define SURFACE_DIRTY(surface) \
--- 351,356 ----
  
  #define SURFACE_PAD(surface) \
!   (((surface)->flags & GLITZ_SURFACE_FLAG_PAD_MASK) && \
!    (!((surface)->flags & GLITZ_SURFACE_FLAG_IGNORE_WRAP_MASK)))
  
  #define SURFACE_DIRTY(surface) \
***************
*** 379,387 ****
    ((surface)->flags & GLITZ_SURFACE_FLAG_DRAWABLE_MASK)
  
! #define SURFACE_TEXTURE_COORDS(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK)
  
! #define SURFACE_SIMPLE_TRANSFORM(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK)
  
  typedef struct _glitz_sample_offset {
--- 381,389 ----
    ((surface)->flags & GLITZ_SURFACE_FLAG_DRAWABLE_MASK)
  
! #define SURFACE_EYE_COORDS(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_EYE_COORDS_MASK)
  
! #define SURFACE_TRANSFORM(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
  
  typedef struct _glitz_sample_offset {




More information about the cairo-commit mailing list