05 optimization of cocos2d-x games on x86 architecture

952 views

Published on

zhuoshi sun (intel)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
952
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

05 optimization of cocos2d-x games on x86 architecture

  1. 1. Optimization Notice Software Service Group1
  2. 2. Legal Disclaimer  INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTELS TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.  A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTELS PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.  Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.  Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products.  Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1- 800-548-4725, or go to: http://www.intel.com/design/literature.htm  Intel, the Intel logo, Intel Atom, Intel Core are trademarks of Intel Corporation in the U.S. and other countries.  *Other names and brands may be claimed as the property of others.  Copyright © 2012. Intel Corporation. Software Service Group2
  3. 3. x86架构上基于cocos2d-x的游戏开发与优化 孙卓识,郭胜 2012.03.31 Software Service Group3
  4. 4. 日程  合作历史  x86上的cocos2d-x游戏开发 – Android x86  x86上的cocos2d-x游戏优化 – 《捕鱼达人》 – Intel® VTune™性能分析器 – Intel®图形性能分析器(GPA)  下一步 Software Service Group4
  5. 5. 合作历史  11.05  cocos2d-x MeeGo  添加了Android x86支持  《捕鱼达人》支持Android x86  《捕鱼达人》优化  cocos2d-x优化 Software Service Group5
  6. 6. Android x86 -真的很简单  使用NDK r6b及更高版本  打开android/jni/Application.mk APP_ABI := x86 或者 APP_ABI := armeabi x86  发布打包 一个apk包同时支持多种CPU架构 Software Service Group6
  7. 7. 《捕鱼达人》Android x86 环境:Medfield平板, Android 4.0.3 Software Service Group7
  8. 8. 《捕鱼达人》Android x86性能分析  关闭垂直同步(vsync) Disable 1x1 2x2 Simple Disable Disable Experiments Normal Draw Scissor Texture Fragment Z-Test Alpha Calls Rect Shader Blending FPS 50 75 70 62 50 50 69  结论 – GPU是瓶颈  可优化内容 – 减少应用alpha blending – 减小纹理尺寸与数量 Software Service Group8
  9. 9. 《捕鱼达人》(Windows)优化前 Software Service Group9
  10. 10. 《捕鱼达人》(Windows)优化后 Software Service Group10
  11. 11. 《捕鱼达人》(Windows)优化对比 Function CPU Time CPU Time cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SPActor *>::allKeys 17.70% 0% cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SPActor *>::objectForKey 17.00% 0% cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SPActor *>::next 0.00% 6.30% glColorMask 11.00% 18.80% SPScene::getActors 8.10% 3.40% cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cocos2d::CCTexture2D *>::objectForKey 5.60% 9.20% cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cocos2d::CCTexture2D *>::allKeys 5.00% 8.60% GuiAddVertexShaderInfo 4.90% 7.90% cocos2d::CCUserDefault::isXMLFileExist 3.90% 6.00% split 3.70% 5.90% FPS提升:15%左右 Software Service Group11
  12. 12. Cocos2d-x(Windows)优化前 Software Service Group12
  13. 13. Cocos2d-x(Windows)优化后 Software Service Group13
  14. 14. Cocos2d-x(Windows)优化对比 Function CPU Time CPU Time Module glColorMask 15.60% 20.00% libGLES_CM.dll cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cocos2d::CCTexture2D *>::allKeys 8.70% 0.00% libcocos2d.dll cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cocos2d::CCTexture2D *>::objectForKey 8.50% 0.00% libcocos2d.dll cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cocos2d::CCTexture2D *>::next 0.00% 2.90% libcocos2d.dll GuiAddVertexShaderInfo 7.60% 8.90% libEGL.dll split 6.80% 7.70% FishingJoy_mobile.exe cocos2d::CCMutableDictionary<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SPActor *>::next 6.40% 8.20% FishingJoy_mobile.exe xmlCleanupOutputCallbacks 5.60% 6.50% libxml2.dll cocos2d::CCUserDefault::isXMLFileExist 5.60% 6.20% libcocos2d.dll SPGameObject::getGroup 4.20% 5.10% FishingJoy_mobile.exe SPScene::getActors 3.60% 4.30% FishingJoy_mobile.exe 优化后FPS提升:20%左右 Software Service Group14
  15. 15. 优化代码 Software Service Group15
  16. 16. 优化小结  优化方案可能很简单,定位很关键  对待优化的态度  工具很重要 Software Service Group16
  17. 17. Intel® VTune™性能分析器  主要特性 – 性能热点分析 – 并发分析 – 锁分析  操作简单  无须源码  支持Windows, Linux  IDE集成  30天免费试用 Software Service Group17
  18. 18. Intel®图形性能分析器(GPA) 系统分析器(HUD) 平台分析器 帧分析器  免费 – www.intel.com/software/GPA  支持Android x86 Software Service Group18
  19. 19. 下一步:Android x86移动设备 Lenovo 平板 Lenovo 手机 Lava (印度), 中兴通讯, Motorola 手机 Orange ( 欧洲) Software Service Group19
  20. 20. 下一步:Ultrabook  更轻,更薄,更长的续航时间,更快的响应速度  触摸支持*  加速度计,GPS等感应器*支持  近场通信支持* *Recommended, not required Software Service Group20
  21. 21. Q&A  我们提供 – 开发样机支持 – 技术支持 – 应用工程师支持  联系方式 – 客户经理: 陈景伟 电话:130 1109 1109, 电邮:jenvy.chen@intel.com – 应用工程师:孙卓识 电话:186 1651 3251, 电邮:zhuoshi.sun@intel.com 谢谢! 问题? Software Service Group21
  22. 22. Backup Software Service Group22
  23. 23. VTune™ Call Stack Software Service Group23

×