summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog47
-rw-r--r--TODO6
-rw-r--r--src/glitz-agl.h9
-rw-r--r--src/glitz-glx.h9
-rw-r--r--src/glitz_agl_context.c8
-rw-r--r--src/glitz_agl_info.c73
-rw-r--r--src/glitz_aglint.h6
-rw-r--r--src/glitz_glx_context.c81
-rw-r--r--src/glitz_glx_extension.c15
-rw-r--r--src/glitz_glx_format.c75
-rw-r--r--src/glitz_glx_info.c242
-rw-r--r--src/glitz_glx_pbuffer.c12
-rw-r--r--src/glitz_glx_surface.c4
-rw-r--r--src/glitz_glxext.h1
-rw-r--r--src/glitz_glxint.h25
-rw-r--r--src/glitz_program.c43
-rw-r--r--src/glitzint.h13
17 files changed, 477 insertions, 192 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cacf8e..07fe7cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2004-05-09 David Reveman <c99drn@cs.umu.se>
+
+ * TODO: Added library cleanup functions.
+
+ * src/glitzint.h: Fixed program identifier types. Added
+ glitz_programs_fini.
+
+ * src/glitz_program.c: Fixed program identifier types. Added
+ glitz_programs_fini.
+
+ * src/glitz_glxint.h: GLX procedure addresses are now thread
+ specific. Added glitz_glx_context_destroy.
+
+ * src/glitz_glxext.h: GLX procedure addresses are now thread
+ specific.
+
+ * src/glitz_glx_surface.c: GLX procedure addresses are now thread
+ specific.
+
+ * src/glitz_glx_pbuffer.c: GLX procedure addresses are now thread
+ specific.
+
+ * src/glitz_glx_info.c: GLX procedure addresses are now thread
+ specific. Added glitz_glx_thread_info_init,
+ glitz_glx_thread_info_fini, glitz_glx_screen_destroy,
+ glitz_glx_display_destroy, glitz_glx_init and glitz_glx_fini.
+
+ * src/glitz_glx_format.c: GLX procedure addresses are now thread
+ specific.
+
+ * src/glitz_glx_extension.c (glitz_glx_query_extensions): GLX
+ procedure addresses are now thread specific.
+
+ * src/glitz_glx_context.c: GLX procedure addresses are now thread
+ specific. Added glitz_glx_context_destroy.
+ (_glitz_glx_context_create_glx13): Free visual info structure.
+ (glitz_glx_ensure_pbuffer_support): Free fbconfigs.
+
+ * src/glitz_aglint.h: Added glitz_agl_context_destroy.
+
+ * src/glitz_agl_info.c: Added glitz_agl_thread_info_fini,
+ glitz_agl_init and glitz_agl_fini.
+
+ * src/glitz_agl_context.c: Added glitz_agl_context_destroy.
+
+ * src/glitz-agl.h: Added glitz_agl_init and glitz_agl_fini.
+
2004-05-06 David Reveman <c99drn@cs.umu.se>
* src/glitzint.h: Better texture handling.
diff --git a/TODO b/TODO
index d5527ea..9cadb3c 100644
--- a/TODO
+++ b/TODO
@@ -1,22 +1,18 @@
* Improve status handling. Operations on surfaces with status other than
"Success" should be ignored.
-* Add library cleanup function.
-
* Copy area operation.
* Support simultaneous transform and repeat.
* Alpha scaling of source surface with polygon rendering.
-* Add filter type GLITZ_FILTER_ANISOTROPIC.
-
* Text support. Glyph set management, glyph and string compositing
operations. Some ideas: Multi-texturing for compositing multiple glyphs
per render pass, Sub-pixel rendering, vector text; glyphs loaded into
display lists.
-* Projective transformations.
+* Projective transformations (Add filter type GLITZ_FILTER_ANISOTROPIC).
* A programmable surface type which can store a set of rendering operations
in a display list.
diff --git a/src/glitz-agl.h b/src/glitz-agl.h
index 76fece5..65b1576 100644
--- a/src/glitz-agl.h
+++ b/src/glitz-agl.h
@@ -35,6 +35,15 @@ extern "C" {
#endif
#include <Carbon/Carbon.h>
+
+/* glitz_agl_info.c */
+
+void
+glitz_agl_init (void);
+
+void
+glitz_agl_fini (void);
+
/* glitz_agl_format.c */
diff --git a/src/glitz-glx.h b/src/glitz-glx.h
index 22d3eaa..4bf8a0c 100644
--- a/src/glitz-glx.h
+++ b/src/glitz-glx.h
@@ -36,6 +36,15 @@ extern "C" {
#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 */
diff --git a/src/glitz_agl_context.c b/src/glitz_agl_context.c
index 88c36e2..7137c45 100644
--- a/src/glitz_agl_context.c
+++ b/src/glitz_agl_context.c
@@ -75,6 +75,14 @@ glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
return context;
}
+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)
{
diff --git a/src/glitz_agl_info.c b/src/glitz_agl_info.c
index 9fe0591..694380c 100644
--- a/src/glitz_agl_info.c
+++ b/src/glitz_agl_info.c
@@ -99,7 +99,10 @@ glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address = {
};
static void
-_glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
+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
@@ -110,17 +113,24 @@ _glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
static int tsd_initialized = 0;
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 = (glitz_agl_thread_info_t *)
- malloc (sizeof (glitz_agl_thread_info_t));
- pthread_key_create (&info_tsd, NULL);
+ 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;
- _glitz_agl_thread_info_init (info);
+ tsd_initialized = 1;
return info;
} else
return (glitz_agl_thread_info_t *) pthread_getspecific (info_tsd);
@@ -149,7 +159,7 @@ glitz_agl_thread_info_t *
glitz_agl_thread_info_get (void)
{
if (_thread_info.context_stack == NULL)
- _glitz_agl_thread_info_init (&_thread_info);
+ glitz_agl_thread_info_init (&_thread_info);
return &_thread_info;
}
@@ -157,7 +167,7 @@ glitz_agl_thread_info_get (void)
#endif
static void
-_glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
+glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
{
GLint attrib[] = {
AGL_RGBA,
@@ -207,3 +217,50 @@ _glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
thread_info->context_stack->surface = NULL;
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);
diff --git a/src/glitz_aglint.h b/src/glitz_aglint.h
index e09989c..a114ee9 100644
--- a/src/glitz_aglint.h
+++ b/src/glitz_aglint.h
@@ -102,6 +102,10 @@ glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
glitz_bool_t offscreen);
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);
extern glitz_agl_surface_t *__internal_linkage
@@ -129,6 +133,8 @@ glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer);
/* 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)
slim_hidden_proto(glitz_agl_surface_create)
diff --git a/src/glitz_glx_context.c b/src/glitz_glx_context.c
index 603065c..c0d850e 100644
--- a/src/glitz_glx_context.c
+++ b/src/glitz_glx_context.c
@@ -33,8 +33,6 @@
#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,
XID visualid,
@@ -68,28 +66,30 @@ _glitz_glx_context_create_glx13 (glitz_glx_screen_info_t *screen_info,
GLXFBConfig *fbconfigs;
int i, n_fbconfigs;
XVisualInfo *vinfo = NULL;
+ glitz_glx_static_proc_address_list_t *glx =
+ &screen_info->display_info->thread_info->glx;
- fbconfigs = _glitz_glx_proc_address.get_fbconfigs
- (screen_info->display_info->display, screen_info->screen, &n_fbconfigs);
+ fbconfigs = glx->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);
+ glx->get_fbconfig_attrib (screen_info->display_info->display, fbconfigs[i],
+ GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
}
if (i < n_fbconfigs)
- vinfo = _glitz_glx_proc_address.get_visual_from_fbconfig
- (screen_info->display_info->display, fbconfigs[i]);
+ vinfo = glx->get_visual_from_fbconfig (screen_info->display_info->display,
+ fbconfigs[i]);
if (vinfo) {
context->context = glXCreateContext (screen_info->display_info->display,
vinfo, share_list, 1);
context->id = fbconfigid;
context->fbconfig = fbconfigs[i];
+ XFree (vinfo);
} else {
context->context = NULL;
context->id = fbconfigid;
@@ -106,15 +106,17 @@ glitz_glx_ensure_pbuffer_support (glitz_glx_screen_info_t *screen_info,
{
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 = _glitz_glx_proc_address.get_fbconfigs
- (screen_info->display_info->display, screen_info->screen, &n_fbconfigs);
+ fbconfigs = glx->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);
+ glx->get_fbconfig_attrib (screen_info->display_info->display, fbconfigs[i],
+ GLX_FBCONFIG_ID, &value);
if (value == (int) fbconfigid)
break;
}
@@ -124,18 +126,20 @@ glitz_glx_ensure_pbuffer_support (glitz_glx_screen_info_t *screen_info,
glitz_texture_t texture;
texture.width = texture.height = 1;
- pbuffer =
- glitz_glx_pbuffer_create (screen_info->display_info->display,
- fbconfigs[i],
- &texture);
+ pbuffer = glitz_glx_pbuffer_create (screen_info->display_info,
+ fbconfigs[i],
+ &texture);
if (pbuffer) {
- glitz_glx_pbuffer_destroy (screen_info->display_info->display, pbuffer);
+ glitz_glx_pbuffer_destroy (screen_info->display_info, pbuffer);
- return 0;
+ status = 0;
}
}
+
+ if (fbconfigs)
+ XFree (fbconfigs);
- return 1;
+ return status;
}
glitz_glx_context_t *
@@ -184,40 +188,50 @@ glitz_glx_context_get (glitz_glx_screen_info_t *screen_info,
}
void
-glitz_glx_context_proc_address_lookup (glitz_glx_context_t *context)
+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 ("glXBindTexImageARB");
+ 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 ("glXReleaseTexImageARB");
+ glitz_glx_get_proc_address (thread_info, "glXReleaseTexImageARB");
context->gl.active_texture_arb =
(glitz_gl_active_texture_arb_t)
- glitz_glx_get_proc_address ("glActiveTextureARB");
+ 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 ("glMultiTexCoord2dARB");
+ glitz_glx_get_proc_address (thread_info, "glMultiTexCoord2dARB");
context->gl.gen_programs_arb =
(glitz_gl_gen_programs_arb_t)
- glitz_glx_get_proc_address ("glGenProgramsARB");
+ glitz_glx_get_proc_address (thread_info, "glGenProgramsARB");
context->gl.delete_programs_arb =
(glitz_gl_delete_programs_arb_t)
- glitz_glx_get_proc_address ("glDeleteProgramsARB");
+ glitz_glx_get_proc_address (thread_info, "glDeleteProgramsARB");
context->gl.program_string_arb =
(glitz_gl_program_string_arb_t)
- glitz_glx_get_proc_address ("glProgramStringARB");
+ glitz_glx_get_proc_address (thread_info, "glProgramStringARB");
context->gl.bind_program_arb =
(glitz_gl_bind_program_arb_t)
- glitz_glx_get_proc_address ("glBindProgramARB");
+ 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 ("glProgramLocalParameter4dARB");
+ 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 ("glGetProgramivARB");
+ glitz_glx_get_proc_address (thread_info, "glGetProgramivARB");
if (context->gl.get_program_iv_arb) {
context->gl.get_program_iv_arb (GLITZ_GL_FRAGMENT_PROGRAM_ARB,
@@ -261,7 +275,8 @@ glitz_glx_context_make_current (glitz_glx_surface_t *surface)
drawable, context);
if (surface->context->gl.need_lookup)
- glitz_glx_context_proc_address_lookup (surface->context);
+ glitz_glx_context_proc_address_lookup
+ (surface->screen_info->display_info->thread_info, surface->context);
}
static void
diff --git a/src/glitz_glx_extension.c b/src/glitz_glx_extension.c
index 5c11284..af5f2df 100644
--- a/src/glitz_glx_extension.c
+++ b/src/glitz_glx_extension.c
@@ -31,8 +31,6 @@
#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
{ "GLX_ARB_render_texture", GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK },
@@ -78,16 +76,19 @@ _glitz_glx_extension_query_gl (void)
void
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);
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) {
+ 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;
}
diff --git a/src/glitz_glx_format.c b/src/glitz_glx_format.c
index c4c1c0f..0ccb9f1 100644
--- a/src/glitz_glx_format.c
+++ b/src/glitz_glx_format.c
@@ -34,8 +34,6 @@
#include <stdlib.h>
#include <string.h>
-extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
static int
_glitz_glx_format_compare (const void *elem1,
const void *elem2)
@@ -112,15 +110,13 @@ glitz_glx_query_formats_glx12 (glitz_glx_screen_info_t *screen_info)
glitz_format_t format;
XVisualInfo visual_templ;
XVisualInfo *visuals;
- long int mask;
int i, num_visuals;
display = screen_info->display_info->display;
visual_templ.screen = screen_info->screen;
- mask = VisualScreenMask;
- visuals =
- XGetVisualInfo (display, VisualScreenMask, &visual_templ, &num_visuals);
+ visuals = XGetVisualInfo (display, VisualScreenMask,
+ &visual_templ, &num_visuals);
/* Offscreen drawing never supported if GLX is older than 1.3 */
format.drawable.offscreen = 0;
@@ -197,15 +193,14 @@ glitz_glx_query_formats_glx13 (glitz_glx_screen_info_t *screen_info)
glitz_format_t format;
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 =
- _glitz_glx_proc_address.get_fbconfigs (display,
- screen_info->screen,
- &num_configs);
- /* GLX 1.3 is not support, falling back to GLX 1.2 */
+ 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;
return 1;
@@ -214,58 +209,48 @@ glitz_glx_query_formats_glx13 (glitz_glx_screen_info_t *screen_info)
for (i = 0; i < num_configs; i++) {
int value;
- if ((_glitz_glx_proc_address.get_fbconfig_attrib
- (display, fbconfigs[i], GLX_RENDER_TYPE, &value) != 0) ||
+ if ((glx->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);
+ glx->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);
+ glx->get_fbconfig_attrib (display, fbconfigs[i],
+ GLX_DRAWABLE_TYPE, &value);
if (!((value & GLX_WINDOW_BIT) || (value & GLX_PBUFFER_BIT)))
continue;
format.drawable.onscreen = (value & GLX_WINDOW_BIT)? 1: 0;
format.drawable.offscreen = (value & GLX_PBUFFER_BIT)? 1: 0;
- _glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
- GLX_FBCONFIG_ID, &value);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->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);
+ glx->get_fbconfig_attrib (display, fbconfigs[i],
+ GLX_SAMPLES_ARB, &value);
format.multisample.samples = (unsigned short) value;
} else {
format.multisample.supported = 0;
@@ -385,28 +370,26 @@ glitz_glx_get_visual_info_from_format (Display *display,
XVisualInfo *vinfo = NULL;
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 =
- _glitz_glx_proc_address.get_fbconfigs (display, screen, &n_fbconfigs);
+ fbconfigs = glx->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);
+ glx->get_fbconfig_attrib (display, fbconfigs[i],
+ GLX_FBCONFIG_ID, &value);
if (value == fbconfigid)
break;
}
if (i < n_fbconfigs)
- vinfo =
- _glitz_glx_proc_address.get_visual_from_fbconfig (display,
- fbconfigs[i]);
+ vinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]);
if (fbconfigs)
XFree (fbconfigs);
diff --git a/src/glitz_glx_info.c b/src/glitz_glx_info.c
index 5351275..c5864f2 100644
--- a/src/glitz_glx_info.c
+++ b/src/glitz_glx_info.c
@@ -31,6 +31,7 @@
#include "glitz_glxint.h"
+#include <string.h>
#include <dlfcn.h>
glitz_gl_proc_address_list_t _glitz_gl_proc_address = {
@@ -98,61 +99,85 @@ glitz_gl_proc_address_list_t _glitz_gl_proc_address = {
1
};
-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)
+glitz_glx_get_proc_address (glitz_glx_thread_info_t *info, 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 (info->glx.get_proc_address_arb)
+ address = info->glx.get_proc_address_arb ((glitz_gl_ubyte_t *) name);
if (!address) {
- void *dlhand;
+ if (!info->dlhand)
+ info->dlhand = dlopen (info->gl_library, RTLD_LAZY);
- if ((dlhand = dlopen (NULL, RTLD_LAZY))) {
- address = dlsym (dlhand, name);
- dlclose (dlhand);
- }
+ address = dlsym (info->dlhand, name);
}
return address;
}
static void
-glitz_glx_proc_address_lookup (void)
+glitz_glx_proc_address_lookup (glitz_glx_thread_info_t *info)
{
- 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;
+ 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;
+ }
}
#ifdef XTHREADS
@@ -164,26 +189,41 @@ glitz_glx_proc_address_lookup (void)
static int tsd_initialized = 0;
static xthread_key_t info_tsd;
-glitz_glx_thread_info_t *
-glitz_glx_thread_info_get (void)
+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) {
- 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);
+ 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;
- return info;
} else {
void *p;
xthread_get_specific (info_tsd, &p);
- return (glitz_glx_thread_info_t *) 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;
}
#else
@@ -191,25 +231,32 @@ glitz_glx_thread_info_get (void)
/* not thread safe */
static glitz_glx_thread_info_t thread_info = {
NULL,
- 0
+ 0,
+ { 0, 0, 0, 0, 0, 0, 1 },
+ NULL,
+ NULL
};
-glitz_glx_thread_info_t *
-glitz_glx_thread_info_get (void)
+static glitz_glx_thread_info_t *
+glitz_glx_thread_info_get (char *gl_library)
{
- if (!_glitz_glx_proc_address.supported)
- glitz_glx_proc_address_lookup ();
+ 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;
}
#endif
-glitz_glx_display_info_t *
+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 ();
+ 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;
@@ -235,6 +282,17 @@ glitz_glx_display_info_get (Display *display)
}
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)
{
XVisualInfo *vinfo;
@@ -288,7 +346,7 @@ glitz_glx_create_root_context (glitz_glx_screen_info_t *screen_info)
screen_info->root_context.id = 0;
}
- screen_info->root_context.fbconfig = (XID) 0;
+ screen_info->root_context.fbconfig = (XID) 0;
memcpy (&screen_info->root_context.gl,
&_glitz_gl_proc_address,
@@ -349,8 +407,9 @@ glitz_glx_screen_info_get (Display *display,
glPixelStorei (GL_PACK_ALIGNMENT, 4);
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
- glitz_glx_context_proc_address_lookup (&screen_info->root_context);
-
+ 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);
}
@@ -362,3 +421,60 @@ glitz_glx_screen_info_get (Display *display,
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);
diff --git a/src/glitz_glx_pbuffer.c b/src/glitz_glx_pbuffer.c
index 7ca56b8..1274813 100644
--- a/src/glitz_glx_pbuffer.c
+++ b/src/glitz_glx_pbuffer.c
@@ -31,10 +31,8 @@
#include "glitz_glxint.h"
-extern glitz_glx_static_proc_address_list_t _glitz_glx_proc_address;
-
GLXPbuffer
-glitz_glx_pbuffer_create (Display *display,
+glitz_glx_pbuffer_create (glitz_glx_display_info_t *display_info,
GLXFBConfig fbconfig,
glitz_texture_t *texture)
{
@@ -51,12 +49,14 @@ glitz_glx_pbuffer_create (Display *display,
pbuffer_attr[i++] = 0;
return
- _glitz_glx_proc_address.create_pbuffer (display, fbconfig, pbuffer_attr);
+ display_info->thread_info->glx.create_pbuffer (display_info->display,
+ fbconfig, pbuffer_attr);
}
void
-glitz_glx_pbuffer_destroy (Display *display,
+glitz_glx_pbuffer_destroy (glitz_glx_display_info_t *display_info,
GLXPbuffer pbuffer)
{
- _glitz_glx_proc_address.destroy_pbuffer (display, pbuffer);
+ display_info->thread_info->glx.destroy_pbuffer (display_info->display,
+ pbuffer);
}
diff --git a/src/glitz_glx_surface.c b/src/glitz_glx_surface.c
index a0094c4..75e05b1 100644
--- a/src/glitz_glx_surface.c
+++ b/src/glitz_glx_surface.c
@@ -222,7 +222,7 @@ _glitz_glx_surface_create (glitz_glx_screen_info_t *screen_info,
glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
surface->drawable = surface->pbuffer =
- glitz_glx_pbuffer_create (screen_info->display_info->display,
+ glitz_glx_pbuffer_create (screen_info->display_info,
surface->context->fbconfig,
&surface->base.texture);
@@ -325,7 +325,7 @@ _glitz_glx_surface_destroy (void *abstract_surface)
glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
if (surface->pbuffer)
- glitz_glx_pbuffer_destroy (surface->screen_info->display_info->display,
+ glitz_glx_pbuffer_destroy (surface->screen_info->display_info,
surface->pbuffer);
glitz_surface_pop_current (&surface->base);
diff --git a/src/glitz_glxext.h b/src/glitz_glxext.h
index 91da349..82637e8 100644
--- a/src/glitz_glxext.h
+++ b/src/glitz_glxext.h
@@ -94,6 +94,7 @@ typedef XID GLXPbuffer;
#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);
typedef int (* glitz_glx_get_fbconfig_attrib_t)
diff --git a/src/glitz_glxint.h b/src/glitz_glxint.h
index 2ea9747..f073638 100644
--- a/src/glitz_glxint.h
+++ b/src/glitz_glxint.h
@@ -54,6 +54,7 @@ typedef struct _glitz_glx_screen_info_t glitz_glx_screen_info_t;
typedef struct _glitz_glx_display_info_t glitz_glx_display_info_t;
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;
glitz_glx_get_visual_from_fbconfig_t get_visual_from_fbconfig;
@@ -71,6 +72,9 @@ typedef struct _glitz_glx_proc_address_list_t {
typedef struct _glitz_glx_thread_info_t {
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;
struct _glitz_glx_display_info_t {
@@ -131,23 +135,21 @@ struct _glitz_glx_surface {
extern void __internal_linkage
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,
int screen);
extern void *__internal_linkage
-glitz_glx_get_proc_address (const char *name);
+glitz_glx_get_proc_address (glitz_glx_thread_info_t *info, const char *name);
extern glitz_glx_context_t *__internal_linkage
glitz_glx_context_get (glitz_glx_screen_info_t *screen_info,
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,
XID fbconfigid);
@@ -166,22 +168,25 @@ extern glitz_glx_surface_t *__internal_linkage
glitz_glx_context_pop_current (glitz_glx_surface_t *surface);
extern void __internal_linkage
-glitz_glx_context_proc_address_lookup (glitz_glx_context_t *context);
+glitz_glx_context_proc_address_lookup (glitz_glx_thread_info_t *thread_info,
+ glitz_glx_context_t *context);
extern void __internal_linkage
glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info);
extern GLXPbuffer __internal_linkage
-glitz_glx_pbuffer_create (Display *display,
+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 (Display *display,
+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)
slim_hidden_proto(glitz_glx_get_visual_info_from_format)
diff --git a/src/glitz_program.c b/src/glitz_program.c
index 7ba478d..a1e18a7 100644
--- a/src/glitz_program.c
+++ b/src/glitz_program.c
@@ -389,7 +389,7 @@ char *_glitz_fragment_program_programmatic[] = {
"END"
};
-static unsigned int
+static glitz_gl_uint_t
glitz_program_compile_vertex_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
{
@@ -409,10 +409,10 @@ glitz_program_compile_vertex_arb (glitz_gl_proc_address_list_t *gl,
program = 0;
}
- return (unsigned int) program;
+ return program;
}
-static unsigned int
+static glitz_gl_uint_t
glitz_program_compile_fragment_arb (glitz_gl_proc_address_list_t *gl,
char *program_string)
{
@@ -432,7 +432,7 @@ glitz_program_compile_fragment_arb (glitz_gl_proc_address_list_t *gl,
program = 0;
}
- return (unsigned int) program;
+ return program;
}
static int
@@ -468,7 +468,7 @@ _glitz_program_offset (glitz_texture_t *src_texture,
return offset;
}
-static unsigned long
+static glitz_gl_uint_t
glitz_program_compile_simple (glitz_gl_proc_address_list_t *gl,
int offset)
{
@@ -484,7 +484,7 @@ glitz_program_compile_simple (glitz_gl_proc_address_list_t *gl,
return glitz_program_compile_fragment_arb (gl, program_buffer);
}
-static unsigned long
+static glitz_gl_uint_t
glitz_program_compile_vertex_convolution (glitz_gl_proc_address_list_t *gl,
int offset)
{
@@ -500,7 +500,7 @@ glitz_program_compile_vertex_convolution (glitz_gl_proc_address_list_t *gl,
return glitz_program_compile_vertex_arb (gl, program_buffer);
}
-static unsigned long
+static glitz_gl_uint_t
glitz_program_compile_convolution (glitz_gl_proc_address_list_t *gl,
int offset,
int solid_offset)
@@ -538,7 +538,7 @@ glitz_program_compile_convolution (glitz_gl_proc_address_list_t *gl,
return glitz_program_compile_fragment_arb (gl, program_buffer);
}
-static unsigned long
+static glitz_gl_uint_t
glitz_program_compile_programmatic (glitz_programmatic_surface_type_t type,
glitz_gl_proc_address_list_t *gl,
int offset)
@@ -882,3 +882,30 @@ glitz_program_disable (glitz_program_type_t type,
dst->gl->disable (GLITZ_GL_VERTEX_PROGRAM_ARB);
}
}
+
+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]);
+ }
+}
diff --git a/src/glitzint.h b/src/glitzint.h
index 0502f0f..62f6f6c 100644
--- a/src/glitzint.h
+++ b/src/glitzint.h
@@ -185,10 +185,11 @@ typedef enum {
(GLITZ_FRAGMENT_PROGRAM_TYPES * GLITZ_PROGRAMMATIC_SURFACE_NUM)
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_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;
typedef enum {
@@ -598,6 +599,10 @@ glitz_program_disable (glitz_program_type_t type,
glitz_surface_t *dst);
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,
int height);