Math.max and Math.min only accept two parameters
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- computer-graphics
Direzione di ricerca
Inizia riproducendo l’esempio di kernel GPU.js fornito con Math.max e Math.min usando tre o più argomenti, quindi esamina come queste chiamate vengono tradotte nello shader GPU. Il lavoro è completato quando le chiamate con più argomenti vengono compilate e restituiscono il risultato previsto senza richiedere workaround annidati; verifica l’esempio originale e il caso con due argomenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione

What is wrong?
Using Math.max with more than two parameters causes the GPU kernel build to fail.
How do we replicate the issue?
const gpu = new GPU({ mode: 'gpu' });
const kernel = gpu.createKernel(function() {
return Math.max(0, 1, 2);
}).setOutput([1]);
kernel();
And observe the output error
gpu-browser.js:14913 Uncaught Error: Error compiling fragment shader: ERROR: 0:457: 'max' : no matching overloaded function found. Replacing 0, 1, 2 with 0, 1 (or any other two numbers) leads to the function behaving as expected. The same is true of Math.min.
JS Fiddle: https://jsfiddle.net/TomWyllie/opdg95kb/
GPU.js 2.9.4
GPU: NVIDIA GeForce GTX 1060 3GB
Nvidia Driver 446.14
Google Chrome Version 83.0.4103.97 (Official Build) (64-bit)
Windows 10
How important is this (1-5)?
2, it's very easy (but pretty messy) to workaround by using Math.max(x, Math.max(y, Math.max(z, t))); or similar, but that is pretty ugly. My understanding is that the spec allows arbitrarily many parameters.
Other Comments
I'm beginning to think there might be something deeper wrong with GPU.js on my machine given this issue and the other I filed several days ago (#617) must be very common use cases and surely lots of other people would be having these same problems... any thoughts appreciated.
- Lingua principale
- JavaScript
- Stelle
- 15.5k
- Fork
- 663
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gpujs/gpu.js
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
-
WebGL backend silently returns all zeros for long-running kernels (no GL error, no context loss)Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Bitwise result not correctAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di gpujs/gpu.js
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
parse-community/parse-server#10699 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: dashboard bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
I maintainer di solito rispondono entro 1 giorno
-
Aframe enhancement javascript
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
webarkit/Aframe-nft#17 ·
-
spec-feedback
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100