You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems as if one kernel's output size can affect the size of a canvas created by another. This means that the canvas created by a kernel is larger than should be expected.
Where does it happen?
GPU.js running in browser in Chrome on a Mac (WebGL2 enabled)
How do we replicate the issue?
constgpu=newGPU();constimg_width=64;constimg_height=64;constimgKernel=gpu.createKernel(function(_image){constpixel=_image[this.thread.y][this.thread.x];returnpixel[0];}).setOutput([img_width,img_height]);constrenderKernel=gpu.createKernel(function(){this.color(1,0,0,1);}).setGraphical(true).setOutput([32,32]);constimage=document.createElement("img");image.src="./test.png";image.onload=()=>{console.log("image width x height",image.naturalWidth,image.naturalHeight);constimgOut=imgKernel(image);// This is not used just rundocument.body.appendChild(renderKernel.canvas);renderKernel();};
The output looks like this:
You can see that the canvas is 64x64 pixels, the size of the imgKernel but the red section is 32x32 inside that which is the output of renderKernel despite the two having no relationship other than both of them are called.
How important is this (1-5)?
5 This is a pretty limiting bug if you want to use multiple kernels.
Expected behavior (i.e. solution)
Should show a 32x32 red canvas as far as I can tell.
Other Comments
Thank you for your time looking at this.
The text was updated successfully, but these errors were encountered:
It seems that kernels created from the same GPU instance shares the same canvas. If you want different canvases then you'll need to create another GPU instance for the other kernel.
i've been through the same problem. and i don't want a second canvas, i really need different-sized textures. my workaround is to set canvas.height and canvas.width explicitly to the correct values after calling the other kernels for the first time.
What is wrong?
It seems as if one kernel's output size can affect the size of a canvas created by another. This means that the canvas created by a kernel is larger than should be expected.
Where does it happen?
GPU.js running in browser in Chrome on a Mac (WebGL2 enabled)
How do we replicate the issue?
The output looks like this:
You can see that the canvas is 64x64 pixels, the size of the
imgKernel
but the red section is 32x32 inside that which is the output ofrenderKernel
despite the two having no relationship other than both of them are called.How important is this (1-5)?
5 This is a pretty limiting bug if you want to use multiple kernels.
Expected behavior (i.e. solution)
Should show a 32x32 red canvas as far as I can tell.
Other Comments
Thank you for your time looking at this.
The text was updated successfully, but these errors were encountered: