Uncaught Error: argument bit ratio not found
- Lingua principale
- JavaScript
- Stelle
- 15.5k
- Fork
- 663
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## *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?
```html
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])
```
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
```js
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
```js
const test = gpu.createKernel(function () {
// stuff
}).setOutput([4, 4]).setGraphical(true)
test()
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia eseguendo la riproduzione fornita di GPU.js nel browser con setGraphical(true), quindi confrontala con il caso non grafico. Ispeziona FunctionBuilder.assignArgumentBitRatio e analizza separatamente l’esempio con ritorno vuoto; il lavoro è completo quando entrambi i casi segnalati non generano più gli errori descritti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- computer-graphics
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100