problem with first use of a copied pipeline layer texture not freeing, subsequent textures do free



Hi,
I'm cc'ing this question to the clutter  mailing list because the cogl mailing list has very little traffic
----

I am either using pipelines incorrectly or found a problem in cogl pipeline
layer code.  Are they really supposed to be treated as immutable after
you've rendered with them?  I just read that in check-in comments and that
is not how I programmed my code.  In this problem case I'm not making a
change after rendering so the immutability is moot.  But changing them like
adding/removing a layer does seem to work with the same pipeline.

The following occurs ONLY on the first Actor I create with a new or copied
pipeline.  All additional actors with a new or copied pipeline do not cause
a leak.

First case: I'm creating a pipeline, setting a texture on layer 0, drawing
with it, then later unreffing the pipeline.  It seems that the pipeline
would be freed but the texture did not because a pipeline layer held a
reference to it.  I inserted a cogl_pipeline_set_layer_texture(pipeline, 0,
NULL) in my code just before unreffing the pipeline and voila the texture
was freed.

In another version of the code I copy a pipeline, setting a texture on
layer 0, drawing with it, then later unreffing the pipeline. It  seems
again that the pipeline would be freed but the texture did not because a
pipeline layer held a reference to it.  I inserted a
cogl_pipeline_set_layer_texture(pipeline, 0, NULL) in my code just before
unreffing the pipeline, but in this case the texture is not unreffed and
freed.  In the routine _cogl_pipeline_set_layer_texture_data() for some
reason for just the first actor and pipeline copy it takes the (new !=
layer) condition and doesn't unref the texture which is done in the else
clause (/* If the original layer we found is currently the authority on
...) for all subsequent actors / pipeline copies.

Unfortunately if you have for the first actor and pipeline a 1024x1024
texture and activate the atlas then you get a 2048x2048 atlas (16Mb of GPU
RAM) that doesn't free up when the actor and pipeline copy is destroyed.

Could anyone help me out here?

Thanks,

Reza


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]