Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: TextureFactory.DeleteTexture() bug!  (Read 1165 times)
Toaster
Community Member
*
Posts: 378


WWW
« on: March 06, 2010, 05:40:59 PM »

The bug happens when you load a texture twice. Since the texture is the same it only loads it once but when you go to delete that texture you'll find it actually loads it twice..

For instance, I have two planets both of them share a texture, but I could have a different texture for that planet, so I load the texture twice. Then when I go to clean up for a new level. I delete that texture twice and then dump the results to debug log and this is what I get: 
Code:
Loads this texture:
Planet 1:
03-06-2010 14:09:36 | TEXTURE MANAGER : Loading of 'C:\Users\Toaster\Desktop\Space MMORTS\TestClient\bin\x86\Debug\..\Media\Textures\Planet\EarthEmissive.dds' successful 'Aomair_GlowTex' on index 21

Planet 2 uses the same texture.

Deleting the textures twice(no way of checking if its loading that texture twice) results in this:

03-06-2010 14:09:47 | Slot 25 : Texture 'Korubo_GlowTex' Filename 'C:\Users\Toaster\Desktop\Space MMORTS\TestClient\bin\x86\Debug\..\Media\Textures\Planet\EarthEmissive.dds'  Format '827611204' Size '2048x1024'

In between each loading time it adds a texture resulting in 1 mb's of vram lost. Now imagine if I had more then one planet with several planets sharing the same textures. I would lose a lot more then just 1 mb of vram.

I talked with another TV'er and he did a quick test and found that he could duplicate it. I imagine I could delete the texture by calling TexFac.DeleteTexture(25); but I have no way of knowing what texture to delete..

Does anyone else suffer from this problem?

-Toaster
Logged

Visit my site at: Unknown Abstraction
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #1 on: March 07, 2010, 10:50:57 AM »

As far as I know, TV does not load into memory a texture more than once if a texture in memory exists with the same path (ie loaded from same file). At least that's the way it used to be, maybe something changed, correct me if I'm wrong. Try loading 50 textures of the same path and watch memory. If that is the case, then it's a bug that it deletes only one texture it finds loaded instead of all.

How are you deleting the texture? Are you not using TexFac.DeleteTexture?

Also you can try TexFac.DeleteTexture(PlanetMesh.GetTexture) maybe..

Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
WEst
Customers
Community Member
*****
Posts: 945

Daniel Martinek


WWW
« Reply #2 on: March 07, 2010, 11:14:32 AM »

The problem occurs when you load a texture twice but specify two different names, the engine will load it only once but you will get two different textures IDs. Now if you delete BOTH of these IDs the texture will still be in memory, so it seems that there is a problem with internal ref count or something.
Logged

Greetings

Daniel Martinek
Technical Director
23 Volts
Brac
Customers
Community Member
*****
Posts: 367


« Reply #3 on: March 07, 2010, 11:40:18 AM »

Affirmative. Can be easily reproduced. It is most def. a bug
Logged
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #4 on: March 07, 2010, 12:53:36 PM »

Oh I see, that is a bug. So you mean to say right now it's impossible to delete textures at all, or what? I never profiled my VRAM before, but you'd think that something like this would have been noticed since ages ago since all textures you load more than once stay in memory forever so it would bloat. I might try that out myself too.
« Last Edit: March 07, 2010, 12:56:35 PM by Lenn » Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
SylvainTV
Administrator
Community Member
*****
Posts: 4944


WWW
« Reply #5 on: March 08, 2010, 05:45:45 PM »

There were indeed several bugs with this "feature" :
1. The returned Id was the Id of the first texture created, not the new id used for the new name.
2. The reference count and the internal id of the texture with the new name didn't get initialized correctly.
3. The new name was never entered correctly in the texture name database..

I fixed all that.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
scottpipper
Customers
Community Member
*****
Posts: 82


« Reply #6 on: April 12, 2010, 12:04:43 PM »

Any date for an update release?, Im working on a large Landscape, 1.000 X 500 Kmt at 1 meter image resolution, I need to unload and reload  textures, if I use texture delete, I dont get the right textures when reloading them, (the landscape chunks don't get the recently loaded texture, but some random one)

 
Logged
tom_namibia
Customers
Community Member
*****
Posts: 176


WWW
« Reply #7 on: April 13, 2010, 01:28:10 PM »

Yes, I also need this fix. Any date for a release?
I was also running out of vmem irregulary, now I know why.

Tom
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4944


WWW
« Reply #8 on: April 20, 2010, 06:00:14 AM »

Working on a quite big change for the moment (rendersurfaces), it could be a while before the engine is stable again.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks