예제 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Initializes a new instance of the Cloo.ComputeKernel class. </summary>
        ///
        /// <param name="functionName"> Gets the function name of the <see cref="ComputeKernel"/>. </param>
        /// <param name="program">      Gets the <see cref="ComputeProgram"/> that the
        ///                             <see cref="ComputeKernel"/> belongs to. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        internal ComputeKernel(string functionName, ComputeProgram program)
        {
            Handle = CL12.CreateKernel(program.Handle, functionName, out var error);
            ComputeException.ThrowOnError(error);

            SetID(Handle.Value);

            context           = program.Context;
            this.functionName = functionName;
            this.program      = program;

            RILogManager.Default?.SendTrace(string.Intern("Create ") + this + string.Intern(" in Thread(") + Thread.CurrentThread.ManagedThreadId + string.Intern(")."), string.Intern("Information"));
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Initializes a new instance of the Cloo.ComputeKernel class. </summary>
        ///
        /// <param name="functionName"> Gets the function name of the <see cref="ComputeKernel"/>. </param>
        /// <param name="program">      Gets the <see cref="ComputeProgram"/> that the
        ///                             <see cref="ComputeKernel"/> belongs to. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        internal ComputeKernel(string functionName, ComputeProgram program)
        {
            ComputeErrorCode error = ComputeErrorCode.Success;

            Handle = CL12.CreateKernel(program.Handle, functionName, out error);
            ComputeException.ThrowOnError(error);

            SetID(Handle.Value);

            context           = program.Context;
            this.functionName = functionName;
            this.program      = program;

            Trace.WriteLine("Create " + this + " in Thread(" + Thread.CurrentThread.ManagedThreadId + ").", "Information");
        }