gpujs / gpujs/gpu.js

Interest in specifying "Offsets" to the library as a conveinence function.

Aperta
#563 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
15.5k
Fork
663
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I came to Robert with a question about the possibility of adding an offset to the raw input data as a convenience = efficiency function of gpu.js. For example, when using graphical mode, and drawing a image composited out of many other images (my use case) It could be useful to simply offset the input with something like.

`kernel.setOutput({image1:[10, 10], image2:[0, 0]})`

To give an optional x/y offset for each placed image.

My first attempt at this involved trying to offset the data when loading images in webgl (in /backend/web-gl2/kernel-value/html-image-array.js, line 53, there are offsets and widths that can be set.) This worked well, but unfortunately due to a limitation in webgl, It only works with positive offsets, not negative ones. (there was a workaround here, but because it uses a canvas it might be too slow: https://stackoverflow.com/questions/20930466/webgl-is-there-an-efficient-way-to-upload-only-part-of-an-image-canvas-as-a-tex)

In response to this limitation Robert suggested just modifying the kernel function like so: https://gist.github.com/robertleeplummerjr/26796385d415a928a6f060ef5e6e0310

In this case the offset functionality is not provided by the gpu.js library, and required that the user add a modest amount of extra lines to their kernel. The question came up of whether it would make sense to include this type of function wrapper in general in gpu.js, or it user should just write it manually like shown if they need it.

Is there any interest in providing an offsets type of option to gpu.js image (or other) inputs to avoid user having to do manual bound checks and index adjustment like in the example? If so I may look into creating the api...

![A GIF or MEME to give some spice of the internet](https://github.com/davidlyons/threejs-intro/blob/master/images/300.jpg?raw=true)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da /backend/web-gl2/kernel-value/html-image-array.js intorno alla riga 53 e esamina il gist collegato del wrapper del kernel. Confronta il modo in cui vengono gestiti gli input delle immagini e gli offset in modalità grafica, inclusa la limitazione indicata per gli offset negativi. Il lavoro è considerato completato quando saranno concordati il design dell’API e l’ambito di implementazione per gli offset delle immagini opzionali, con test che coprano il comportamento previsto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
computer-graphics
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.