GPGPU with WebGL 2.0 in browser native JavaScript and GLSL
npm install gpgpuGPGPU with WebGL 2.0 in browser native JavaScript and GLSL
``js#version 300 es
import GPGPU from 'gpgpu'
const gpgpu = GPGPU.create()
gpgpu.compile(
in float in1;
in float in2;
uniform float uni1;
uniform float uni2;
out float res1;
out float res2;
void main(void){
res1 = in1 * uni1;
res2 = in2 * uni2;
})`
gpgpu.bind(1.5, 2.5)
console.log(gpgpu.exec([1, 3, 5], [2, 4, 6]))
// -> [[1.5, 4.5, 7.5], [5, 10, 15]]
`sh`
yarn add gpgpu
Create GPGPU instance. A new HTMLCanvasElement is created internally.
- Throws exception when WebGl2RenderingContext isn't support in the browser.
Create GPGPU instance with HTMLCanvasElement.
- Throws exception when WebGL2RenderingContext isn't support in the browser.
Create GPGPU instance with WebGL2RenderingContext.
Parse source code written in GLSL and ready buffers for attributes, uniforms and varyings.
Binds uniform value.
Execute GLSL program with attributes` and returns feedback transformed results.
[build]: https://img.shields.io/codeship/cd489ed0-f3a4-0136-9313-4661328143ed/master.svg?style=flat-square
[license]: https://img.shields.io/github/license/minodisk/gpgpu.svg?style=flat-square
[npm]: https://img.shields.io/npm/v/gpgpu.svg?style=flat-square
[types]: https://img.shields.io/npm/types/gpgpu.svg?style=flat-square