gpujs / gpu.js

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

Returning array broken with mode:dev #719

Open rotu opened 2 years ago

rotu commented 2 years ago

What's our vector, Victor?

What is wrong?

Returning an array from a kernel returns data full of NaN instead of the expected values.

Where does it happen?

When the GPU is created with {mode: "dev"} and the kernel code returns an array (e.g. return [1,2,3] instead of a single value return 2)

How do we replicate the issue?

run the tests in return-arrays.js with mode modified to be 'dev'.

Alternatively, see codepen here: https://codepen.io/rotu-the-bold/pen/LYLwBqy

How important is this (1-5)?

3

Expected behavior (i.e. solution)

In dev mode, the kernel should return the same value as in GPU mode.