diff --git a/cocos2d/core/utils/BinaryLoader.js b/cocos2d/core/utils/BinaryLoader.js index 01e5c6194b..67f1a4ccff 100644 --- a/cocos2d/core/utils/BinaryLoader.js +++ b/cocos2d/core/utils/BinaryLoader.js @@ -50,7 +50,7 @@ cc.loader.loadBinary = function (url, cb) { } else { if (xhr.overrideMimeType) xhr.overrideMimeType("text\/plain; charset=x-user-defined"); xhr.onload = function () { - xhr.readyState === 4 && xhr.status === 200 ? cb(null, xhr.response) : cb(errInfo); + xhr.readyState === 4 && xhr.status === 200 ? cb(null, new Uint8Array(xhr.response)) : cb(errInfo); }; } xhr.send(null); @@ -104,7 +104,7 @@ cc.loader.loadBinarySync = function (url) { return null; } - arrayInfo = req.response; + arrayInfo = new Uint8Array(req.response); } return arrayInfo; }; diff --git a/cocos2d/shaders/CCGLProgram.js b/cocos2d/shaders/CCGLProgram.js index 4e8301d50b..0cf9f4702d 100644 --- a/cocos2d/shaders/CCGLProgram.js +++ b/cocos2d/shaders/CCGLProgram.js @@ -63,7 +63,8 @@ cc.GLProgram = cc.Class.extend(/** @lends cc.GLProgram# */{ updated = true; } else { for (var i = 0; i < args.length; i += 1) { - if (args[i] !== element[i]) { + // Array and Typed Array inner values could be changed, so we must update them + if (args[i] !== element[i] || typeof args[i] === 'object') { element[i] = args[i]; updated = true; }