Example #1
0
        public Kernel SetArgumentMemory(Memory val)
        {
#if DELAY_COMPILE
            if (!Initialized)
            {
                Initialized = true;
                kern        = Device.GetDevice().env.Context.CompileKernelFromSource(SourceCode, Name, "-cl-unsafe-math-optimizations");
            }
#endif
            if (PendingExecution.IsValid())
            {
                Device.GetDevice().HandleEvent();
            }
            if (val == null)
            {
                return(this);
            }

            if (reset)
            {
                chain = kern.SetKernelArg((IMem)val.buf);
                reset = false;
            }
            else
            {
                chain = chain.SetKernelArg((IMem)val.buf);
            }
            return(this);
        }
Example #2
0
        public Kernel SetArgument <T>(T val) where T : struct, IComparable
        {
#if DELAY_COMPILE
            if (!Initialized)
            {
                Initialized = true;
                kern        = Device.GetDevice().env.Context.CompileKernelFromSource(SourceCode, Name, "-cl-unsafe-math-optimizations");
            }
#endif
            if (PendingExecution.IsValid())
            {
                Device.GetDevice().HandleEvent();
            }

            if (reset)
            {
                chain = kern.SetKernelArg(val);
                reset = false;
            }
            else
            {
                chain = chain.SetKernelArg(val);
            }
            return(this);
        }