예제 #1
0
 /// <summary>
 /// Creates a new <see cref="ComputeImageFormat"/>.
 /// </summary>
 /// <param name="channelOrder"> The number of channels and the channel layout i.e. the memory layout in which channels are stored in the <see cref="ComputeImage"/>. </param>
 /// <param name="channelType"> The type of the channel data. The number of bits per element determined by the <paramref name="channelType"/> and <paramref name="channelOrder"/> must be a power of two. </param>
 public ComputeImageFormat(ComputeImageChannelOrder channelOrder, ComputeImageChannelType channelType)
 {
     this.channelOrder = channelOrder;
     this.channelType  = channelType;
 }
예제 #2
0
                /// <summary>Unsafe allocation of memory</summary>
                /// <param name="p">Pointer to data</param>
                /// <param name="DataType">Data type: float, uint8 (byte), int32, etc.</param>
                private unsafe void CLMalloc(void* p, ComputeImageChannelType DataType)
                {
                    ComputeImageFormat format = new ComputeImageFormat(ComputeImageChannelOrder.Rgba, DataType);

                    if (OriginalVarLength != 4 * width * height) throw new Exception("Vector length should be 4*width*height");

                    VarPointer = new ComputeImage2D(Program.Context, ComputeMemoryFlags.ReadWrite | ComputeMemoryFlags.CopyHostPointer, format, width, height, 0, new IntPtr(p));
                }
예제 #3
0
 /// <summary>
 /// Creates a new <see cref="ComputeImageFormat"/>.
 /// </summary>
 /// <param name="channelOrder"> The number of channels and the channel layout i.e. the memory layout in which channels are stored in the <see cref="ComputeImage"/>. </param>
 /// <param name="channelType"> The type of the channel data. The number of bits per element determined by the <paramref name="channelType"/> and <paramref name="channelOrder"/> must be a power of two. </param>
 public ComputeImageFormat(ComputeImageChannelOrder channelOrder, ComputeImageChannelType channelType)
 {
     this.channelOrder = channelOrder;
     this.channelType = channelType;
 }
예제 #4
0
 /// <summary>Constructor.</summary>
 /// <param name="Type">Type that will be allocated in device memory. (Empty allocation)</param>
 /// <param name="Width">Image width.</param>
 /// <param name="Height">Image height.</param>
 public Image2D(ComputeImageChannelType Type, int Width, int Height)
 {
     //Aloca memoria no contexto especificado
     width = Width;
     height = Height;
     OriginalVarLength = width * height * 4;
     VarSize = OriginalVarLength;
     CLMalloc(Type);
 }