后面我们排查到了 laya.core.js 文件中出现到
/**
*更新_cnavas相关的状态
*/
__proto._checkCanvasEnable=function(){
var tEnable=this._cacheStyle.needEnableCanvasRender();
this._getCacheStyle().enableCanvasRender=tEnable;
if (tEnable){
if (this._cacheStyle.needBitmapCache()){
this._cacheStyle.cacheAs="bitmap";
}else {
this._cacheStyle.cacheAs=this._cacheStyle.userSetCache;
}
this._cacheStyle.reCache=true;
this._renderType |=/*laya.display.SpriteConst.CANVAS*/0x08;
}else {
this._cacheStyle.cacheAs="none";
this._cacheStyle.releaseContext();
this._renderType &=~ /*laya.display.SpriteConst.CANVAS*/0x08;
}
this._setCacheAs(this._cacheStyle.cacheAs);
this._setRenderType(this._renderType);
}我们发现 laya在底层请求更新数据的时候好像失败了
上面的代码 好像调用的是laya.webgl.js 中的
//TODO:coverage
__proto._setCacheAs=function(value){
DrawCanvasCmdNative.createCommandEncoder();
if (!this._drawCanvasParamData){
this._drawCanvasParamData=/*__JS__ */new ParamData(33 *4,true);
}
if (!this._callbackFuncObj){
this._callbackFuncObj=/*__JS__ */new CallbackFuncObj();
}
if (!this._canvasBeginCmd){
this._canvasBeginCmd=LayaGL.instance.createCommandEncoder(128,64,false);
}
if (!this._canvasEndCmd){
this._canvasEndCmd=LayaGL.instance.createCommandEncoder(128,64,false);
}
this._datai32[ /*laya.display.SpriteConst.POSCALLBACK_OBJ_ID*/54]=this._callbackFuncObj.id;
this._callbackFuncObj.addCallbackFunc(1,(this.canvasBeginRenderFromNative).bind(this));
this._callbackFuncObj.addCallbackFunc(2,(this.canvasEndRenderFromNative).bind(this));
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_CALLBACK_FUN_ID*/56]=1;
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_CALLBACK_END_FUN_ID*/57]=2;
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_BEGIN_CMD_ID*/58]=this._canvasBeginCmd.getPtrID();
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_END_CMD_ID*/59]=this._canvasEndCmd.getPtrID();
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_DRAW_TARGET_CMD_ID*/60]=DrawCanvasCmdNative._DRAW_CANVAS_CMD_ENCODER_.getPtrID();
this._datai32[ /*laya.display.SpriteConst.POSCANVAS_DRAW_TARGET_PARAM_ID*/61]=this._drawCanvasParamData.getPtrID();
}中的addCallbackFunc(1,(this.canvasBeginRenderFromNative).bind(this));
和addCallbackFunc(2,(this.canvasEndRenderFromNative).bind(this)); 再绑定回调的时候出现了问题
这也跟在 androidstudio 和 xcode所报的 错误 js
E/LayaBox: JSCallbackFuncObj::addCallbackFunc error m_vFunc[1] != NULL
JSCallbackFuncObj::addCallbackFunc error m_vFunc[2] != NULL是吻合的