VRAM memory management example

Post your own tutorials, guides and demos.

Post » Mon May 10, 2010 9:50 pm

It's really quite easy. Just put any objects that you want to be dynamically loaded into vram onto another layout and make the objects global.

Run the "Layout 1" layout and watch the vram usage.
keys:
1,q to create and destroy the oval bg.
2,w to create and destroy the rectangle bg.

In contrast run the "Textures" layout and see how even though both bgs are destroyed the vram usage remains 4 MB.

cap req. 0.99.84
B
84
S
27
G
70
Posts: 4,933
Reputation: 49,558

Post » Mon May 10, 2010 10:29 pm

Nice. This should go on the wiki, now that you're an editor! :)

Edit: the objects from a different layout don't need to be global. All global means is the object won't be destroyed upon leaving the layout and it shows up in all event sheets in the editor.
Moderator
B
91
S
32
G
33
Posts: 3,005
Reputation: 27,527

Post » Tue May 11, 2010 3:42 am

That's... Actually very clever. I never really though of that technique.

Now, how to apply it in order to 'swap out' different sets of textures in a single layout... Like, you move from one area to another, and the textures of the area you go out from are unloaded, and the textures from the area you go in are loaded.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Tue May 11, 2010 9:30 am

Another way to do it: After destroying an object, Unload the textures for the layout you are in. It will flush the destroyed objects from the VRAM while keeping everything else intact.
B
17
S
8
G
4
Posts: 137
Reputation: 3,171

Post » Wed May 12, 2010 11:31 am

It's interesting, thanks.

Daize : thank for this technics too.

Arima : thank you for the informations about global ;).
B
2
S
1
G
2
Posts: 23
Reputation: 846


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests