GPU memory issue with Google Pixel phones

Hi all,

I have a live game (‘storm wars’) running on 4 platforms including android currently, using Unity 5.4.4 p2.

The game works fine on all of the android devices I have tested it on (including many older devices such as the galaxy s3), but for some reason a particular scene crashes only on the google pixel / google pixel XL. From the logcat files, I am getting the following error allocating when trying to load a series of rather large textures, including at least one 2048x2048 one.

<sharedmem_gpuobj_alloc:1923>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory

I understand this indicates the GPU has run out of RAM, but what makes no sense is why the scene works perfectly fine on an old Galaxy S3 and hundreds of other devices, but not on the latest google phone. Is the google pixel’s GPU gimped somehow? Could there be something else going on here? Any ideas on what I could try besides downgrade the resolution of textures? I am currently using EC2 compression and OpenGLES 2, and loading the textures at runtime from a resource bundle.

I don’t know what’s special about the Pixel XL. Did you check dumpsys meminfo?

Not specific to the Pixel phone: are these textures RGB or RGBA?
When OpenGL ES 2 is used an ETC2-compressed RGB texture without alpha gets decompressed by Unity 5.4 to uncompressed RGBA8888 because ETC2 is not supported by OpenGL ES 2. If you hit that path you would waste a lot of memory.

We have a special case for ETC2 with alpha so that we don’t decompress textures on devices that support OpenGL ES 3 but are forced to run OpenGL ES 2. This is not really following the OpenGL ES spec but works on any driver we have seen. In Unity 5.5 we added the same special case for ETC2 without alpha.

1 Like

Hi Flo, thanks for the fast response. The textures in question are RGBA. I tried the following to resolve:

  • changing the build to OpenGL ES 3 - no effect, still crashes on Google Pixel.
  • putting these textures into an atlas and compressing with EC1. It seemed to compress them fine (no errors) but I get a giant pink screen when trying to display them on any Android device. Maybe this is because the textures are loaded individually from a resource bundle at runtime, and I haven’t done anything with atlases + bundles before. Is there a special way I need to handle this?

I will continue to research this today, thanks for your help.

Hi Jasus, any progress on this? I’m seeing the same issue on a Note 3 and I can’t get to the bottom of it.

Hi Mike, I solved the problem but I never found a magic bullet for it, though there was one oddity I ran across - these large textures were attached to sprites that did not have a default material set, changing it to sprites-default seemed to stop the crashes for some reason, though I’m not exactly sure why.

I also changed a bunch of project settings that might have helped - I was previously using openGLES2 for performance reasons but I switched back to auto-graphics-api for gles3, updated unity, and went through all of the assets in the scene to make absolutely sure they were POT and properly compressed as ETC2. Something along those lines seemed to address the problem, wish I could be more specific.