Open contactmukulsaini opened 3 years ago
Strings are unfortunately not supported at all. This is because GPU.js transpiles the JS into a much lower-level language called GLSL which runs on the GPU. This language doesn't even have strings as a data type so strings in js are not supported :( But you can convert the strings into a number (maybe ASCII numbers) and then manipulate that somehow.
You can convert the string into an array of numbers using string.split("").map(t => t.charCodeAt(0))
. You can then manipulate that string in the GPU and convert it back using result.map(t => String.fromCharCode(t)).join("")
.
I want to perform the string operations on 1D array which is currently not possible to do with GPU.js. Is it in the roadmap and by when can can we expect that?