gpujs / gpujs/gpu.js

Arrays in parameters and returnTypes for kernel's subfunctions - can be bigger than 4?

Open
#394 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
663
PR merge metrics
No merged PRs in 30d

Description

This issue is connected with #385 and #377 . Currently we are able to declare param/return value as Array(2), Array(3) and Array(4). But wen we use type `Array` or `Array(5)` (and greater than 5) then we will see error. It is possible to use a little bigger arrays (with 5-16 elements, or even arbitrary size)?

Here is fiddle-test-case:

https://jsfiddle.net/u9y8xw3n/1/

So when we use arbitrary array:
`gpu.addFunction(bug2Fn, { paramTypes: { v: 'Array'}, returnType: 'Array' }); `
or
`gpu.addFunction(bug2Fn, { paramTypes: { v: 'Array(2)'}, returnType: 'Array' }); `
We get:
> An error occurred compiling the shaders: ERROR: 0:160: 'sampler2D' : sampler2Ds can't be function return values gpu.js:3642

For
`gpu.addFunction(bug2Fn, { paramTypes: { v: 'Array'}, returnType: 'Array(3)' }); `
we get:
> An error occurred compiling the shaders: ERROR: 0:161: 'user_vSize' : undeclared identifier gpu.js:3642

For:
`gpu.addFunction(bug1Fn, { paramTypes: { v: 'Array(2)'}, returnType: 'Array(5)' }); `
We get:
> Uncaught Error: type Array(5) not handled gpu.js:2949

For
`gpu.addFunction(bug3Fn, { paramTypes: { v: 'Array(5)'}, returnType: 'Array(3)' }); `
we get:
> Uncaught Error: unknown type Array(5), gpu.js: 2554

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.