Skip to main content
Participating Frequently
July 10, 2013
Question

Having issues with ETC textures that don't happen with PVRTC or uncompressed.

  • July 10, 2013
  • 2 replies
  • 2399 views

We've used AIR successfully to build an app and deploy it on the iPad, but we're having a lot of difficulty going to other mobile platforms. Briefly, our app is texture-heavy so we can't use uncompressed textures. That also means we have to be smart about which textures are loaded, frequently loading and unloading textures as they come in and out of use.

However, whenever the app is run on devices that use ETC textures (so far we've tried Kindle HD and Nexus) rather than PVRTC, enough loads and unloads will cause it to crash. Those same devices won't crash when loading and unloading uncompressed textures. This is not a viable solution in general because sometimes many textures will be on the screen at once.

To eliminate complicating factors, I've reduced the test down to this code, which will crash when using ETC textures, but not with any others. Objects that don't come from Flash libraries can be found in Starling.

                    private function upload_unload_data(data:ByteArray):void {

                              var context:Context3D = Starling.context;

                              var atfData:AtfData = new AtfData(data);

                              var nativeTexture:flash.display3D.textures.Texture = context.createTexture(

                                        atfData.width, atfData.height, atfData.format, false);

                              nativeTexture.uploadCompressedTextureFromByteArray(data,0,false);

                              nativeTexture.dispose();

                              nativeTexture = null;

                    }

                    private function upload_unload():void {

                              var atf_bytes:ByteArray = new ByteArray();

                              var file:File = File.applicationDirectory.resolvePath("./assets/atlas.atf");

 

                              var fs:FileStream = new FileStream();

                              fs.open(file, FileMode.READ);

                              fs.readBytes(atf_bytes, 0, fs.bytesAvailable);

                              fs.close();

 

                              upload_unload_data(atf_bytes);

 

                              setTimeout(upload_unload, 0);

                    }

I can't figure out why this is happening. My best guess is a leak, based on the behavior, but I couldn't find any mention of a leak on the web (if you google this problem, all you'll see is me asking the question on the Starling forums and getting no response). I would imagine a leak of this size couldn't creep by unnoticed, so I'm doubting my guess. Scout doesn't show any leakage either.

What's going on here?

This topic has been closed for replies.

2 replies

July 12, 2013

I am having the exact same problem. The solution at my office was to wait for the next version of AIR to be released.

Adobe Employee
July 11, 2013

Could you please provide image used to create atf, .atf, command to create atf. Also, which version of gaming sdk and platform(Win/Mac) you are using? This will help us to reproduce the issue.

-Nimit

Participating Frequently
July 11, 2013

Used png2atf with the -c option to create the compressed version, without -c to create the uncompressed version; this is all in the gaming SDK 1.1. I'm developing on a Mac, and the png2atf command is also run on the Mac.

I don't think I can provide the source images, but they have some areas of transparency in them, if that makes a difference. All of our atlases seem to have this problem, so a specific image probably wouldn't be much help.

Adobe Employee
July 16, 2013

I have made a sample project and things are working fine. Please download the project from https://www.dropbox.com/s/ccfmt78vffqwa44/ATF.zip. Also, could you please update if I am missing anything while reproducing the issue.

Regards,

Nimit