how can we use native methods of array in gpu js like length push pop. It gives me an error of unexpected expression

129 Views Asked by At
const A = [9, 2];
const test = gpu
.createKernel(function (A) {
        return A.length;
})
.setOutput([1]);
console.log(test(A));

ERROR: throw this.astErrorOutput('Unexpected expression', ast); ^

Error: Unexpected expression on line 1, position 0: A.length at WebGLFunctionNode.astErrorOutput (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:972:12) at WebGLFunctionNode.getMemberExpressionDetails (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:1305:24) at WebGLFunctionNode.astMemberExpression (E:\ProData\G\node_modules\gpu.js\src\backend\web-gl\function-node.js:1051:14) at WebGLFunctionNode.astGeneric (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:944:23) at WebGLFunctionNode.astReturnStatement (E:\ProData\G\node_modules\gpu.js\src\backend\web-gl\function-node.js:168:18) at WebGLFunctionNode.astGeneric (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:900:23) at WebGLFunctionNode.astFunction (E:\ProData\G\node_modules\gpu.js\src\backend\web-gl\function-node.js:116:12) at WebGLFunctionNode.astFunctionExpression (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:1019:17) at WebGLFunctionNode.astGeneric (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:898:23) at WebGLFunctionNode.toString (E:\ProData\G\node_modules\gpu.js\src\backend\function-node.js:324:32)

0

There are 0 best solutions below