cocos2d-x3.0开发游戏部分机型(显卡类型)闪退问题

前端之家收集整理的这篇文章主要介绍了cocos2d-x3.0开发游戏部分机型(显卡类型)闪退问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

拓展cocos2d-x3.0底层支持etc图片格式,把游戏中的模型使用etc格式的图片替换。

原先可以运行在联想(lenovo S880,显卡类型是PowerVP SG X 531)的机器上,但是换成etc图片之后进入游戏加载模型的时候就闪退了。
目前大部分其他机型上都没不存在这个问题,只有部分机器会闪退。初步判断有可能是显卡的问题,这个机器的显卡类型是PowerVR SGX 531。不知道各位大大有遇到相同或类似的问题没?

贴上eclipse DDMS上的报错信息:

12-20 15:11:48.559: A/libc(2909): Fatal signal 11 (SIGSEGV) at 0x53f47000 (code=1)
12-20 15:11:48.992: D/NetworkControllerGemini(309): updateTelephonySignalStrength(0) mOldSignalLevel = 4,msg.arg1 = 4,mSignalLevelMsg = true
12-20 15:11:48.993: D/NetworkControllerGemini(309): isSimInserted(0),SimInserted=true
12-20 15:11:48.993: D/NetworkControllerGemini(309): updateSignalBackgroundBySlotId(0),simInserted=true
12-20 15:11:48.993: D/NetworkControllerGemini(309): isSimInserted(0),SimInserted=true
12-20 15:11:48.994: D/NetworkControllerGemini(309): isSimInserted(1),SimInserted=true
12-20 15:11:48.994: D/NetworkControllerGemini(309): updateOperatorInfo,sim1Inserted is true,sim2Inserted is true.
12-20 15:11:48.994: D/NetworkControllerGemini(309): updateSignalBackgroundBySlotId(0),MobileVisible=true,ResId=2130837922
12-20 15:11:48.994: D/NetworkControllerGemini(309): refreshViews(0),DataConnected=true
12-20 15:11:48.994: D/NetworkControllerGemini(309): refreshViews(0),mMobileActivityIconId=2130837889,mMobileActivityIconIdGemini=-1
12-20 15:11:48.994: D/SignalClusterViewGemini(309): setDataConnected(0),dataConnected=true
12-20 15:11:48.994: D/SignalClusterViewGemini(309): apply,mMobileVisible=true mMobileActivityId=2130837889 mMobileTypeId=2130837775
12-20 15:11:48.994: D/SignalClusterViewGemini(309): isSimInserted(0),SimInserted=true
12-20 15:11:48.995: D/SignalClusterViewGemini(309): apply,mSIMBackground=2130837922
12-20 15:11:48.995: D/SignalClusterViewGemini(309): apply,mMobileVisibleGemini=true mMobileActivityIdGemini=0 mMobileTypeIdGemini=0
12-20 15:11:48.996: D/SignalClusterViewGemini(309): isSimInserted(1),SimInserted=true
12-20 15:11:48.996: D/SignalClusterViewGemini(309): apply,mSIMBackgroundGemini=2130837924
12-20 15:11:48.996: D/SignalClusterViewGemini(309): apply,mDataConnected=true mMobileActivityId=2130837889 mMobileTypeId=2130837775; mDataConnectedGemini=false mMobileActivityIdGemini=0 mMobileTypeIdGemini=0
12-20 15:11:48.996: D/SignalClusterViewGemini(309): setDatanetType3G(0),datanetType3G=true
12-20 15:11:48.996: D/SignalClusterViewGemini(309): apply,mMobileVisible=true mMobileActivityId=2130837889 mMobileTypeId=2130837775
12-20 15:11:48.997: D/SignalClusterViewGemini(309): isSimInserted(0),SimInserted=true
12-20 15:11:48.997: D/SignalClusterViewGemini(309): apply,mSIMBackground=2130837922
12-20 15:11:48.997: D/SignalClusterViewGemini(309): apply,mMobileVisibleGemini=true mMobileActivityIdGemini=0 mMobileTypeIdGemini=0
12-20 15:11:48.998: D/SignalClusterViewGemini(309): isSimInserted(1),SimInserted=true
12-20 15:11:48.998: D/SignalClusterViewGemini(309): apply,mSIMBackgroundGemini=2130837924
12-20 15:11:48.998: D/SignalClusterViewGemini(309): apply,mDataConnected=true mMobileActivityId=2130837889 mMobileTypeId=2130837775; mDataConnectedGemini=false mMobileActivityIdGemini=0 mMobileTypeIdGemini=0
12-20 15:11:48.998: D/NetworkControllerGemini(309): updateTelephonySignalStrength(0) checkNeedtoSmoothSignal(real_asu = 25,new_asu = 25 )
12-20 15:11:49.164: I/DEBUG(92): debuggerd: tmb file path:'/data/tombstones/tombstone_03'
12-20 15:11:49.164: I/DEBUG(92): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 15:11:49.164: I/DEBUG(92): Build fingerprint: 'Lenovo/s880/s880:4.0.3/IML74K/Lenovo_S880_S140_120721:user/release-keys'
12-20 15:11:49.164: I/DEBUG(92): pid: 2909,tid: 2929>>> com.test <<<
12-20 15:11:49.164: I/DEBUG(92): signal 11 (SIGSEGV),code 1 (SEGV_MAPERR),fault addr 53f47000
12-20 15:11:49.165: I/DEBUG(92):r0 5a1ee720r1 53f46ff8r2 000000c0r3 00000000
12-20 15:11:49.165: I/DEBUG(92):r4 00000000r5 00000000r6 00000000r7 00000000
12-20 15:11:49.165: I/DEBUG(92):r8 00000000r9 000697d010 5a1f0700fp 00000008
12-20 15:11:49.165: I/DEBUG(92):ip 00000000sp 520cf734lr 00000007pc 400d4ce8cpsr 20000010
12-20 15:11:49.287: I/DEBUG(92):#00pc 0000dce8/system/lib/libc.so
12-20 15:11:49.287: D/AEE/debuggerd(92): stack_depth:1
12-20 15:11:49.287: I/DEBUG(92):#01lr 00000007<unknown>
12-20 15:11:49.287: I/DEBUG(92): code around pc:
12-20 15:11:49.288: I/DEBUG(92): 400d4cc8 24d15001 44c03001 24c04001 24c05001.P.$.0.D.@.$.P.$
12-20 15:11:49.288: I/DEBUG(92): 400d4cd8 e2522020 ba000005 f5d1f060 f5d1f080R.....`.......
12-20 15:11:49.288: I/DEBUG(92): 400d4ce8 e8b151f8 e2522020 e8a051f8 aafffffa.Q..R..Q......
12-20 15:11:49.288: I/DEBUG(92): 400d4cf8 e2922020 0a00000c e1b0ce02 28b10078..........x..(
12-20 15:11:49.288: I/DEBUG(92): 400d4d08 48b10180 28a00078 48a00180 e1b0cf02...Hx..(...H....
12-20 15:11:49.288: I/DEBUG(92): code around lr:
12-20 15:11:49.288: I/DEBUG(92): 00000000 ffffffff ffffffff ffffffff ffffffff................
12-20 15:11:49.288: I/DEBUG(92): 00000010 ffffffff ffffffff ffffffff ffffffff................
12-20 15:11:49.288: I/DEBUG(92): 00000020 ffffffff ffffffff ffffffff ffffffff................
12-20 15:11:49.288: I/DEBUG(92): 00000030 ffffffff ffffffff ffffffff ffffffff................
12-20 15:11:49.288: I/DEBUG(92): 00000040 ffffffff ffffffff ffffffff ffffffff................
12-20 15:11:49.288: I/DEBUG(92): memory map around addr 53f47000:
12-20 15:11:49.288: I/DEBUG(92): 53edd000-53f47000
12-20 15:11:49.288: I/DEBUG(92): (no map for address)
12-20 15:11:49.288: I/DEBUG(92): 53f73000-53f74000 /dev/pvrsrvkm
12-20 15:11:49.288: I/DEBUG(92): stack:
12-20 15:11:49.288: I/DEBUG(92): 520cf6f400000000
12-20 15:11:49.288: I/DEBUG(92): 520cf6f800000000
12-20 15:11:49.288: I/DEBUG(92): 520cf6fc00000000
12-20 15:11:49.288: I/DEBUG(92): 520cf70000000000
12-20 15:11:49.288: I/DEBUG(92): 520cf70400000008
12-20 15:11:49.288: I/DEBUG(92): 520cf70800000000
12-20 15:11:49.288: I/DEBUG(92): 520cf70c00000000
12-20 15:11:49.289: I/DEBUG(92): 520cf71000000000
12-20 15:11:49.289: I/DEBUG(92): 520cf71400000000
12-20 15:11:49.289: I/DEBUG(92): 520cf71800000000
12-20 15:11:49.289: I/DEBUG(92): 520cf71c00000000
12-20 15:11:49.289: I/DEBUG(92): 520cf72000000000
12-20 15:11:49.289: I/DEBUG(92): 520cf72400000000
12-20 15:11:49.289: I/DEBUG(92): 520cf728df0027ad
12-20 15:11:49.289: I/DEBUG(92): 520cf72c00000000
12-20 15:11:49.289: I/DEBUG(92): 520cf730020a8108[heap]
12-20 15:11:49.289: I/DEBUG(92): #00 520cf73453f470d8
12-20 15:11:49.289: I/DEBUG(92): 520cf73800000100
12-20 15:11:49.289: I/DEBUG(92): 520cf73c00000009
12-20 15:11:49.289: I/DEBUG(92): 520cf740020a8108[heap]
12-20 15:11:49.289: I/DEBUG(92): 520cf74453edd008
12-20 15:11:49.289: I/DEBUG(92): 520cf7485a1ee700/dev/pvrsrvkm
12-20 15:11:49.289: I/DEBUG(92): 520cf74c4ccafff4/system/vendor/lib/egl/libGLESv2_mtk.so
12-20 15:11:49.289: I/DEBUG(92): 520cf75000000000
12-20 15:11:49.289: I/DEBUG(92): 520cf75400000000
12-20 15:11:49.289: I/DEBUG(92): 520cf75800000000
12-20 15:11:49.289: I/DEBUG(92): 520cf75c00000000
12-20 15:11:49.289: I/DEBUG(92): 520cf760520cf7bc
12-20 15:11:49.290: I/DEBUG(92): 520cf76400000000
12-20 15:11:49.290: I/DEBUG(92): 520cf76800000000
12-20 15:11:49.290: I/DEBUG(92): 520cf76c5a1de700/dev/pvrsrvkm
12-20 15:11:49.290: I/DEBUG(92): 520cf77000000000
12-20 15:11:49.290: I/DEBUG(92): 520cf77400000000
12-20 15:11:49.290: I/DEBUG(92): 520cf77800000037
12-20 15:11:49.445: D/AEE/debuggerd(92): stack_depth:19


总结出可能导致游戏闪退的原因:
1.资源没有优化好,导致占用太多内存,被系统强制退出
2.资源太大撑爆显存导致闪退;
3.图片太大(一些低端的机型显卡只支持最大图片大小是1024,那么这个时候就要注意了);
4.图片不是2的幂次方,有些显卡是不支持非2的幂次方的图片(这次闪退的原因就是因为使用etc材质,显卡不支持etc图片非2的幂次方导致,但是支持png为非2的幂次方,所以找了好久才发现这个问题)。
附上我在cocosChina上面的提问 链接

猜你在找的Cocos2d-x相关文章