Re: [osg-users] Unref image after apply

2010-04-21 Thread Robert Osfield
Hi Serge,

On Wed, Apr 21, 2010 at 4:31 PM, Serge Lages  wrote:
> I was wondering, if I unref manually my images but also activate the texture
> pool with OSG_TEXTURE_POOL_SIZE, is there any risk that one of my images
> will be unloaded from the graphic card and then it will be impossible to
> load it again because it has been unref ?

Yes there is this danger.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unref image after apply

2010-04-21 Thread Serge Lages
Hi Robert,

I was wondering, if I unref manually my images but also activate the texture
pool with OSG_TEXTURE_POOL_SIZE, is there any risk that one of my images
will be unloaded from the graphic card and then it will be impossible to
load it again because it has been unref ?

Thanks !

On Wed, Apr 21, 2010 at 10:06 AM, Serge Lages  wrote:

> OK thank you Robert, I'll unref manually my images.
>
> Cheers,
>
>
> On Tue, Apr 20, 2010 at 8:16 PM, Robert Osfield 
> wrote:
>
>> Hi Serge,
>>
>> Enable the unref image after apply in your case is a bit awkward as,
>> as you have found, the mechanism assumes that all contexts will
>> require the texture.
>>
>> Another way around the issue is to use the texture object pool to keep
>> a cap on the memory usage on the driver and GPU side.  Another route
>> migt be to make areAllTextureObjectsLoaded() virtue or have a callback
>> for it so you can customize the behavior.
>>
>> Robert.
>>
>> On Tue, Apr 20, 2010 at 6:21 PM, Serge Lages 
>> wrote:
>> > Hi Robert and all,
>> > Another question related to multi-screen/multi-context applications
>> (yes,
>> > still one...). I am currently trying to save some memory on my
>> application,
>> > so I want some of my textures to be uploaded in the graphic card and
>> release
>> > it from the classic RAM, that's why I set setUnRefImageDataAfterApply to
>> > true.
>> > But looking at Texture2D.cpp, here is the conditions to unref an image :
>> > state.getMaxTexturePoolSize()==0 &&
>> > _unrefImageDataAfterApply &&
>> > areAllTextureObjectsLoaded() &&
>> > image->getDataVariance()==STATIC
>> > I am currently having troubles with the areAllTextureObjectsLoaded
>> > condition, it checks if all the available contexts have uploaded the
>> > texture. The problem here is that my texture is designed only for one of
>> my
>> > screens, so it's applied for only one context, so this condition is
>> always
>> > false and the image is never released.
>> > Am I doing something wrong ? And is there any way to force my image to
>> be
>> > unref ? The only solution is a custom callback setting the image to NULL
>> > after a first apply ?
>> > Thanks !
>> > --
>> > Serge Lages
>> > http://www.tharsis-software.com
>> >
>> > ___
>> > osg-users mailing list
>> > osg-users@lists.openscenegraph.org
>> >
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
>
> --
> Serge Lages
> http://www.tharsis-software.com
>



-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unref image after apply

2010-04-21 Thread Serge Lages
OK thank you Robert, I'll unref manually my images.

Cheers,

On Tue, Apr 20, 2010 at 8:16 PM, Robert Osfield wrote:

> Hi Serge,
>
> Enable the unref image after apply in your case is a bit awkward as,
> as you have found, the mechanism assumes that all contexts will
> require the texture.
>
> Another way around the issue is to use the texture object pool to keep
> a cap on the memory usage on the driver and GPU side.  Another route
> migt be to make areAllTextureObjectsLoaded() virtue or have a callback
> for it so you can customize the behavior.
>
> Robert.
>
> On Tue, Apr 20, 2010 at 6:21 PM, Serge Lages 
> wrote:
> > Hi Robert and all,
> > Another question related to multi-screen/multi-context applications (yes,
> > still one...). I am currently trying to save some memory on my
> application,
> > so I want some of my textures to be uploaded in the graphic card and
> release
> > it from the classic RAM, that's why I set setUnRefImageDataAfterApply to
> > true.
> > But looking at Texture2D.cpp, here is the conditions to unref an image :
> > state.getMaxTexturePoolSize()==0 &&
> > _unrefImageDataAfterApply &&
> > areAllTextureObjectsLoaded() &&
> > image->getDataVariance()==STATIC
> > I am currently having troubles with the areAllTextureObjectsLoaded
> > condition, it checks if all the available contexts have uploaded the
> > texture. The problem here is that my texture is designed only for one of
> my
> > screens, so it's applied for only one context, so this condition is
> always
> > false and the image is never released.
> > Am I doing something wrong ? And is there any way to force my image to be
> > unref ? The only solution is a custom callback setting the image to NULL
> > after a first apply ?
> > Thanks !
> > --
> > Serge Lages
> > http://www.tharsis-software.com
> >
> > ___
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Unref image after apply

2010-04-20 Thread Robert Osfield
Hi Serge,

Enable the unref image after apply in your case is a bit awkward as,
as you have found, the mechanism assumes that all contexts will
require the texture.

Another way around the issue is to use the texture object pool to keep
a cap on the memory usage on the driver and GPU side.  Another route
migt be to make areAllTextureObjectsLoaded() virtue or have a callback
for it so you can customize the behavior.

Robert.

On Tue, Apr 20, 2010 at 6:21 PM, Serge Lages  wrote:
> Hi Robert and all,
> Another question related to multi-screen/multi-context applications (yes,
> still one...). I am currently trying to save some memory on my application,
> so I want some of my textures to be uploaded in the graphic card and release
> it from the classic RAM, that's why I set setUnRefImageDataAfterApply to
> true.
> But looking at Texture2D.cpp, here is the conditions to unref an image :
> state.getMaxTexturePoolSize()==0 &&
> _unrefImageDataAfterApply &&
> areAllTextureObjectsLoaded() &&
> image->getDataVariance()==STATIC
> I am currently having troubles with the areAllTextureObjectsLoaded
> condition, it checks if all the available contexts have uploaded the
> texture. The problem here is that my texture is designed only for one of my
> screens, so it's applied for only one context, so this condition is always
> false and the image is never released.
> Am I doing something wrong ? And is there any way to force my image to be
> unref ? The only solution is a custom callback setting the image to NULL
> after a first apply ?
> Thanks !
> --
> Serge Lages
> http://www.tharsis-software.com
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Unref image after apply

2010-04-20 Thread Serge Lages
Hi Robert and all,

Another question related to multi-screen/multi-context applications (yes,
still one...). I am currently trying to save some memory on my application,
so I want some of my textures to be uploaded in the graphic card and release
it from the classic RAM, that's why I set setUnRefImageDataAfterApply to
true.

But looking at Texture2D.cpp, here is the conditions to unref an image :

state.getMaxTexturePoolSize()==0 &&
_unrefImageDataAfterApply &&
areAllTextureObjectsLoaded() &&
image->getDataVariance()==STATIC

I am currently having troubles with the areAllTextureObjectsLoaded
condition, it checks if all the available contexts have uploaded the
texture. The problem here is that my texture is designed only for one of my
screens, so it's applied for only one context, so this condition is always
false and the image is never released.

Am I doing something wrong ? And is there any way to force my image to be
unref ? The only solution is a custom callback setting the image to NULL
after a first apply ?

Thanks !

-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org