public override void Process() { FLBuffer input = Root.ActiveBuffer; FLProgram externalFunction = ExternalFunctionBlueprint.Initialize(InstructionSet); input.SetRoot(externalFunction); externalFunction.ActiveChannels = Root.ActiveChannels; externalFunction.SetCLVariables(Root.Instance, input, false); //Not making it internal to the subscript because that would dispose the buffer later in the method FLProgram.Debugger?.SubProgramStarted(Root, this, externalFunction); externalFunction.EntryPoint.Process(); FLProgram.Debugger?.SubProgramEnded(Root, externalFunction); FLBuffer buf = externalFunction.ActiveBuffer; buf.SetRoot(Root); input.SetRoot(Root); externalFunction.RemoveFromSystem(buf); externalFunction.RemoveFromSystem(input); Root.ActiveChannels = externalFunction.ActiveChannels; Root.ActiveBuffer = buf; externalFunction.FreeResources(); }
public void Process() { FLBuffer input = Root.ActiveBuffer; FLProgram externalFunction = ExternalFunctionBlueprint.Initialize(Root.Instance, InstructionSet); input.SetRoot(externalFunction); externalFunction.ActiveChannels = Root.ActiveChannels; externalFunction.SetCLVariables(input, false); //Not making it internal to the subscript because that would dispose the buffer later in the method //FLProgram.Debugger?.SubProgramStarted(Root, this, externalFunction); FLDebuggerHelper.OnSubProgramStart( Root, new FLDebuggerEvents.SubProgramStartEventArgs( externalFunction, this, externalFunction .EntryPoint, false ) ); //FLDebuggerHelper.OnProgramStart(externalFunction, new FLDebuggerEvents.ProgramStartEventArgs(externalFunction, externalFunction.EntryPoint, false, false)); externalFunction.EntryPoint.Process(); //FLProgram.Debugger?.SubProgramEnded(Root, externalFunction); FLDebuggerHelper.OnSubProgramExit( Root, new FLDebuggerEvents.SubProgramExitEventArgs(externalFunction, this) ); //FLDebuggerHelper.OnProgramExit(externalFunction, new FLDebuggerEvents.ProgramExitEventArgs(externalFunction, false)); //Fire On Program Exit as External Function as well FLBuffer buf = externalFunction.ActiveBuffer; buf.SetRoot(Root); input.SetRoot(Root); externalFunction.RemoveFromSystem(buf); externalFunction.RemoveFromSystem(input); Root.ActiveChannels = externalFunction.ActiveChannels; Root.ActiveBuffer = buf; externalFunction.FreeResources(); }
public static FLBuffer ComputeUrnd(bool isArray, int size, bool initializeOnStart) { LazyLoadingFLBuffer info = null; if (!isArray) { info = new LazyLoadingFLBuffer( root => { FLBuffer buf = new FLBuffer( root.Instance, CLAPI.CreateRandom( root.InputSize, new byte[] { 1, 1, 1, 1 }, RandomInstructionHelper .Randombytesource, true ), root.Dimensions.x, root.Dimensions.y, root.Dimensions.z, "RandomBuffer" ); buf.SetRoot(root); return(buf); }, initializeOnStart ); } else { info = new LazyLoadingFLBuffer( root => { FLBuffer buf = new FLBuffer( root.Instance, CLAPI.CreateRandom( size, new byte[] { 1, 1, 1, 1 }, RandomInstructionHelper .Randombytesource, true ), size, 1, 1, "RandomBuffer" ); buf.SetRoot(root); return(buf); }, initializeOnStart ); } return(info); }
public static FLBuffer ComputeRnd() { LazyLoadingFLBuffer info = new LazyLoadingFLBuffer(root => { FLBuffer buf = new FLBuffer(root.Instance, CLAPI.CreateRandom(root.InputSize, new byte[] { 1, 1, 1, 1 }, RandomInstructionHelper.Randombytesource, false), root.Dimensions.x, root.Dimensions.y, "RandomBuffer"); buf.SetRoot(root); return(buf); }); return(info); }