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
As in JS, GLSL functions can only return a single result, however unlike JS, they can write secondary results into args qualified with out/inout. Due to lack of pointers, there's no easy way to achieve this in JS, unless any such args are wrapped in a temp array which also requires the function call itself to be augmented by the codegen...
Possible approach:
analyze current scope for function calls with out / inout params
if present wrap all such vars as array (boxed values)
/** * @param x in float */constfoo=(x: number)=>x+10;/** * @param x in float * @param y in float * @param z out float */constbar=(x: number,y: number,z: number[])=>{z[0]=x+y;};constbaz=()=>{// after pre-analyzing `baz` scope we have determined that// y is used as `out` arg by `bar`, so box as arraylety=[0];// call with unboxed value (since no out arg)y[0]=foo(y[0]);// call with both unboxed and boxedbar(1,y[0],y);// return unboxedreturny[0];};
The text was updated successfully, but these errors were encountered:
As in JS, GLSL functions can only return a single result, however unlike JS, they can write secondary results into args qualified with
out
/inout
. Due to lack of pointers, there's no easy way to achieve this in JS, unless any such args are wrapped in a temp array which also requires the function call itself to be augmented by the codegen...Possible approach:
out
/inout
paramsThe text was updated successfully, but these errors were encountered: