Image sizes.

Monkey Targets Forums/Android/Image sizes.

Grover(Posted 2012) [#1]
Not sure if this has been documented anywhere. I have been building android versions of our game, and trying to meet quite old versions of Android (version 8 - 2.2 I think it is). I came across a little gotcha, but not really a gotcha.

I had to make all my textures nice 'power of 2' sized. I should have remembered this from my OGL days, but forgot. The artifacts that were visible is the texture auto pads out to a 'power of 2' and fills with just memory rubbish.

I went through and fixed the sizes and they were all nicely cleaned up. On this topic, and performance related, does anyone know of memory alignment for graphics plays an important role on hardware for Android. Many of the systems I have worked on the past benefit _massively_ from using specific memory size boundaries (PS2 was 128bit, GBA & DS 64 bit, PC 32 bit etc). On many of these devices, a alignment miss can cause quite a substantial multicycle stall. Again I'll probably find out in my tests over the next few days, but I would love to hear peoples own experience in this area.

Cheers,
Dave


skid(Posted 2012) [#2]
Monkey batches sequential drawimages that don't change source texture or GL state so the best / only optimization required is to group images from same layer onto 1024x1024 or similar cell sheets.

This is a bit tricky as each cell will need to be aligned on a particular mip boundary and include a frame / bleed of a number of pixels depending on filtering and scaling requirements but can deliver a significant performance boost.


AdamRedwoods(Posted 2012) [#3]
the Android dev kit has a zipalign program, not sure if this solves the problem as I've never used it. It may be automatic with Ant, haven't checked.


Grover(Posted 2012) [#4]
skid - so if I make sure my images all fit into 1024 x 1024 this will help a fair bit. Is it worth using a single atlas?

Adam - I didnt know about this, will check it out. Could be useful
Thanks for the help.

Cheers,
Dave