Vram question(s)

For questions about using Classic.

Post » Fri Apr 09, 2010 9:30 am

Ok two questions.
First off if I have a base image on a sprite that is power of two, will it still take up the same amount of vram if its re-sized bigger in the layout?

Second is vram on a distort map.
If you tick show fps, it will also show vram, but it looks like there's no change what so ever on a distort map, even with a large map (columns/ rows).

So the question is, is this really not taking up much memory, or is that reading off?
Image Image
Posts: 7,226
Reputation: 60,980

Post » Fri Apr 09, 2010 9:35 am

[quote="newt":2evejbdf]First off if I have a base image on a sprite that is power of two, will it still take up the same amount of vram if its re-sized bigger in the layout?[/quote:2evejbdf]

Yeah it will take the same amount of Vram if resized bigger... I made a simple black texture. 128x128 and resized it to 99999x99999, and each time it took up 0.06mb of vram.
Posts: 118
Reputation: 1,336

Post » Fri Apr 09, 2010 11:39 am

There's more involved, but to keep it simple and imaginable:

Think of the screen as a canvas. This canvas is stored in the vram and doesn't change (unless you switch resolution, where everything is rearranged, but let's forget about it now). Now everything is drawn to that one canvas.

Let's say, that canvas is 1280x720. Whatever you draw now is clipped to that extend. A 20000x20000 image will only take up 1280x720. It's the same as using a paint program. You set up a canvas and draw to it, and nothing will be drawn outside that canvas.

BUT, the sources need to be placed in vram, too. So, if you place an image with 128x128, it will consume exactly the space needed for 128x128, no matter how large you draw it to the output canvas. The same applies if you draw it smaller. It will still consume the space for 128x128, because the source doesn't change at all.

It's a bit different with vertex data. These are also stored in vram. But they don't use much space. Again to keep it simple, let's forget about finer details. There are 3 informations per vertex point (x, y, z) Even if they were of double precision, they would only need 24 bytes per point. A sprite with 10x10 vertex points would consume ~0.002 mb (with single precision it would be 0.001 mb). Of course there are overheads, but basically that's it. Calculating the points (distorting the source image while drawing to the output canvas) is a concern, as it takes more gp time than just drawing the source image.

Of course, this is a simplified image of what is really going on, but this makes it easier to understand, I think.
Posts: 1,820
Reputation: 8,242

Post » Fri Apr 09, 2010 1:19 pm

That's a good summary, but the vertex stuff probably isn't worth worrying about. Vertices are actually only stored temporarily (they're re-sent every frame), not in permanent texture memory, so it works a bit differently. You only need to worry about textures.
Scirra Founder
Posts: 22,821
Reputation: 176,096

Post » Fri Apr 09, 2010 2:30 pm

... and of course the oblivious. A re-sized (scaled up) image will be more blurry as you increase in size. So there is no free lunch. :-)
I have done this to get a slightly larger image with out taking the next vram hit.
Posts: 529
Reputation: 7,147

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests