本文整理汇总了C#中ComputeMemoryFlags类的典型用法代码示例。如果您正苦于以下问题:C# ComputeMemoryFlags类的具体用法?C# ComputeMemoryFlags怎么用?C# ComputeMemoryFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComputeMemoryFlags类属于命名空间,在下文中一共展示了ComputeMemoryFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComputeImage
private ComputeImage(CLMemoryHandle handle, ComputeContext context, ComputeMemoryFlags flags)
: base(context, flags)
{
Handle = handle;
Init();
}
示例2: ComputeImage2D
/// <summary>
/// Creates a new <see cref="ComputeImage2D"/> from a <c>Bitmap</c>.
/// </summary>
/// <param name="context"> A valid <see cref="ComputeContext"/> in which the <see cref="ComputeImage2D"/> is created. </param>
/// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="ComputeImage2D"/>. </param>
/// <param name="bitmap"> The bitmap to use. </param>
/// <remarks> Note that only bitmaps with <c>Alpha</c>, <c>Format16bppRgb555</c>, <c>Format16bppRgb565</c> or <c>Format32bppArgb</c> pixel formats are currently supported. </remarks>
public ComputeImage2D(ComputeContext context, ComputeMemoryFlags flags, Bitmap bitmap)
: base(context, flags)
{
unsafe
{
ComputeImageFormat format = Tools.ConvertImageFormat(bitmap.PixelFormat);
BitmapData bitmapData = bitmap.LockBits(new Rectangle(new Point(), bitmap.Size), ImageLockMode.ReadOnly, bitmap.PixelFormat);
ComputeErrorCode error = ComputeErrorCode.Success;
Handle = CL10.CreateImage2D(
context.Handle,
flags,
&format,
new IntPtr(bitmap.Width),
new IntPtr(bitmap.Height),
new IntPtr(bitmapData.Stride),
bitmapData.Scan0,
&error);
ComputeException.ThrowOnError(error);
bitmap.UnlockBits(bitmapData);
Init();
}
}
示例3: ComputeImage3D
private ComputeImage3D(IntPtr handle, ComputeContext context, ComputeMemoryFlags flags)
: base(context, flags)
{
Handle = handle;
Init();
}
示例4: ComputePipe
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="flags"></param>
/// <param name="packetSize"></param>
/// <param name="maxPackets"></param>
public ComputePipe(ComputeContext context, ComputeMemoryFlags flags, int packetSize, int maxPackets)
: this(context, flags)
{
ComputeErrorCode error;
Handle = CLInterface.CL20.CreatePipe(context.Handle, flags, packetSize, maxPackets, null, out error);
ComputeException.ThrowOnError(error);
Init();
}
示例5: CreateFloatBuffer
public void CreateFloatBuffer(string key, float[] hostBuffer, ComputeMemoryFlags flags)
{
_floatBuffers.Add(key, hostBuffer);
if (HardwareAccelerationEnabled)
{
_floatComputeBuffers.Add(key, new ComputeBuffer<float>(_context, flags, hostBuffer));
}
}
示例6: ComputeImage3D
/// <summary>
/// Creates a new <see cref="ComputeImage3D"/>.
/// </summary>
/// <param name="context"> A valid <see cref="ComputeContext"/> in which the <see cref="ComputeImage3D"/> is created. </param>
/// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="ComputeImage3D"/>. </param>
/// <param name="format"> A structure that describes the format properties of the <see cref="ComputeImage3D"/>. </param>
/// <param name="width"> The width of the <see cref="ComputeImage3D"/> in pixels. </param>
/// <param name="height"> The height of the <see cref="ComputeImage3D"/> in pixels. </param>
/// <param name="depth"> The depth of the <see cref="ComputeImage3D"/> in pixels. </param>
/// <param name="rowPitch"> The size in bytes of each row of elements of the <see cref="ComputeImage3D"/>. If <paramref name="rowPitch"/> is zero, OpenCL will compute the proper value based on <see cref="ComputeImage.Width"/> and <see cref="ComputeImage.ElementSize"/>. </param>
/// <param name="slicePitch"> The size in bytes of each 2D slice in the <see cref="ComputeImage3D"/>. If <paramref name="slicePitch"/> is zero, OpenCL will compute the proper value based on <see cref="ComputeImage.RowPitch"/> and <see cref="ComputeImage.Height"/>. </param>
/// <param name="data"> The data to initialize the <see cref="ComputeImage3D"/>. Can be <c>IntPtr.Zero</c>. </param>
public ComputeImage3D(ComputeContext context, ComputeMemoryFlags flags, ComputeImageFormat format, int width, int height, int depth, long rowPitch, long slicePitch, IntPtr data)
: base(context, flags)
{
ComputeErrorCode error = ComputeErrorCode.Success;
Handle = CL10.CreateImage3D(context.Handle, flags, ref format, new IntPtr(width), new IntPtr(height), new IntPtr(depth), new IntPtr(rowPitch), new IntPtr(slicePitch), data, out error);
ComputeException.ThrowOnError(error);
Init();
}
示例7: CreateFromGLTexture3D
public static new CLMemoryHandle CreateFromGLTexture3D(
CLContextHandle context,
ComputeMemoryFlags flags,
Int32 target,
Int32 miplevel,
Int32 texture,
out ComputeErrorCode errcode_ret)
{
Trace.WriteLine("WARNING! clCreateFromGLTexture3D has been deprecated in OpenCL 1.2.");
return CL11.CreateFromGLTexture3D(context, flags, target, miplevel, texture, out errcode_ret);
}
示例8: CreateImage2D
public static new CLMemoryHandle CreateImage2D(
CLContextHandle context,
ComputeMemoryFlags flags,
ref ComputeImageFormat image_format,
IntPtr image_width,
IntPtr image_height,
IntPtr image_row_pitch,
IntPtr host_ptr,
out ComputeErrorCode errcode_ret)
{
Trace.WriteLine("WARNING! clCreateImage2D has been deprecated in OpenCL 1.2.");
return CL11.CreateImage2D(context, flags, ref image_format, image_width, image_height, image_row_pitch, host_ptr, out errcode_ret);
}
示例9: GetSupportedImageFormats
public static extern ComputeErrorCode GetSupportedImageFormats(
CLContextHandle context,
ComputeMemoryFlags flags,
ComputeMemoryType image_type,
Int32 num_entries,
[Out, MarshalAs(UnmanagedType.LPArray)] ComputeImageFormat[] image_formats,
out Int32 num_image_formats);
示例10: CreateImage3D
public static extern CLMemoryHandle CreateImage3D(
CLContextHandle context,
ComputeMemoryFlags flags,
ref ComputeImageFormat image_format,
IntPtr image_width,
IntPtr image_height,
IntPtr image_depth,
IntPtr image_row_pitch,
IntPtr image_slice_pitch,
IntPtr host_ptr,
out ComputeErrorCode errcode_ret);
示例11: CreateFromGLTexture3D
public static extern CLMemoryHandle CreateFromGLTexture3D(
CLContextHandle context,
ComputeMemoryFlags flags,
Int32 target,
Int32 miplevel,
Int32 texture,
out ComputeErrorCode errcode_ret);
示例12: CreateFromGLRenderbuffer
public static extern CLMemoryHandle CreateFromGLRenderbuffer(
CLContextHandle context,
ComputeMemoryFlags flags,
Int32 renderbuffer,
out ComputeErrorCode errcode_ret);
示例13: CreateFromGLTexture2D
public CLMemoryHandle CreateFromGLTexture2D(CLContextHandle context, ComputeMemoryFlags flags, Int32 target, Int32 miplevel, Int32 texture, out ComputeErrorCode errcode_ret)
{
return StaticCreateFromGLTexture2D(context, flags, target, miplevel, texture, out errcode_ret);
}
示例14: GetSupportedFormats
/// <summary>
/// Gets a collection of supported <c>ComputeImage3D</c> <c>ComputeImageFormat</c>s in a <c>ComputeContext</c>.
/// </summary>
/// <param name="context"> The <c>ComputeContext</c> for which the collection of <c>ComputeImageFormat</c>s is queried. </param>
/// <param name="flags"> The <c>ComputeMemoryFlags</c> for which the collection of <c>ComputeImageFormat</c>s is queried. </param>
/// <returns> The collection of the required <c>ComputeImageFormat</c>s. </returns>
public static ICollection<ComputeImageFormat> GetSupportedFormats(ComputeContext context, ComputeMemoryFlags flags)
{
return GetSupportedFormats(context, flags, ComputeMemoryType.Image3D);
}
示例15: CreateSubBuffer
public static unsafe extern IntPtr CreateSubBuffer(
IntPtr buffer,
ComputeMemoryFlags flags,
ComputeBufferCreateType buffer_create_type,
/* const void * */ IntPtr buffer_create_info,
ComputeErrorCode* errcode_ret);