static void set_shader_state (CoglPipeline *pipeline, CoglPipelineShaderState *shader_state) { _cogl_object_set_user_data (COGL_OBJECT (pipeline), &shader_state_key, shader_state, destroy_shader_state); }
void cogl_object_set_user_data (CoglObject *object, CoglUserDataKey *key, void *user_data, CoglUserDataDestroyCallback destroy) { _cogl_object_set_user_data (object, key, user_data, (CoglUserDataDestroyInternalCallback)destroy); }
void _cogl_texture_associate_framebuffer (CoglHandle handle, CoglFramebuffer *framebuffer) { CoglTexture *tex = COGL_TEXTURE (handle); static CoglUserDataKey framebuffer_destroy_notify_key; /* Note: we don't take a reference on the framebuffer here because * that would introduce a circular reference. */ tex->framebuffers = g_list_prepend (tex->framebuffers, framebuffer); /* Since we haven't taken a reference on the framebuffer we setup * some private data so we will be notified if it is destroyed... */ _cogl_object_set_user_data (COGL_OBJECT (framebuffer), &framebuffer_destroy_notify_key, tex, _cogl_texture_framebuffer_destroy_cb); }
static void set_shader_state (CoglPipeline *pipeline, CoglPipelineShaderState *shader_state) { if (shader_state) { shader_state->ref_count++; /* If we're not setting the state on the template pipeline then * mark it as a usage of the pipeline cache entry */ if (shader_state->cache_entry && shader_state->cache_entry->pipeline != pipeline) shader_state->cache_entry->usage_count++; } _cogl_object_set_user_data (COGL_OBJECT (pipeline), &shader_state_key, shader_state, destroy_shader_state); }