drawing via CCTextureAtlas fails on certain Android devices

Hi guys! The Spine runtime for cocos2dx uses CCTextureAtlas for drawing [1]. This seems to fail on certain Android devices [2], where failure is that only some quads are drawn. We found that if we call drawQuads after every updateQuad then it draws all quads as expected. This seems to indicate that CCTextureAtlas batching and/or drawing is broken somehow for certain Android devices. Does anyone have any insight on what the issue might be?

1: How CCTextureAtlas is used for drawing: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-cocos2dx/src/spine/CCSkeleton.cpp#L143
2: Spine issue describing what Android devices render incorrectly: https://github.com/EsotericSoftware/spine-runtimes/issues/33

Hi All,

Just want to confirm that this happening on devices with this info:
09-27 14:02:11.259: D/cocos2d-x debug info(3847): cocos2d.x.version: 2.1.5
09-27 14:02:11.259: D/cocos2d-x debug info(3847): cocos2d.x.compiled_with_profiler: false
09-27 14:02:11.259: D/cocos2d-x debug info(3847): cocos2d.x.compiled_with_gl_state_cache: true
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.vendor: Qualcomm
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.renderer: Adreno ™ 200
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.version: OpenGL ES 2.0 1566933
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.max_texture_size: 4096
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.max_texture_units: 20
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.supports_PVRTC: false
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.supports_NPOT: true
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.supports_BGRA8888: false
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.supports_discard_framebuffer: false
09-27 14:02:11.259: D/cocos2d-x debug info(3847): gl.supports_vertex_array_object: false

I have tried the following compile flags, but they did not help resolve the issue:
~~DCC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP doesn’t help
~~DCC_REBIND_INDICES_BUFFER doesn’t help
* both flags together don’t help

Thanks

Hi All,

Some more info on this:

The problem is solved if its the CCTextureAtlas capacity is set to some larger number (like 128, as opposed to 4):
CCTextureAtlas* textureAtlas = CCTextureAtlas::createWithTexture(texture, 128);

It seems that the problem might be somewhere in CCTextureAtlas::resizeCapacity() since any time that gets called the problem seems to occur.

Any ideas? Could this be a bug in CCTextureAtlas?

Thanks

I’m seeing this issue in Cocos2d-x 2.2 on the Adreno ™ 200

This should have been fixed as Chad Ata mentioned. Make sure the line in spine-cocos2dx.cpp has 128 as it does in Chad Ata’s post. You could also try increasing it.

Nathan Sweet wrote:

This should have been fixed as Chad Ata mentioned. Make sure the line in spine-cocos2dx.cpp has 128 as it does in Chad Ata’s post. You could also try increasing it.

I was set to 4 in my source, must be the default for 2.2 Cocos2d-x.

The setting of 4 was working on 45 Androids and 6 iOS devices during our testing. It was not working on the Adreno 200 GPU on 2 devices.

I have set it to 128. I am curious, and will be digging into it myself, what we’re allocating here with that 128. Sounds like a lot :wink: