gpu.js: Examples with arrays involved are not working in 2.0.0-rc.6

Array(2) examples: Using declaration

const myFunc = gpu.createKernel(function() {
    const array2 = [0.08, 2];
    return array2;
}).setOutput([100]);

const result = myFunc();
console.log('result:', result);
/var/local/project/node_modules/gpu.js/src/backend/web-gl/kernel.js:347
			throw new Error('Error compiling fragment shader: ' + gl.getShaderInfoLog(fragShader));
			^

Error: Error compiling fragment shader: ERROR: 0:149: 'assign' :  cannot convert from 'highp 2-component vector of float' to 'highp float'

    at HeadlessGLKernel.build (/var/local/project/node_modules/gpu.js/src/backend/web-gl/kernel.js:347:10)
    at HeadlessGLKernel.run (/var/local/project/node_modules/gpu.js/src/backend/web-gl/kernel.js:414:15)
    at shortcut (/var/local/project/node_modules/gpu.js/src/kernel-run-shortcut.js:7:21)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 46 (17 by maintainers)

Most upvoted comments

Serverless gpu idea based on your project would be interesting too.

So long as serverless has a GPU available, or if fallback is ok, gpu.js should be compatible.

Any updates, related to “array return from kernel” feature? Heya, got some news?

I’m chipping away at it still. This week has been terrible for meetings and high priority items, but when I get personal time (which I’m making sure I get) I’ve been working on this.

There are several different “render strategies” that are introduced, and I’m just trying to organize the logic for this. I expect to have most of this done by the 7th, if not beforehand. The logic introduces the following (notice I’m as well adding raw Uint8Array output for those who asked) render strategies:

  • PackedPixelToUint8Array
  • PackedPixelToFloat
  • PackedPixelTo2DFloat
  • PackedPixelTo3DFloat
  • PackedTexture
  • FloatPixelToFloat32Array
  • FloatPixelToFloat
  • FloatPixelTo2DFloat
  • FloatPixelTo3DFloat
  • FloatPixelToArray2
  • FloatPixelTo2DArray2
  • FloatPixelTo3DArray2
  • FloatPixelToArray3
  • FloatPixelTo2DArray3
  • FloatPixelTo3DArray3
  • FloatPixelToArray4
  • FloatPixelTo2DArray4
  • FloatPixelTo3DArray4
  • FloatTexture

The majority of the the time is for organizing and testing. I did, however, double check with the guys on freednode opengl and as well the Khronos WebGL specification to ensure I’m utilizing integer buffers correctly, all green lights there.

Sorry it is taking so long, we’ll have it soon enough!