Open
Description
What is wrong?
Adding certain custom functions causes the error: Uncaught Error: argument bit ratio not found
Where does it happen?
Not system specific
How do we replicate the issue?
<script>
const gpu = new GPU()
gpu.addFunction(function f(x, y) {
return y[0]
})
const test = gpu.createKernel(function (a) {
f(1, a)
}).setOutput([4, 4]).setGraphical(true)
test([0])
</script>
Setting setGraphical(true)
causes the error for some reason
How important is this (1-5)?
3 or 4 maybe?
Expected behavior (i.e. solution)
No error
Other Comments
In FunctionBuilder.assignArgumentBitRatio
, replacing calleeNode.argumentBitRatios[i]
with calleeNode.argumentBitRatios[argumentIndex]
should fix the problem.
Also, why does having a blank return
statement cause an error
const test = gpu.createKernel(function () {
// stuff
return
}).setOutput([4, 4]).setGraphical(true)
test() // Uncaught Error: Unexpected return statement on ...
when there is no error with having no return
statements
const test = gpu.createKernel(function () {
// stuff
}).setOutput([4, 4]).setGraphical(true)
test()
Metadata
Metadata
Assignees
Labels
No labels
Activity
harshkhandeparkar commentedon Apr 9, 2020
When you are using
setGraphical(true)
, you need to do athis.color(r, g, b, a)
as the output and not return a number as a value.robertleeplummerjr commentedon Apr 9, 2020
We need to throw more descriptive errors here.
robertleeplummerjr commentedon Apr 9, 2020
The problem is that you aren't passing in the second variable,
y
that you are referencing, and there somehow the logical checks for that weren't handled early enough.peakpoint commentedon Apr 10, 2020
What do you mean by "you aren't passing in the second variable"?
robertleeplummerjr commentedon May 3, 2020
I think I misspoke, I haven't had time to properly look into this.
mweitzel commentedon May 25, 2020
I'm experiencing this as well, when I pass an array more than a single function call from the kernel.
Bug fix: assign correct argument bit ratio index