diff options
author | Neil Roberts <neil@linux.intel.com> | 2011-06-30 13:39:48 +0100 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2011-07-13 12:30:07 +0100 |
commit | d69d49fada9eb18ca76f6dc74657767e61293c74 (patch) | |
tree | c1a6e66038d7309b9e4ffa1d6bd9c5374ea4f9aa /cogl/cogl-pipeline-private.h | |
parent | 221850eca9d825b6e4b88cd3e45d5731602f2352 (diff) | |
download | cogl-d69d49fada9eb18ca76f6dc74657767e61293c74.tar.gz |
pipeline: Unify how the backends store private data
Previously the fragends had a separate private data pointer which was
used by the GLSL and ARBfp fragends to store a tiny struct containing
a single pointer to the ref-counted shader state. The space for the
private data pointer is reserved in all of the pipelines for all of
the potential backends. The vertends and progends however did this
differently by directly storing the pointer to the ref counted data
using cogl_object_set_user_data. This patch unifies the different
methods so that they all use cogl_object_set_user_data and the
fragends don't bother with the separate tiny allocation for the
private data. The private data pointer array has been removed from
CoglPipeline and the corresponding fragend virtual to free the private
data has also been removed because this can instead be done with the
destroy notify from the object user data.
The variable names used have been unified so that all of the vertends
and fragends name their data struct CoglPipelineShaderState and use a
variable called shader_state to refer to it. The progend uses
CoglPipelineProgramState and a variable called program_state.
This should also fix two potential bugs. the ARBfp fragend was
apprently leaking a reference to the private state when it creates the
private data because it was adding a reference before stroring the
pointer to the newly allocated data but the ref count is already set
to 1 on creation. The other potential bug is that the free function
for CoglPipeline was only calling the free_priv virtual for the
currently used fragend of the pipeline. The design of the fragends is
meant to allow a pipeline to have multiple fragend priv datas because
a child pipeline could be attaching its fragend data to the ancestor
and its allowed to pick a different fragend.
Diffstat (limited to 'cogl/cogl-pipeline-private.h')
-rw-r--r-- | cogl/cogl-pipeline-private.h | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h index ba0fabf2..35d05e7d 100644 --- a/cogl/cogl-pipeline-private.h +++ b/cogl/cogl-pipeline-private.h @@ -649,10 +649,6 @@ struct _CoglPipeline * pipeline in comparison to its parent. */ unsigned long differences; - /* The fragment processing backends can associate private data with a - * pipeline. */ - void *fragend_privs[COGL_PIPELINE_N_FRAGENDS]; - /* Whenever a pipeline is modified we increment the age. There's no * guarantee that it won't wrap but it can nevertheless be a * convenient mechanism to determine when a pipeline has been @@ -704,17 +700,6 @@ struct _CoglPipeline /* bitfields */ - /* A pipeline can have private data associated with it for multiple - * fragment processing backends. Although only one backend is - * associated with a pipeline the backends may want to cache private - * state with the ancestors of other pipelines and those ancestors - * could currently be associated with different backends. - * - * Each set bit indicates if the corresponding ->fragend_privs[] - * entry is valid. - */ - unsigned int fragend_priv_set_mask:COGL_PIPELINE_N_FRAGENDS; - /* Weak pipelines don't count as dependants on their parents which * means that the parent pipeline can be modified without * considering how the modifications may affect the weak pipeline. @@ -771,8 +756,6 @@ typedef struct _CoglPipelineFragend void (*layer_pre_change_notify) (CoglPipeline *owner, CoglPipelineLayer *layer, CoglPipelineLayerState change); - - void (*free_priv) (CoglPipeline *pipeline); } CoglPipelineFragend; typedef struct _CoglPipelineVertend |