Skip to content

Commit 9dc62e3

Browse files
committed
Fixed behavior when using constants limit in for loops
1 parent e435894 commit 9dc62e3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/backend/functionNode_webgl.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ var functionNode_webgl = (function() {
33

44
var gpu, opt, jsFunctionString;
55

6+
function isIdentifierConstant(paramName) {
7+
return opt.constants.indexOf(paramName) != -1;
8+
}
9+
610
function isIdentifierKernelParam(paramName, ast, funcParam) {
711
return funcParam.paramNames.indexOf(paramName) != -1;
812
}
@@ -346,7 +350,8 @@ var functionNode_webgl = (function() {
346350

347351
if (forNode.test && forNode.test.type == "BinaryExpression") {
348352
if (forNode.test.right.type == "Identifier"
349-
&& forNode.test.operator == "<") {
353+
&& forNode.test.operator == "<"
354+
&& isIdentifierConstant(forNode.test.right.name) == false) {
350355

351356
if (opt.loopMaxIterations === undefined) {
352357
console.warn("Warning: loopMaxIterations is not set! Using default of 100 which may result in unintended behavior.");

0 commit comments

Comments
 (0)