Skip to content

Commit 5f14f68

Browse files
committed
Add cc.sys.doNotUseSIMD
It is used to control using SIMD.js optimziation or not.
1 parent 244322c commit 5f14f68

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CCBoot.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,11 @@ cc._initSys = function (config, CONFIG_KEY) {
18221822
sys.openURL = function(url){
18231823
window.open(url);
18241824
}
1825+
1826+
/**
1827+
* Don't use SIMD.js optimization
1828+
*/
1829+
sys.doNotUseSIMD = false;
18251830
};
18261831

18271832
//+++++++++++++++++++++++++something about sys end+++++++++++++++++++++++++++++

cocos2d/kazmath/mat4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@
14211421
return temp.toAxisAndAngle();
14221422
};
14231423

1424-
if(typeof(SIMD) !== 'undefined' && cc.doNotUseSIMD !== true) {
1424+
if(typeof(SIMD) !== 'undefined' && cc.sys.doNotUseSIMD !== true) {
14251425
proto.inverse = proto.inverseSIMD;
14261426
proto.isIdentity = proto.isIdentitySIMD;
14271427
proto.transpose = proto.transposeSIMD;

cocos2d/kazmath/simd_benchmark/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ <h2 align="center" id="speedup"></h2>
1919
</div>
2020
<div id='echo'></div>
2121
<script>
22-
var cc = cc || {};
23-
cc.doNotUseSIMD = true;
22+
var cc = cc || {sys: {}};
23+
// Set doNotUseSIMD to compare the scalar version and SIMD version
24+
cc.sys.doNotUseSIMD = true;
2425
</script>
2526
<script src="../utility.js"></script>
2627
<script src="../vec3.js"></script>

cocos2d/kazmath/vec3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
return tyArr;
210210
};
211211

212-
if(typeof(SIMD) !== 'undefined' && cc.doNotUseSIMD !== true) {
212+
if(typeof(SIMD) !== 'undefined' && cc.sys.doNotUseSIMD !== true) {
213213
proto.transformCoord = proto.transformCoordSIMD;
214214
}
215215
})(cc);

0 commit comments

Comments
 (0)