Spritekit: First texture draw slow (preloaded)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 15:39:16

问题


I'm having a performance issue regarding Apple Spritekit Framework. I use the method preloadTextureAtlases:withCompletionHandler: of SKTextureAtlas to make sure all my textures are loaded before the game really starts.

Yet when the first texture of this atlas (whatever it is) is added to the scene as a child I got a small lag, like if the texture wasn't loaded. It only happens the first time.

I tried real hard to debug this and to find the reason but I couldn't find it. Looking with Instrument and the Time Profiler I got this

Which seems strange since my texture atlas contains all the allocated textures (and they are still allocated). Why does it call a load method ? Maybe it's something related to OpenGL like the texture binding.

I'm sure this correspond to the frame where my object is allocated (see the spike on the right). Nothing else is allocated or in motion here.

I'm really stuck on this and any help would be deeply appreciated. Thanks for your time.

来源:https://stackoverflow.com/questions/22308049/spritekit-first-texture-draw-slow-preloaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!