How is geometry stored in vram?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Noiecity
Posts: 396
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

How is geometry stored in vram?

Post by Noiecity »

How is geometry stored in irrlicht? For example, if I load hundreds of models into ram, but don't render them, will they never be uploaded to vram? And if I render them all, do they stay permanently in vram until I manually clear them? Or does it only access ram every time it renders and then it no longer remains in vram? I'm not sure about this
Irrlicht is love, Irrlicht is life, long live to Irrlicht
CuteAlien
Admin
Posts: 10034
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How is geometry stored in vram?

Post by CuteAlien »

If you don't render they won't be uploaded. IMesh/IMeshBuffer have a function setHardwareMappingHint. When using EHM_NEVER it will send the data over the bus each frame. Which can make sense for animated meshes which are changed each frame on CPU or very small meshes. Which seems to be even default.. which is generally a bad idea. As nearly always you want EHM_STATIC - then it just stays on GPU. There's also dynamic and stream - but those are all really just hints for the hardware and it depends on the driver if it cares about those in any way.

Things always stay on GPU memory until it needs more memory and then decides what it kicks out (that's where those hints probably come into effect - but that's just me guessing).

So... generally - overload the default Irrlicht hint after loading static mesh. And yeah, I'm a bit surprised this is still default... now wondering if I should change that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Noiecity
Posts: 396
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: How is geometry stored in vram?

Post by Noiecity »

Thanks for the information, I intend to use static geometries to simulate the shadows, I'm just worried that the vram will overload or something, it's an isometric game with loading screens, and from what you said, now I intend to clean the vram when moving from one city to another or something like that.

Since it is an isometric game, I can simulate the shadow gaining transparency as the pointlight approaches...
Irrlicht is love, Irrlicht is life, long live to Irrlicht
Post Reply