Beispiel #1
0
        /// <summary>
        /// Creates a new buffer from a specified buffer.
        /// </summary>
        /// <param name="buffer"> The buffer to create the buffer from. </param>
        /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the buffer. </param>
        /// <param name="offset"> The index of the element of <paramref name="buffer"/>, where the buffer starts. </param>
        /// <param name="count"> The number of elements of <paramref name="buffer"/> to include in the buffer. </param>
        public ComputeSubBuffer(ComputeBuffer <T> buffer, ComputeMemoryFlags flags, long offset, long count)
            : base(buffer.Context, flags)
        {
            SysIntX2 region = new SysIntX2(offset * Marshal.SizeOf(typeof(T)), count * Marshal.SizeOf(typeof(T)));

            CL11.CreateSubBuffer(Handle, flags, ComputeBufferCreateType.Region, ref region, out ComputeErrorCode error);
            ComputeException.ThrowOnError(error);
            Init();
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new <see cref="ComputeSubBuffer{T}"/> from a specified <see cref="ComputeBuffer{T}"/>.
        /// </summary>
        /// <param name="buffer"> The buffer to create the <see cref="ComputeSubBuffer{T}"/> from. </param>
        /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="ComputeBuffer{T}"/>. </param>
        /// <param name="offset"> The index of the element of <paramref name="buffer"/>, where the <see cref="ComputeSubBuffer{T}"/> starts. </param>
        /// <param name="count"> The number of elements of <paramref name="buffer"/> to include in the <see cref="ComputeSubBuffer{T}"/>. </param>
        public ComputeSubBuffer(ComputeBuffer <T> buffer, ComputeMemoryFlags flags, long offset, long count)
            : base(buffer.Context, flags)
        {
            var sizeofT = ComputeTools.SizeOf <T>();

            SysIntX2 region = new SysIntX2(offset * sizeofT, count * sizeofT);

            Handle = CL11.CreateSubBuffer(buffer.Handle, flags, ComputeBufferCreateType.Region, ref region, out var error);
            ComputeException.ThrowOnError(error);

            Init();
        }
Beispiel #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x2"></param>
 /// <param name="z"></param>
 public SysIntX3(SysIntX2 x2, long z)
     : this(x2.X, x2.Y, new IntPtr(z))
 {
 }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x2"></param>
 /// <param name="z"></param>
 public SysIntX3(SysIntX2 x2, long z)
     : this(x2.X, x2.Y, new IntPtr(z))
 {
 }