/// <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(); }
/// <summary> /// /// </summary> /// <param name="x2"></param> /// <param name="z"></param> public SysIntX3(SysIntX2 x2, long z) : this(x2.X, x2.Y, new IntPtr(z)) { }