FBryant87
FBryant87

Reputation: 4614

Cocos2d texture memory usage

I'm using cocos2d and have a 1024x1024 spritesheet.

I load the texture in RGBA4444 format and it consumes 2MB marked as 'gfxAllocateTextureLevel'.

Then when I create CCSprites from the spritesheet it instantly consumes an extra 4MB of memory marked as glsmLoadTextureLevelBuffer.

So 6MB in total, which is quite a lot relative to my app. Is this expected? Does it need to create such a buffer for every spritesheet or even CCSpriteBatchNode? Thanks.

Upvotes: 0

Views: 1411

Answers (2)

Db Xiong
Db Xiong

Reputation: 107

I have the same problem! I load the texture in RGBA8888 format and it consumes 4MB marked as 'gfxAllocateTextureLevel'.

Then when I create CCSprites from the spritesheet it instantly consumes an extra 4MB of memory marked as glsmLoadTextureLevelBuffer.

Upvotes: 0

rsaxvc
rsaxvc

Reputation: 1779

OpelGLES1.1 Spec states:

"The GL stores the resulting texture with internal component resolutions of its own choosing"

=>the GPU/driver may convert your pixels up in size as needed by the GPU (GPU may only natively operate on certain pixel formats, so anything that isn't that will be made into one), so I think you have 2MB of RGBA4444, and 4MB of RGBA8888 of the same sprite sheet.

Upvotes: 1

Related Questions