gpu.js: Error compiling fragment shader
What is wrong?
- After I play the video (which I process and put into another canvas) I get the Error Compiling Fragment Shader error.
Uncaught (in promise) Error: Error compiling fragment shader: ERROR: 0:471: 'assign' : l-value required
ERROR: 0:474: 'assign' : l-value required
�
at WebGL2Kernel.build (gpu-browser.min.js:14)
at WebGL2Kernel.t (gpu-browser.min.js:14)
at n (gpu-browser.min.js:14)
at Object.predictModel (processor.js:174)
Where does it happen?
When I try to run the following kernel:
const gpu = new GPU();
const kernel_normalize = gpu.createKernel(function (y_buffer,u_buffer,v_buffer,pixels) {
for(let i=0; i<pixels; i++){
if(y_buffer[this.thread.x] < 0 ) y_buffer[this.thread.x]=0;
if(y_buffer[this.thread.x] > 1 ) y_buffer[this.thread.x]=1;
this.color(y_buffer[this.thread.x],u_buffer[this.thread.x],v_buffer[this.thread.x]);
}
})
.setOutput([this.orig_cols * this.scale_factor , this.orig_rows * this.scale_factor])
.setGraphical(true);
const canvas_gpu = kernel_normalize.canvas;
document.getElementsByTagName('body')[0].appendChild(canvas_gpu);
How do we replicate the issue?
Running the above function on video tag data obtained using the getImageData.
How important is this (1-5)?
5
Expected behavior (i.e. solution)
It should show the same video data on a canvas, but is giving me a black canvas (repeatedly appending to the body tag).
Other Comments
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21
Thanks! I finally got it to work, now I understand this library much better, thanks again for all the help 💯 @HarshKhandeparkar