gpujs / gpujs/gpu.js

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

Abierto
#563 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
15.5k
Forks
663
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con /backend/web-gl2/kernel-value/html-image-array.js alrededor de la línea 53 y revisa el gist enlazado del wrapper del kernel. Compara cómo se gestionan las entradas de imagen y los offsets en el modo gráfico, incluida la limitación indicada para los offsets negativos. Se considera terminado cuando se hayan acordado el diseño de la API y el alcance de la implementación para offsets de imagen opcionales, con pruebas que cubran el comportamiento previsto.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
computer-graphics
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.