Search code examples
iosmemory-managementcocos2d-iphonetexturepacker

loading Animations with RGBA8888 and RGBA4444 showing no difference in memory usage, platform cocos2D & iOS


plateform -> cocos2D, iOS

Step1: Loading animations from FileName.pvr.ccz(TexturePacker) with ImageFormat="RGBA8888" Shows memory usage in x-code Instruments 10.0 MB.

Step1: Loading animations from FileName.pvr.ccz(TexturePacker) with ImageFormat="RGBA4444" Shows memory usage in x-code Instruments 10.0 MB.

Question -> why its not showing any difference in Memory Usage while using lower ImageFormat = "RGBA4444" instead of higher ImageFormat = "RGBA8888"?

TexturePacker file size = 2047 * 1348


Solution

  • I found this error cause my memory size same in both format:-http://www.cocos2d-iphone.org/forum/topic/31092.

    In CCTexturePVR.m ->

                // Not word aligned ?
                if( mod != 0 ) {
    
                    NSUInteger neededBytes = (4 - mod ) / (bpp/8);
                    printf("\n");
                    NSLog(@"cocos2d: WARNING. Current texture size=(%tu,%tu). Convert it to size=(%tu,%tu) in order to save memory", _width, _height, _width + neededBytes, _height );
                    NSLog(@"cocos2d: WARNING: File: %@", [path lastPathComponent] );
                    NSLog(@"cocos2d: WARNING: For further info visit: http://www.cocos2d-iphone.org/forum/topic/31092");
                    printf("\n");
                }
    

    its cocos2d or iOS bug which can be handle by adjusting pvr.ccz size Size dimension should be divisible by 4 but not the Power Of two. it will resolve bug and get expected memory difference for Both Format