cogl-texture: Make the list of registered types global, not per-context

If we make this per-context and create two Cogl contexts, some types
won't re-register, and we'll be in a broken state where some types will
be considered not to be texture types.

https://bugzilla.gnome.org/show_bug.cgi?id=693696

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 567f049d20554bb8ea4e40fa5e72a9fd0bbd409e)
This commit is contained in:
Jasper St. Pierre 2013-02-12 17:55:45 -05:00 committed by Neil Roberts
parent a60f16116d
commit 66c75f9a9d
3 changed files with 4 additions and 14 deletions

View File

@ -243,10 +243,6 @@ struct _CoglContext
CoglBool current_gl_dither_enabled;
CoglColorMask current_gl_color_mask;
/* List of types that will be considered a subclass of CoglTexture in
cogl_is_texture */
GSList *texture_types;
/* Clipping */
/* TRUE if we have a valid clipping stack flushed. In that case
current_clip_stack will describe what the current state is. If

View File

@ -179,8 +179,6 @@ cogl_context_new (CoglDisplay *display,
context->feature_flags = 0;
context->private_feature_flags = 0;
context->texture_types = NULL;
context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_UNKNOWN;
memset (context->winsys_features, 0, sizeof (context->winsys_features));
@ -558,8 +556,6 @@ _cogl_context_free (CoglContext *context)
_cogl_bitmask_destroy (&context->enable_custom_attributes_tmp);
_cogl_bitmask_destroy (&context->changed_bits_tmp);
g_slist_free (context->texture_types);
if (context->current_modelview_entry)
cogl_matrix_entry_unref (context->current_modelview_entry);
if (context->current_projection_entry)

View File

@ -78,12 +78,12 @@ cogl_texture_error_quark (void)
* abstract class manually.
*/
static GSList *_cogl_texture_types;
void
_cogl_texture_register_texture_type (const CoglObjectClass *klass)
{
_COGL_GET_CONTEXT (ctxt, NO_RETVAL);
ctxt->texture_types = g_slist_prepend (ctxt->texture_types, (void *) klass);
_cogl_texture_types = g_slist_prepend (_cogl_texture_types, (void *) klass);
}
CoglBool
@ -92,12 +92,10 @@ cogl_is_texture (void *object)
CoglObject *obj = (CoglObject *)object;
GSList *l;
_COGL_GET_CONTEXT (ctxt, FALSE);
if (object == NULL)
return FALSE;
for (l = ctxt->texture_types; l; l = l->next)
for (l = _cogl_texture_types; l; l = l->next)
if (l->data == obj->klass)
return TRUE;