(The Unofficial) PopCap Framework Developer Board
July 25, 2017, 10:44:38 AM CEST *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home   Forum   Help Calendar Contact Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: DumpProgramInfo() - int aMemorySize = aSortedItr->first returns double size  (Read 4779 times)
0 Members and 1 Guest are viewing this topic.
DbIMKA
Newbie
*
Posts: 9


« on: November 28, 2011, 06:32:54 PM CET »

Hi,

I'm trying to debug the memory usage and noticed a weird thing. Bunch of my 32-bit images are reported as using double amount of memory, although I'm only loading them once.
Example from the report:

image resolution 1920 x 1080, 16,650,240 bytes  // where does this 16Mb come from???
       1920 * 1080 * 4 bytes per pixel = 8,294,400, but the line #1361 (see below) of the SexyAppBase.cpp gives me 16 megs
int aMemorySize = aSortedItr->first;

the rest of the report on that image:
   mBits 8,294,400           Texture A8R8G8B8 8,355,840

I've checked, a whole lot of images are calculated this way, but not all of them!

Is this because of a large texture size, or the way these textures are stored in memory for some reason?

Another example of the "double size storage" texture (one of the others, which show double size in the first column of the report, too)?

resolution: 100 x 100 105,536 bytes // where did it come from?!
mBits 40,000
Texture A8R8G8B8 65,536
HasAlpha
HasTrans

How do I avoid spending so much memory on the textures??

Thanks a lot for your help!
Logged
Puzzler
Global Moderator
Full Member
*****
Posts: 231


WWW
« Reply #1 on: November 28, 2011, 07:25:44 PM CET »

The texture itself should be a power of two. Check google for "texture size".
Logged

Lead software engineer, Rumbic Studio
DbIMKA
Newbie
*
Posts: 9


« Reply #2 on: November 28, 2011, 07:46:53 PM CET »

Thanks a lot, Puzzler!

If I already got bunch of a large textures, which are not power of 2, and they are used as 2D sprites without scaling, is there any technique/code lib, which would take care of making my textures power of 2 and still knew their 2D sizes when outputting them to the screen?

Or basically the only way to save most of the wasted video memory would be to rewrite the code to use the power of 2 pieces, make artist cut at least the largest textures to the power of 2 manually and have this large headache to make it all work again? I understand my mistake, but is there an easier way out of it, you guys think?
Logged
DbIMKA
Newbie
*
Posts: 9


« Reply #3 on: November 28, 2011, 08:02:40 PM CET »

JPoad once wrote:
...but the framework will subdivide textures into pow^2 sizes if required.

Does this stand true? Why, then, I get this problem?
Logged
Puzzler
Global Moderator
Full Member
*****
Posts: 231


WWW
« Reply #4 on: November 28, 2011, 08:39:23 PM CET »

Framework subdivide textures into pow^2 sizes, and for example:
1920 x 1080 - this is 4 textures with 1024x1024 pixels
Logged

Lead software engineer, Rumbic Studio
Pages: [1]   Go Up
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
SimplePortal 2.3.3 © 2008-2010, SimplePortal