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



Hi Reza,

It seems that the backend will keep a reference to the last pipeline
used :

https://git.gnome.org/browse/cogl/tree/cogl/driver/gl/cogl-pipeline-ope
ngl.c#n1390

My understanding is that this is done to limit the amount of state that
needs to be flushed onto the driver for every pipeline you draw with.

I suppose if you draw one more time with a different pipeline, it would
get rid of that reference and dispose the texture attached to it.

As far as I know, pipelines are not immutable. Although you might want
to pretend they are for example if you are deriving for a complex
pipeline with many copies on which you just change one property. 

Cheers,

-
Lionel

On Mon, 2016-04-18 at 16:22 -0700, Reza Ghassemi wrote:
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
_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list


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