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
Can I pass an array to the function that I added to the gpu instance?
I added it like this: gpu.addFunction(simpson, ["Number", "Number", "Array"]);
I got it in the shader's code: float simpson(float user_myh, float user_nn, sampler2D user_arr) {
But when I try to access an array element: get(user_arr, vec2(user_arrSize[0],user_arrSize[1]), vec3(user_arrDim[0],user_arrDim[1],user_arrDim[2]), 1.0)
user_arrSize and user_arrDim are not defined.
How to fix this problem?
Earlier I fixed addFunction, replaced: this.addFunctionNode(new this.Node(functionName, jsFunction, paramTypes, returnType).setAddFunction(this.addFunction.bind(this)));
with this.addFunctionNode(new this.Node(functionName, jsFunction, null, paramTypes, returnType).setAddFunction(this.addFunction.bind(this)));
in the file gpu.js line 1057.
Because of the BaseFunctionNode signature is: function BaseFunctionNode(functionName, jsFunction, options, paramTypes, returnType) {
I think it was a bug.
The text was updated successfully, but these errors were encountered:
I went back to this code and found that the error occurs with multidimensional arrays. I wrote a simple code that demonstrates this error.
-> simple.txt
Here's an error:
An error occurred compiling the shaders: ERROR: 0:130: 'get' : no matching overloaded function found
Can I pass an array to the function that I added to the gpu instance?
I added it like this:
gpu.addFunction(simpson, ["Number", "Number", "Array"]);
I got it in the shader's code:
float simpson(float user_myh, float user_nn, sampler2D user_arr) {
But when I try to access an array element:
get(user_arr, vec2(user_arrSize[0],user_arrSize[1]), vec3(user_arrDim[0],user_arrDim[1],user_arrDim[2]), 1.0)
user_arrSize and user_arrDim are not defined.
How to fix this problem?
Earlier I fixed addFunction, replaced:
this.addFunctionNode(new this.Node(functionName, jsFunction, paramTypes, returnType).setAddFunction(this.addFunction.bind(this)));
with
this.addFunctionNode(new this.Node(functionName, jsFunction, null, paramTypes, returnType).setAddFunction(this.addFunction.bind(this)));
in the file gpu.js line 1057.
Because of the BaseFunctionNode signature is:
function BaseFunctionNode(functionName, jsFunction, options, paramTypes, returnType) {
I think it was a bug.
The text was updated successfully, but these errors were encountered: