Texture refrence counting

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Texture refrence counting

Post by omaremad »

Currently in irrlicht if multiple SMaterials share the same texture they dont grab() a reference to it, so the reference count of the texture stays 1, the makes it impossible to know how many SMaterial's are using a texture and there how mny meshes are using it.

This stops a garbage collector written by the user from cleaning up textures.

Im not sure if this needs to be fixed for everyone, but it reduces the available texture management in irrlicht to just deleting all the textures at once or blindly deleting single textures(no way of knowing if they are in use).

Code: Select all

void setTexture(u32 i, ITexture* tex)
		{
			if (i>=MATERIAL_MAX_TEXTURES)
				return;
			TextureLayer[i].Texture = tex;
		}
how about grabbing in here?

SMaterial.h
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

But the user can still set the texture directly using material.TextureLayer[0].Texture = blah?

What happens if they delete the texture because it was not grabbed when they set it in that fashion and then the user attempts to render that material? :oops:

Just kidding, I guess they can just make the Texture member private in SMaterialLayer, just don't forget to do that. :P
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

This is postponed to Irrlicht 2.0 when we clean up all this stuff. Right now it's breaking too many apps.
Post Reply