[cairo-commit] glitz/src glitz-agl.h, 1.1.1.1, 1.2 glitz-glx.h,
1.1.1.1, 1.2 glitz_agl_context.c, 1.1.1.1,
1.2 glitz_agl_info.c, 1.2, 1.3 glitz_aglint.h, 1.3,
1.4 glitz_glx_context.c, 1.4, 1.5 glitz_glx_extension.c, 1.5,
1.6 glitz_glx_format.c, 1.4, 1.5 glitz_glx_info.c, 1.3,
1.4 glitz_glx_pbuffer.c, 1.2, 1.3 glitz_glx_surface.c, 1.5,
1.6 glitz_glxext.h, 1.2, 1.3 glitz_glxint.h, 1.5,
1.6 glitz_program.c, 1.5, 1.6 glitzint.h, 1.7, 1.8
David Reveman
commit at pdx.freedesktop.org
Sun May 9 13:54:54 PDT 2004
Committed by: davidr
Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv27340/src
Modified Files:
glitz-agl.h glitz-glx.h glitz_agl_context.c glitz_agl_info.c
glitz_aglint.h glitz_glx_context.c glitz_glx_extension.c
glitz_glx_format.c glitz_glx_info.c glitz_glx_pbuffer.c
glitz_glx_surface.c glitz_glxext.h glitz_glxint.h
glitz_program.c glitzint.h
Log Message:
Added library cleanup functions
Index: glitz-agl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-agl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz-agl.h 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz-agl.h 9 May 2004 20:54:51 -0000 1.2
***************
*** 36,39 ****
--- 36,48 ----
#include <Carbon/Carbon.h>
+
+ /* glitz_agl_info.c */
+
+ void
+ glitz_agl_init (void);
+
+ void
+ glitz_agl_fini (void);
+
/* glitz_agl_format.c */
Index: glitz-glx.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-glx.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz-glx.h 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz-glx.h 9 May 2004 20:54:51 -0000 1.2
***************
*** 37,40 ****
--- 37,49 ----
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+
+ /* glitz_glx_info.c */
+
+ void
+ glitz_glx_init (const char *gl_library);
+
+ void
+ glitz_glx_fini (void);
+
/* glitz_glx_format.c */
Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_context.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_agl_context.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_agl_context.c 9 May 2004 20:54:51 -0000 1.2
***************
*** 76,79 ****
--- 76,87 ----
}
+ void
+ glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
+ glitz_agl_context_t *context)
+ {
+ aglDestroyContext (context->context);
+ free (context);
+ }
+
static void
glitz_agl_context_set_surface_anti_aliasing (glitz_agl_surface_t *surface)
Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_agl_info.c 6 May 2004 14:55:03 -0000 1.2
--- b/glitz_agl_info.c 9 May 2004 20:54:51 -0000 1.3
***************
*** 100,104 ****
static void
! _glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
#ifdef PTHREADS
--- 100,107 ----
static void
! glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
!
! static void
! glitz_agl_thread_info_fini (glitz_agl_thread_info_t *thread_info);
#ifdef PTHREADS
***************
*** 111,125 ****
static pthread_key_t info_tsd;
glitz_agl_thread_info_t *
glitz_agl_thread_info_get (void)
{
if (!tsd_initialized) {
! glitz_agl_thread_info_t *info = (glitz_agl_thread_info_t *)
! malloc (sizeof (glitz_agl_thread_info_t));
! pthread_key_create (&info_tsd, NULL);
pthread_setspecific (info_tsd, info);
- tsd_initialized = 1;
- _glitz_agl_thread_info_init (info);
return info;
} else
--- 114,135 ----
static pthread_key_t info_tsd;
+ static void
+ glitz_agl_thread_info_destroy (void *p)
+ {
+ glitz_agl_thread_info_fini ((glitz_agl_thread_info_t *) p);
+ free (p);
+ }
+
glitz_agl_thread_info_t *
glitz_agl_thread_info_get (void)
{
if (!tsd_initialized) {
! glitz_agl_thread_info_t *info = malloc (sizeof (glitz_agl_thread_info_t));
! glitz_agl_thread_info_init (info);
!
! pthread_key_create (&info_tsd, glitz_agl_thread_info_destroy);
pthread_setspecific (info_tsd, info);
+ tsd_initialized = 1;
return info;
} else
***************
*** 150,154 ****
{
if (_thread_info.context_stack == NULL)
! _glitz_agl_thread_info_init (&_thread_info);
return &_thread_info;
--- 160,164 ----
{
if (_thread_info.context_stack == NULL)
! glitz_agl_thread_info_init (&_thread_info);
return &_thread_info;
***************
*** 158,162 ****
static void
! _glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
{
GLint attrib[] = {
--- 168,172 ----
static void
! glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
{
GLint attrib[] = {
***************
*** 208,209 ****
--- 218,266 ----
thread_info->context_stack->constraint = GLITZ_CN_NONE;
}
+
+ static void
+ glitz_agl_thread_info_fini (glitz_agl_thread_info_t *thread_info)
+ {
+ int i;
+
+ aglSetCurrentContext (thread_info->root_context.context);
+ glitz_programs_fini (&_glitz_agl_gl_proc_address,
+ &thread_info->programs);
+ aglSetCurrentContext (NULL);
+
+ if (thread_info->context_stack)
+ free (thread_info->context_stack);
+
+ for (i = 0; i < thread_info->n_contexts; i++)
+ glitz_agl_context_destroy (thread_info, thread_info->contexts[i]);
+
+ for (i = 0; i < thread_info->n_formats; i++)
+ aglDestroyPixelFormat (thread_info->format_ids[i]);
+
+ if (thread_info->formats)
+ free (thread_info->formats);
+
+ if (thread_info->format_ids)
+ free (thread_info->format_ids);
+
+ aglDestroyContext (thread_info->root_context.context);
+
+ free (thread_info);
+ }
+
+ void
+ glitz_agl_init (void)
+ {
+ glitz_agl_thread_info_get ();
+ }
+ slim_hidden_def(glitz_agl_init);
+
+ void
+ glitz_agl_fini (void)
+ {
+ glitz_agl_thread_info_t *info =
+ glitz_agl_thread_info_get ();
+
+ glitz_agl_thread_info_fini (info);
+ }
+ slim_hidden_def(glitz_agl_fini);
Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_aglint.h 6 May 2004 14:55:03 -0000 1.3
--- b/glitz_aglint.h 9 May 2004 20:54:51 -0000 1.4
***************
*** 103,106 ****
--- 103,110 ----
extern void __internal_linkage
+ glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
+ glitz_agl_context_t *context);
+
+ extern void __internal_linkage
glitz_agl_context_make_current (glitz_agl_surface_t *surface);
***************
*** 130,133 ****
--- 134,139 ----
/* Avoid unnecessary PLT entries. */
+ slim_hidden_proto(glitz_agl_init)
+ slim_hidden_proto(glitz_agl_fini)
slim_hidden_proto(glitz_agl_find_format)
slim_hidden_proto(glitz_agl_find_standard_format)
Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_glx_context.c 6 May 2004 14:55:03 -0000 1.4
--- b/glitz_glx_context.c 9 May 2004 20:54:51 -0000 1.5
***************
*** 34,39 ****
#include <stdlib.h>
- extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
static void
_glitz_glx_context_create_glx12 (glitz_glx_screen_info_t *screen_info,
--- 34,37 ----
***************
*** 69,81 ****
int i, n_fbconfigs;
XVisualInfo *vinfo = NULL;
! fbconfigs = _glitz_glx_proc_address.get_fbconfigs
! (screen_info->display_info->display, screen_info->screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! _glitz_glx_proc_address.get_fbconfig_attrib
! (screen_info->display_info->display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
--- 67,80 ----
int i, n_fbconfigs;
XVisualInfo *vinfo = NULL;
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
! fbconfigs = glx->get_fbconfigs (screen_info->display_info->display,
! screen_info->screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! glx->get_fbconfig_attrib (screen_info->display_info->display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
***************
*** 83,88 ****
if (i < n_fbconfigs)
! vinfo = _glitz_glx_proc_address.get_visual_from_fbconfig
! (screen_info->display_info->display, fbconfigs[i]);
if (vinfo) {
--- 82,87 ----
if (i < n_fbconfigs)
! vinfo = glx->get_visual_from_fbconfig (screen_info->display_info->display,
! fbconfigs[i]);
if (vinfo) {
***************
*** 91,94 ****
--- 90,94 ----
context->id = fbconfigid;
context->fbconfig = fbconfigs[i];
+ XFree (vinfo);
} else {
context->context = NULL;
***************
*** 107,119 ****
GLXFBConfig *fbconfigs;
int i, n_fbconfigs;
! fbconfigs = _glitz_glx_proc_address.get_fbconfigs
! (screen_info->display_info->display, screen_info->screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! _glitz_glx_proc_address.get_fbconfig_attrib
! (screen_info->display_info->display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
--- 107,121 ----
GLXFBConfig *fbconfigs;
int i, n_fbconfigs;
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
+ int status = 1;
! fbconfigs = glx->get_fbconfigs (screen_info->display_info->display,
! screen_info->screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! glx->get_fbconfig_attrib (screen_info->display_info->display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
***************
*** 125,140 ****
texture.width = texture.height = 1;
! pbuffer =
! glitz_glx_pbuffer_create (screen_info->display_info->display,
! fbconfigs[i],
! &texture);
if (pbuffer) {
! glitz_glx_pbuffer_destroy (screen_info->display_info->display, pbuffer);
! return 0;
}
}
! return 1;
}
--- 127,144 ----
texture.width = texture.height = 1;
! pbuffer = glitz_glx_pbuffer_create (screen_info->display_info,
! fbconfigs[i],
! &texture);
if (pbuffer) {
! glitz_glx_pbuffer_destroy (screen_info->display_info, pbuffer);
! status = 0;
}
}
+
+ if (fbconfigs)
+ XFree (fbconfigs);
! return status;
}
***************
*** 185,222 ****
void
! glitz_glx_context_proc_address_lookup (glitz_glx_context_t *context)
{
context->glx.bind_tex_image_arb =
(glitz_glx_bind_tex_image_arb_t)
! glitz_glx_get_proc_address ("glXBindTexImageARB");
context->glx.release_tex_image_arb =
(glitz_glx_release_tex_image_arb_t)
! glitz_glx_get_proc_address ("glXReleaseTexImageARB");
context->gl.active_texture_arb =
(glitz_gl_active_texture_arb_t)
! glitz_glx_get_proc_address ("glActiveTextureARB");
context->gl.multi_tex_coord_2d_arb =
(glitz_gl_multi_tex_coord_2d_arb_t)
! glitz_glx_get_proc_address ("glMultiTexCoord2dARB");
context->gl.gen_programs_arb =
(glitz_gl_gen_programs_arb_t)
! glitz_glx_get_proc_address ("glGenProgramsARB");
context->gl.delete_programs_arb =
(glitz_gl_delete_programs_arb_t)
! glitz_glx_get_proc_address ("glDeleteProgramsARB");
context->gl.program_string_arb =
(glitz_gl_program_string_arb_t)
! glitz_glx_get_proc_address ("glProgramStringARB");
context->gl.bind_program_arb =
(glitz_gl_bind_program_arb_t)
! glitz_glx_get_proc_address ("glBindProgramARB");
context->gl.program_local_param_4d_arb =
(glitz_gl_program_local_param_4d_arb_t)
! glitz_glx_get_proc_address ("glProgramLocalParameter4dARB");
context->gl.get_program_iv_arb =
(glitz_gl_get_program_iv_arb_t)
! glitz_glx_get_proc_address ("glGetProgramivARB");
if (context->gl.get_program_iv_arb) {
--- 189,236 ----
void
! glitz_glx_context_destroy (glitz_glx_screen_info_t *screen_info,
! glitz_glx_context_t *context)
! {
! glXDestroyContext (screen_info->display_info->display,
! context->context);
! free (context);
! }
!
! void
! glitz_glx_context_proc_address_lookup (glitz_glx_thread_info_t *thread_info,
! glitz_glx_context_t *context)
{
context->glx.bind_tex_image_arb =
(glitz_glx_bind_tex_image_arb_t)
! glitz_glx_get_proc_address (thread_info, "glXBindTexImageARB");
context->glx.release_tex_image_arb =
(glitz_glx_release_tex_image_arb_t)
! glitz_glx_get_proc_address (thread_info, "glXReleaseTexImageARB");
context->gl.active_texture_arb =
(glitz_gl_active_texture_arb_t)
! glitz_glx_get_proc_address (thread_info, "glActiveTextureARB");
context->gl.multi_tex_coord_2d_arb =
(glitz_gl_multi_tex_coord_2d_arb_t)
! glitz_glx_get_proc_address (thread_info, "glMultiTexCoord2dARB");
context->gl.gen_programs_arb =
(glitz_gl_gen_programs_arb_t)
! glitz_glx_get_proc_address (thread_info, "glGenProgramsARB");
context->gl.delete_programs_arb =
(glitz_gl_delete_programs_arb_t)
! glitz_glx_get_proc_address (thread_info, "glDeleteProgramsARB");
context->gl.program_string_arb =
(glitz_gl_program_string_arb_t)
! glitz_glx_get_proc_address (thread_info, "glProgramStringARB");
context->gl.bind_program_arb =
(glitz_gl_bind_program_arb_t)
! glitz_glx_get_proc_address (thread_info, "glBindProgramARB");
context->gl.program_local_param_4d_arb =
(glitz_gl_program_local_param_4d_arb_t)
! glitz_glx_get_proc_address (thread_info, "glProgramLocalParameter4dARB");
context->gl.get_program_iv_arb =
(glitz_gl_get_program_iv_arb_t)
! glitz_glx_get_proc_address (thread_info, "glGetProgramivARB");
if (context->gl.get_program_iv_arb) {
***************
*** 262,266 ****
if (surface->context->gl.need_lookup)
! glitz_glx_context_proc_address_lookup (surface->context);
}
--- 276,281 ----
if (surface->context->gl.need_lookup)
! glitz_glx_context_proc_address_lookup
! (surface->screen_info->display_info->thread_info, surface->context);
}
Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_glx_extension.c 2 May 2004 14:11:09 -0000 1.5
--- b/glitz_glx_extension.c 9 May 2004 20:54:51 -0000 1.6
***************
*** 32,37 ****
#include "glitz_glxint.h"
- extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
static glitz_extension_map client_glx_extensions[] = {
/* NYI: Don't know of any driver that supports GLX_ARB_render_texture
--- 32,35 ----
***************
*** 79,82 ****
--- 77,83 ----
glitz_glx_query_extensions (glitz_glx_screen_info_t *screen_info)
{
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
+
screen_info->glx_feature_mask |=
_glitz_glx_extension_query_client_glx (screen_info->display_info->display);
***************
*** 84,92 ****
screen_info->glx_feature_mask |= _glitz_glx_extension_query_gl ();
! if (_glitz_glx_proc_address.get_fbconfigs &&
! _glitz_glx_proc_address.get_fbconfig_attrib &&
! _glitz_glx_proc_address.get_visual_from_fbconfig &&
! _glitz_glx_proc_address.create_pbuffer &&
! _glitz_glx_proc_address.destroy_pbuffer) {
screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_GLX13_MASK;
--- 85,93 ----
screen_info->glx_feature_mask |= _glitz_glx_extension_query_gl ();
! if (glx->get_fbconfigs &&
! glx->get_fbconfig_attrib &&
! glx->get_visual_from_fbconfig &&
! glx->create_pbuffer &&
! glx->destroy_pbuffer) {
screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_GLX13_MASK;
Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_glx_format.c 6 May 2004 14:55:03 -0000 1.4
--- b/glitz_glx_format.c 9 May 2004 20:54:51 -0000 1.5
***************
*** 35,40 ****
#include <string.h>
- extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
static int
_glitz_glx_format_compare (const void *elem1,
--- 35,38 ----
***************
*** 113,117 ****
XVisualInfo visual_templ;
XVisualInfo *visuals;
- long int mask;
int i, num_visuals;
--- 111,114 ----
***************
*** 119,125 ****
visual_templ.screen = screen_info->screen;
! mask = VisualScreenMask;
! visuals =
! XGetVisualInfo (display, VisualScreenMask, &visual_templ, &num_visuals);
/* Offscreen drawing never supported if GLX is older than 1.3 */
--- 116,121 ----
visual_templ.screen = screen_info->screen;
! visuals = XGetVisualInfo (display, VisualScreenMask,
! &visual_templ, &num_visuals);
/* Offscreen drawing never supported if GLX is older than 1.3 */
***************
*** 198,210 ****
GLXFBConfig *fbconfigs;
int i, num_configs;
display = screen_info->display_info->display;
! fbconfigs =
! _glitz_glx_proc_address.get_fbconfigs (display,
! screen_info->screen,
! &num_configs);
! /* GLX 1.3 is not support, falling back to GLX 1.2 */
if (!fbconfigs) {
screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
screen_info->glx_feature_mask &= ~GLITZ_GLX_FEATURE_GLX13_MASK;
--- 194,205 ----
GLXFBConfig *fbconfigs;
int i, num_configs;
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
display = screen_info->display_info->display;
! fbconfigs = glx->get_fbconfigs (display, screen_info->screen, &num_configs);
if (!fbconfigs) {
+ /* GLX 1.3 is not support, falling back to GLX 1.2 */
screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
screen_info->glx_feature_mask &= ~GLITZ_GLX_FEATURE_GLX13_MASK;
***************
*** 215,231 ****
int value;
! if ((_glitz_glx_proc_address.get_fbconfig_attrib
! (display, fbconfigs[i], GLX_RENDER_TYPE, &value) != 0) ||
(!(value & GLX_RGBA_BIT)))
continue;
/* Stereo is not supported yet */
! _glitz_glx_proc_address.get_fbconfig_attrib
! (display, fbconfigs[i], GLX_STEREO, &value);
if (value != 0)
continue;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_DRAWABLE_TYPE, &value);
if (!((value & GLX_WINDOW_BIT) || (value & GLX_PBUFFER_BIT)))
continue;
--- 210,225 ----
int value;
! if ((glx->get_fbconfig_attrib (display, fbconfigs[i],
! GLX_RENDER_TYPE, &value) != 0) ||
(!(value & GLX_RGBA_BIT)))
continue;
/* Stereo is not supported yet */
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_STEREO, &value);
if (value != 0)
continue;
! glx->get_fbconfig_attrib (display, fbconfigs[i],
! GLX_DRAWABLE_TYPE, &value);
if (!((value & GLX_WINDOW_BIT) || (value & GLX_PBUFFER_BIT)))
continue;
***************
*** 234,270 ****
format.drawable.offscreen = (value & GLX_PBUFFER_BIT)? 1: 0;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
format.id = (XID) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_RED_SIZE, &value);
format.red_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_GREEN_SIZE, &value);
format.green_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_BLUE_SIZE, &value);
format.blue_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_ALPHA_SIZE, &value);
format.alpha_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_DEPTH_SIZE, &value);
format.depth_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_STENCIL_SIZE, &value);
format.stencil_size = (unsigned short) value;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_DOUBLEBUFFER, &value);
format.doublebuffer = (value)? 1: 0;
if (screen_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_SAMPLE_BUFFERS_ARB,
! &value);
format.multisample.supported = (value)? 1: 0;
! _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
! GLX_SAMPLES_ARB, &value);
format.multisample.samples = (unsigned short) value;
} else {
--- 228,255 ----
format.drawable.offscreen = (value & GLX_PBUFFER_BIT)? 1: 0;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_FBCONFIG_ID, &value);
format.id = (XID) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_RED_SIZE, &value);
format.red_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_GREEN_SIZE, &value);
format.green_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_BLUE_SIZE, &value);
format.blue_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_ALPHA_SIZE, &value);
format.alpha_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_DEPTH_SIZE, &value);
format.depth_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_STENCIL_SIZE, &value);
format.stencil_size = (unsigned short) value;
! glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_DOUBLEBUFFER, &value);
format.doublebuffer = (value)? 1: 0;
if (screen_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
! glx->get_fbconfig_attrib (display, fbconfigs[i],
! GLX_SAMPLE_BUFFERS_ARB, &value);
format.multisample.supported = (value)? 1: 0;
! glx->get_fbconfig_attrib (display, fbconfigs[i],
! GLX_SAMPLES_ARB, &value);
format.multisample.samples = (unsigned short) value;
} else {
***************
*** 386,403 ****
glitz_glx_screen_info_t *screen_info =
glitz_glx_screen_info_get (display, screen);
if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_GLX13_MASK) {
-
GLXFBConfig *fbconfigs;
int i, n_fbconfigs;
int fbconfigid = screen_info->format_ids[format->id];
! fbconfigs =
! _glitz_glx_proc_address.get_fbconfigs (display, screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! _glitz_glx_proc_address.get_fbconfig_attrib
! (display, fbconfigs[i], GLX_FBCONFIG_ID, &value);
if (value == fbconfigid)
break;
--- 371,388 ----
glitz_glx_screen_info_t *screen_info =
glitz_glx_screen_info_get (display, screen);
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_GLX13_MASK) {
GLXFBConfig *fbconfigs;
int i, n_fbconfigs;
int fbconfigid = screen_info->format_ids[format->id];
! fbconfigs = glx->get_fbconfigs (display, screen, &n_fbconfigs);
for (i = 0; i < n_fbconfigs; i++) {
int value;
! glx->get_fbconfig_attrib (display, fbconfigs[i],
! GLX_FBCONFIG_ID, &value);
if (value == fbconfigid)
break;
***************
*** 405,411 ****
if (i < n_fbconfigs)
! vinfo =
! _glitz_glx_proc_address.get_visual_from_fbconfig (display,
! fbconfigs[i]);
if (fbconfigs)
--- 390,394 ----
if (i < n_fbconfigs)
! vinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]);
if (fbconfigs)
Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glx_info.c 6 May 2004 14:55:03 -0000 1.3
--- b/glitz_glx_info.c 9 May 2004 20:54:51 -0000 1.4
***************
*** 32,35 ****
--- 32,36 ----
#include "glitz_glxint.h"
+ #include <string.h>
#include <dlfcn.h>
***************
*** 99,130 ****
};
- glitz_glx_static_proc_address_list_t _glitz_glx_proc_address = {
- (glitz_glx_get_fbconfigs_t) 0,
- (glitz_glx_get_fbconfig_attrib_t) 0,
- (glitz_glx_get_visual_from_fbconfig_t) 0,
- (glitz_glx_create_pbuffer_t) 0,
- (glitz_glx_destroy_pbuffer_t) 0,
- 1
- };
-
- typedef void *(* glitz_glx_get_proc_address_arb_t)(glitz_gl_ubyte_t *);
-
- glitz_glx_get_proc_address_arb_t glitz_glx_get_proc_address_arb = NULL;
-
void *
! glitz_glx_get_proc_address (const char *name)
{
void *address = NULL;
! if (glitz_glx_get_proc_address_arb)
! address = glitz_glx_get_proc_address_arb ((glitz_gl_ubyte_t *) name);
if (!address) {
! void *dlhand;
! if ((dlhand = dlopen (NULL, RTLD_LAZY))) {
! address = dlsym (dlhand, name);
! dlclose (dlhand);
! }
}
--- 100,116 ----
};
void *
! glitz_glx_get_proc_address (glitz_glx_thread_info_t *info, const char *name)
{
void *address = NULL;
! if (info->glx.get_proc_address_arb)
! address = info->glx.get_proc_address_arb ((glitz_gl_ubyte_t *) name);
if (!address) {
! if (!info->dlhand)
! info->dlhand = dlopen (info->gl_library, RTLD_LAZY);
! address = dlsym (info->dlhand, name);
}
***************
*** 133,157 ****
static void
! glitz_glx_proc_address_lookup (void)
{
! glitz_glx_get_proc_address_arb =
! (glitz_glx_get_proc_address_arb_t)
! glitz_glx_get_proc_address ("glXGetProcAddressARB");
! _glitz_glx_proc_address.get_fbconfigs =
! (glitz_glx_get_fbconfigs_t)
! glitz_glx_get_proc_address ("glXGetFBConfigs");
! _glitz_glx_proc_address.get_fbconfig_attrib =
! (glitz_glx_get_fbconfig_attrib_t)
! glitz_glx_get_proc_address ("glXGetFBConfigAttrib");
! _glitz_glx_proc_address.get_visual_from_fbconfig =
! (glitz_glx_get_visual_from_fbconfig_t)
! glitz_glx_get_proc_address ("glXGetVisualFromFBConfig");
! _glitz_glx_proc_address.create_pbuffer =
! (glitz_glx_create_pbuffer_t)
! glitz_glx_get_proc_address ("glXCreatePbuffer");
! _glitz_glx_proc_address.destroy_pbuffer =
! (glitz_glx_destroy_pbuffer_t)
! glitz_glx_get_proc_address ("glXDestroyPbuffer");
! _glitz_glx_proc_address.need_lookup = 0;
}
--- 119,182 ----
static void
! glitz_glx_proc_address_lookup (glitz_glx_thread_info_t *info)
{
! info->glx.get_proc_address_arb = (glitz_glx_get_proc_address_arb_t)
! glitz_glx_get_proc_address (info, "glXGetProcAddressARB");
! info->glx.get_fbconfigs = (glitz_glx_get_fbconfigs_t)
! glitz_glx_get_proc_address (info, "glXGetFBConfigs");
! info->glx.get_fbconfig_attrib = (glitz_glx_get_fbconfig_attrib_t)
! glitz_glx_get_proc_address (info, "glXGetFBConfigAttrib");
! info->glx.get_visual_from_fbconfig = (glitz_glx_get_visual_from_fbconfig_t)
! glitz_glx_get_proc_address (info, "glXGetVisualFromFBConfig");
! info->glx.create_pbuffer = (glitz_glx_create_pbuffer_t)
! glitz_glx_get_proc_address (info, "glXCreatePbuffer");
! info->glx.destroy_pbuffer = (glitz_glx_destroy_pbuffer_t)
! glitz_glx_get_proc_address (info, "glXDestroyPbuffer");
!
! info->glx.need_lookup = 0;
! }
!
! static void
! glitz_glx_display_destroy (glitz_glx_display_info_t *display_info);
!
! static void
! glitz_glx_screen_destroy (glitz_glx_screen_info_t *screen_info);
!
! static void
! glitz_glx_thread_info_init (glitz_glx_thread_info_t *thread_info)
! {
! thread_info->displays = NULL;
! thread_info->n_displays = 0;
! memset (&thread_info->glx, 0, sizeof (glitz_glx_static_proc_address_list_t));
! thread_info->glx.need_lookup = 1;
! thread_info->gl_library = NULL;
! thread_info->dlhand = NULL;
! }
!
! static void
! glitz_glx_thread_info_fini (glitz_glx_thread_info_t *thread_info)
! {
! int i;
!
! for (i = 0; i < thread_info->n_displays; i++)
! glitz_glx_display_destroy (thread_info->displays[i]);
!
! free (thread_info->displays);
!
! thread_info->displays = NULL;
! thread_info->n_displays = 0;
!
! memset (&thread_info->glx, 0, sizeof (glitz_glx_static_proc_address_list_t));
! thread_info->glx.need_lookup = 1;
!
! if (thread_info->gl_library) {
! free (thread_info->gl_library);
! thread_info->gl_library = NULL;
! }
!
! if (thread_info->dlhand) {
! dlclose (thread_info->dlhand);
! thread_info->dlhand = NULL;
! }
}
***************
*** 165,188 ****
static xthread_key_t info_tsd;
! glitz_glx_thread_info_t *
! glitz_glx_thread_info_get (void)
{
if (!tsd_initialized) {
! glitz_glx_thread_info_t *info = (glitz_glx_thread_info_t *)
! malloc (sizeof (glitz_glx_thread_info_t));
! 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);
! xthread_set_specific (info_tsd, info);
tsd_initialized = 1;
- return info;
} else {
void *p;
xthread_get_specific (info_tsd, &p);
! return (glitz_glx_thread_info_t *) p;
}
}
--- 190,228 ----
static xthread_key_t info_tsd;
! static void
! glitz_glx_thread_info_destroy (void *p)
{
+ glitz_glx_thread_info_fini ((glitz_glx_thread_info_t *) p);
+ free (p);
+ }
+
+ static glitz_glx_thread_info_t *
+ glitz_glx_thread_info_get (const char *gl_library)
+ {
+ glitz_glx_thread_info_t *thread_info;
+
if (!tsd_initialized) {
! thread_info = malloc (sizeof (glitz_glx_thread_info_t));
! glitz_glx_thread_info_init (thread_info);
!
! xthread_key_create (&info_tsd, glitz_glx_thread_info_destroy);
! xthread_set_specific (info_tsd, thread_info);
!
tsd_initialized = 1;
} else {
void *p;
xthread_get_specific (info_tsd, &p);
! thread_info = (glitz_glx_thread_info_t *) p;
}
+
+ if (thread_info->glx.need_lookup) {
+ if (gl_library)
+ thread_info->gl_library = strdup (gl_library);
+
+ glitz_glx_proc_address_lookup (thread_info);
+ }
+
+ return thread_info;
}
***************
*** 192,203 ****
static glitz_glx_thread_info_t thread_info = {
NULL,
! 0
};
! glitz_glx_thread_info_t *
! glitz_glx_thread_info_get (void)
{
! if (!_glitz_glx_proc_address.supported)
! glitz_glx_proc_address_lookup ();
return &thread_info;
--- 232,250 ----
static glitz_glx_thread_info_t thread_info = {
NULL,
! 0,
! { 0, 0, 0, 0, 0, 0, 1 },
! NULL,
! NULL
};
! static glitz_glx_thread_info_t *
! glitz_glx_thread_info_get (char *gl_library)
{
! if (!thread_info.glx.need_lookup) {
! if (gl_library)
! thread_info->gl_library = strdup (gl_library);
!
! glitz_glx_proc_address_lookup (&thread_info);
! }
return &thread_info;
***************
*** 206,214 ****
#endif
! glitz_glx_display_info_t *
glitz_glx_display_info_get (Display *display)
{
glitz_glx_display_info_t *display_info;
! glitz_glx_thread_info_t *thread_info = glitz_glx_thread_info_get ();
glitz_glx_display_info_t **displays = thread_info->displays;
int index, n_displays = thread_info->n_displays;
--- 253,261 ----
#endif
! static glitz_glx_display_info_t *
glitz_glx_display_info_get (Display *display)
{
glitz_glx_display_info_t *display_info;
! glitz_glx_thread_info_t *thread_info = glitz_glx_thread_info_get (NULL);
glitz_glx_display_info_t **displays = thread_info->displays;
int index, n_displays = thread_info->n_displays;
***************
*** 236,239 ****
--- 283,297 ----
static void
+ glitz_glx_display_destroy (glitz_glx_display_info_t *display_info)
+ {
+ int i;
+
+ for (i = 0; i < display_info->n_screens; i++)
+ glitz_glx_screen_destroy (display_info->screens[i]);
+
+ free (display_info->screens);
+ }
+
+ static void
glitz_glx_create_root_context (glitz_glx_screen_info_t *screen_info)
{
***************
*** 289,293 ****
}
! screen_info->root_context.fbconfig = (XID) 0;
memcpy (&screen_info->root_context.gl,
--- 347,351 ----
}
! screen_info->root_context.fbconfig = (XID) 0;
memcpy (&screen_info->root_context.gl,
***************
*** 350,355 ****
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
! glitz_glx_context_proc_address_lookup (&screen_info->root_context);
!
glitz_glx_query_extensions (screen_info);
glitz_glx_query_formats (screen_info);
--- 408,414 ----
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
! glitz_glx_context_proc_address_lookup
! (screen_info->display_info->thread_info, &screen_info->root_context);
!
glitz_glx_query_extensions (screen_info);
glitz_glx_query_formats (screen_info);
***************
*** 363,364 ****
--- 422,480 ----
return screen_info;
}
+
+ static void
+ glitz_glx_screen_destroy (glitz_glx_screen_info_t *screen_info)
+ {
+ int i;
+ Display *display = screen_info->display_info->display;
+
+ if (screen_info->root_context.context &&
+ glXMakeCurrent (screen_info->display_info->display,
+ screen_info->root_drawable,
+ screen_info->root_context.context)) {
+ glitz_programs_fini (&screen_info->root_context.gl,
+ &screen_info->programs);
+ }
+
+ glXMakeCurrent (display, None, NULL);
+
+ if (screen_info->context_stack)
+ free (screen_info->context_stack);
+
+ for (i = 0; i < screen_info->n_contexts; i++)
+ glitz_glx_context_destroy (screen_info, screen_info->contexts[i]);
+
+ if (screen_info->contexts)
+ free (screen_info->contexts);
+
+ if (screen_info->formats)
+ free (screen_info->formats);
+
+ if (screen_info->format_ids)
+ free (screen_info->format_ids);
+
+ if (screen_info->root_context.context)
+ glXDestroyContext (display, screen_info->root_context.context);
+
+ if (screen_info->root_drawable)
+ XDestroyWindow (display, screen_info->root_drawable);
+
+ free (screen_info);
+ }
+
+ void
+ glitz_glx_init (const char *gl_library)
+ {
+ glitz_glx_thread_info_get (gl_library);
+ }
+ slim_hidden_def(glitz_glx_init);
+
+ void
+ glitz_glx_fini (void)
+ {
+ glitz_glx_thread_info_t *info =
+ glitz_glx_thread_info_get (NULL);
+
+ glitz_glx_thread_info_fini (info);
+ }
+ slim_hidden_def(glitz_glx_fini);
Index: glitz_glx_pbuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_pbuffer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glx_pbuffer.c 3 Apr 2004 17:53:54 -0000 1.2
--- b/glitz_glx_pbuffer.c 9 May 2004 20:54:51 -0000 1.3
***************
*** 32,39 ****
#include "glitz_glxint.h"
- extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
GLXPbuffer
! glitz_glx_pbuffer_create (Display *display,
GLXFBConfig fbconfig,
glitz_texture_t *texture)
--- 32,37 ----
#include "glitz_glxint.h"
GLXPbuffer
! glitz_glx_pbuffer_create (glitz_glx_display_info_t *display_info,
GLXFBConfig fbconfig,
glitz_texture_t *texture)
***************
*** 52,62 ****
return
! _glitz_glx_proc_address.create_pbuffer (display, fbconfig, pbuffer_attr);
}
void
! glitz_glx_pbuffer_destroy (Display *display,
GLXPbuffer pbuffer)
{
! _glitz_glx_proc_address.destroy_pbuffer (display, pbuffer);
}
--- 50,62 ----
return
! display_info->thread_info->glx.create_pbuffer (display_info->display,
! fbconfig, pbuffer_attr);
}
void
! glitz_glx_pbuffer_destroy (glitz_glx_display_info_t *display_info,
GLXPbuffer pbuffer)
{
! display_info->thread_info->glx.destroy_pbuffer (display_info->display,
! pbuffer);
}
Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_glx_surface.c 6 May 2004 14:55:03 -0000 1.5
--- b/glitz_glx_surface.c 9 May 2004 20:54:51 -0000 1.6
***************
*** 223,227 ****
surface->drawable = surface->pbuffer =
! glitz_glx_pbuffer_create (screen_info->display_info->display,
surface->context->fbconfig,
&surface->base.texture);
--- 223,227 ----
surface->drawable = surface->pbuffer =
! glitz_glx_pbuffer_create (screen_info->display_info,
surface->context->fbconfig,
&surface->base.texture);
***************
*** 326,330 ****
if (surface->pbuffer)
! glitz_glx_pbuffer_destroy (surface->screen_info->display_info->display,
surface->pbuffer);
--- 326,330 ----
if (surface->pbuffer)
! glitz_glx_pbuffer_destroy (surface->screen_info->display_info,
surface->pbuffer);
Index: glitz_glxext.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxext.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_glxext.h 3 Apr 2004 17:53:54 -0000 1.2
--- b/glitz_glxext.h 9 May 2004 20:54:51 -0000 1.3
***************
*** 95,98 ****
--- 95,99 ----
#endif
+ typedef void *(* glitz_glx_get_proc_address_arb_t)(glitz_gl_ubyte_t *);
typedef GLXFBConfig *(* glitz_glx_get_fbconfigs_t)
(Display *display, int screen, int *n_elements);
Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_glxint.h 6 May 2004 14:55:03 -0000 1.5
--- b/glitz_glxint.h 9 May 2004 20:54:51 -0000 1.6
***************
*** 55,58 ****
--- 55,59 ----
typedef struct _glitz_glx_static_proc_address_list_t {
+ glitz_glx_get_proc_address_arb_t get_proc_address_arb;
glitz_glx_get_fbconfigs_t get_fbconfigs;
glitz_glx_get_fbconfig_attrib_t get_fbconfig_attrib;
***************
*** 72,75 ****
--- 73,79 ----
glitz_glx_display_info_t **displays;
int n_displays;
+ glitz_glx_static_proc_address_list_t glx;
+ char *gl_library;
+ void *dlhand;
} glitz_glx_thread_info_t;
***************
*** 132,141 ****
glitz_glx_query_extensions (glitz_glx_screen_info_t *screen_info);
- extern glitz_glx_thread_info_t *__internal_linkage
- glitz_glx_thread_info_get (void);
-
- extern glitz_glx_display_info_t *__internal_linkage
- glitz_glx_display_info_get (Display *display);
-
extern glitz_glx_screen_info_t *__internal_linkage
glitz_glx_screen_info_get (Display *display,
--- 136,139 ----
***************
*** 143,147 ****
extern void *__internal_linkage
! glitz_glx_get_proc_address (const char *name);
extern glitz_glx_context_t *__internal_linkage
--- 141,145 ----
extern void *__internal_linkage
! glitz_glx_get_proc_address (glitz_glx_thread_info_t *info, const char *name);
extern glitz_glx_context_t *__internal_linkage
***************
*** 149,152 ****
--- 147,154 ----
glitz_format_t *format);
+ extern void __internal_linkage
+ glitz_glx_context_destroy (glitz_glx_screen_info_t *screen_info,
+ glitz_glx_context_t *context);
+
extern int __internal_linkage
glitz_glx_ensure_pbuffer_support (glitz_glx_screen_info_t *screen_info,
***************
*** 167,171 ****
extern void __internal_linkage
! glitz_glx_context_proc_address_lookup (glitz_glx_context_t *context);
extern void __internal_linkage
--- 169,174 ----
extern void __internal_linkage
! glitz_glx_context_proc_address_lookup (glitz_glx_thread_info_t *thread_info,
! glitz_glx_context_t *context);
extern void __internal_linkage
***************
*** 173,186 ****
extern GLXPbuffer __internal_linkage
! glitz_glx_pbuffer_create (Display *display,
GLXFBConfig fbconfig,
glitz_texture_t *texture);
extern void __internal_linkage
! glitz_glx_pbuffer_destroy (Display *display,
GLXPbuffer pbuffer);
/* Avoid unnecessary PLT entries. */
slim_hidden_proto(glitz_glx_find_format)
slim_hidden_proto(glitz_glx_find_standard_format)
--- 176,191 ----
extern GLXPbuffer __internal_linkage
! glitz_glx_pbuffer_create (glitz_glx_display_info_t *display_info,
GLXFBConfig fbconfig,
glitz_texture_t *texture);
extern void __internal_linkage
! glitz_glx_pbuffer_destroy (glitz_glx_display_info_t *display_info,
GLXPbuffer pbuffer);
/* Avoid unnecessary PLT entries. */
+ slim_hidden_proto(glitz_glx_init)
+ slim_hidden_proto(glitz_glx_fini)
slim_hidden_proto(glitz_glx_find_format)
slim_hidden_proto(glitz_glx_find_standard_format)
Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_program.c 6 May 2004 14:55:03 -0000 1.5
--- b/glitz_program.c 9 May 2004 20:54:51 -0000 1.6
***************
*** 390,394 ****
};
! static unsigned int
glitz_program_compile_vertex_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
--- 390,394 ----
};
! static glitz_gl_uint_t
glitz_program_compile_vertex_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
***************
*** 410,417 ****
}
! return (unsigned int) program;
}
! static unsigned int
glitz_program_compile_fragment_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
--- 410,417 ----
}
! return program;
}
! static glitz_gl_uint_t
glitz_program_compile_fragment_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
***************
*** 433,437 ****
}
! return (unsigned int) program;
}
--- 433,437 ----
}
! return program;
}
***************
*** 469,473 ****
}
! static unsigned long
glitz_program_compile_simple (glitz_gl_proc_address_list_t *gl,
int offset)
--- 469,473 ----
}
! static glitz_gl_uint_t
glitz_program_compile_simple (glitz_gl_proc_address_list_t *gl,
int offset)
***************
*** 485,489 ****
}
! static unsigned long
glitz_program_compile_vertex_convolution (glitz_gl_proc_address_list_t *gl,
int offset)
--- 485,489 ----
}
! static glitz_gl_uint_t
glitz_program_compile_vertex_convolution (glitz_gl_proc_address_list_t *gl,
int offset)
***************
*** 501,505 ****
}
! static unsigned long
glitz_program_compile_convolution (glitz_gl_proc_address_list_t *gl,
int offset,
--- 501,505 ----
}
! static glitz_gl_uint_t
glitz_program_compile_convolution (glitz_gl_proc_address_list_t *gl,
int offset,
***************
*** 539,543 ****
}
! static unsigned long
glitz_program_compile_programmatic (glitz_programmatic_surface_type_t type,
glitz_gl_proc_address_list_t *gl,
--- 539,543 ----
}
! static glitz_gl_uint_t
glitz_program_compile_programmatic (glitz_programmatic_surface_type_t type,
glitz_gl_proc_address_list_t *gl,
***************
*** 883,884 ****
--- 883,911 ----
}
}
+
+ void
+ glitz_programs_fini (glitz_gl_proc_address_list_t *gl,
+ glitz_programs_t *programs)
+ {
+ int i;
+
+ for (i = 0; i < GLITZ_VERTEX_PROGRAM_TYPES; i++) {
+ if (programs->vertex_convolution[i])
+ gl->delete_programs_arb (1, &programs->vertex_convolution[i]);
+ }
+
+ for (i = 0; i < GLITZ_FRAGMENT_PROGRAM_TYPES; i++) {
+ if (programs->fragment_simple[i])
+ gl->delete_programs_arb (1, &programs->fragment_simple[i]);
+ }
+
+ for (i = 0; i < (GLITZ_FRAGMENT_PROGRAM_TYPES * 3); i++) {
+ if (programs->fragment_convolution[i])
+ gl->delete_programs_arb (1, &programs->fragment_convolution[i]);
+ }
+
+ for (i = 0; i < GLITZ_FRAGMENT_PROGRAMMATIC_PROGRAM_TYPES; i++) {
+ if (programs->fragment_programmatic[i])
+ gl->delete_programs_arb (1, &programs->fragment_programmatic[i]);
+ }
+ }
Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/glitzint.h 6 May 2004 14:55:03 -0000 1.7
--- b/glitzint.h 9 May 2004 20:54:51 -0000 1.8
***************
*** 186,193 ****
typedef struct _glitz_programs_t {
! unsigned long vertex_convolution[GLITZ_VERTEX_PROGRAM_TYPES];
! unsigned long fragment_simple[GLITZ_FRAGMENT_PROGRAM_TYPES];
! unsigned long fragment_convolution[GLITZ_FRAGMENT_PROGRAM_TYPES * 3];
! unsigned long fragment_programmatic[GLITZ_FRAGMENT_PROGRAMMATIC_PROGRAM_TYPES];
} glitz_programs_t;
--- 186,194 ----
typedef struct _glitz_programs_t {
! glitz_gl_uint_t vertex_convolution[GLITZ_VERTEX_PROGRAM_TYPES];
! glitz_gl_uint_t fragment_simple[GLITZ_FRAGMENT_PROGRAM_TYPES];
! glitz_gl_uint_t fragment_convolution[GLITZ_FRAGMENT_PROGRAM_TYPES * 3];
! glitz_gl_uint_t
! fragment_programmatic[GLITZ_FRAGMENT_PROGRAMMATIC_PROGRAM_TYPES];
} glitz_programs_t;
***************
*** 599,602 ****
--- 600,607 ----
extern void __internal_linkage
+ glitz_programs_fini (glitz_gl_proc_address_list_t *gl,
+ glitz_programs_t *programs);
+
+ extern void __internal_linkage
glitz_programmatic_surface_setup (glitz_surface_t *abstract_surface,
int width,
More information about the cairo-commit
mailing list