gpujs / gpu.js

GPU Accelerated JavaScript
https://gpu.rocks
MIT License
15.1k stars 652 forks source link

Missing 'readonly' attribute for input arrays #644

Open Perfectoff opened 3 years ago

Perfectoff commented 3 years ago

I tried to pass the following function to the kernel: gpu.createKernel ( (a: readonly number[][], b: readonly number[][])=>0 ) but got a TypeScript error. The problem is, your source does not have the 'readonly' attribute for input arrays. Does that mean that these arrays can be modified from the kernel? In any case, it is necessary to have a 'readonly' array in the input arguments to ensure that my array is immutable.