Closed Bleb1k closed 2 years ago
Shader says that my func is indeed here
uniform float user_mouseX;
uniform float user_mouseY;
float kernelResult;
out vec4 data0;
int dist(int user_x, int user_y) {
return (user_x+user_y);
}
void kernel() {
float user_dst=divWithIntCheck(float(dist((threadId.x-int(user_mouseX)), (threadId.y-int(user_mouseY)))),
float(dist(float(uOutputDim.x), float(uOutputDim.y))));
color(0.3, max((1.0-(2.0*user_dst)), 0.0), max((1.0-(2.0*user_dst)), 0.0), 1.0);
}
void main(void) {
index = int(vTexCoord.s * float(uTexSize.x)) + int(vTexCoord.t * float(uTexSize.y)) * uTexSize.x;
threadId = indexTo3D(index, uOutputDim);
kernel();
data0 = actualColor;
}
ook, I fixed this thing!! dont know how, or why, but I can now use functions, yay!!!
for those who interested, I just removed division, and everything got fixed!
divWithIntCheck
also just added division back and it somehow worked!!! WHY!!!!11!!!
It says that there is no function!
And function created literally one line above
Uncaught Error: Error compiling fragment shader: ERROR: 0:467: 'dist' : no matching overloaded function found
at WebGL2Kernel.build (gpu-browser.js:15114:1) at WebGL2Kernel.run (gpu-browser.js:18625:1) at shortcut (gpu-browser.js:18645:1) at DrawingApp.redraw (renderer.ts:65:7) at loop (index.ts:115:8) at index.ts:117:3 at index.ts:117:5 at index.ts:117:5
Look at code here
https://github.com/Bleb1k/Smth/blob/f17af5434d4a62cc19face95118642080c4f8845/src/renderer.ts#L42
How important is this (1-5)?
4 - pretty important to me!
Expected behavior (i.e. solution)
typed function implentation, thats all