Quantcast
Channel: Adobe Community : Popular Discussions - AIR Development
Viewing all articles
Browse latest Browse all 24121

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

$
0
0

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.

 

                    privatefunction 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;

                    }

                    privatefunction 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?


Viewing all articles
Browse latest Browse all 24121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>