예제 #1
0
 /// <summary>
 /// Creates a new 1D <see cref="Texture" /> with a single level of mipmap.
 /// </summary>
 /// <typeparam name="T">Type of the initial data to upload to the texture</typeparam>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="width">The width.</param>
 /// <param name="format">Describes the format to use.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="textureData">Texture data. Size of must be equal to sizeof(Format) * width </param>
 /// <param name="textureFlags">true if the texture needs to support unordered read write.</param>
 /// <returns>A new instance of <see cref="Texture" /> class.</returns>
 /// <remarks>
 /// The first dimension of mipMapTextures describes the number of array (Texture Array), second dimension is the mipmap, the third is the texture data for a particular mipmap.
 /// </remarks>
 public unsafe static Texture New1D <T>(GraphicsDevice device, int width, PixelFormat format, T[] textureData, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable) where T : struct
 {
     return(New(device, TextureDescription.New1D(width, format, textureFlags, usage), new[] { GetDataBox(format, width, 1, 1, textureData, (IntPtr)Interop.Fixed(textureData)) }));
 }
예제 #2
0
 /// <summary>
 /// Creates a new 1D <see cref="Texture" /> with a single level of mipmap.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice" />.</param>
 /// <param name="width">The width.</param>
 /// <param name="format">Describes the format to use.</param>
 /// <param name="dataPtr">Data ptr</param>
 /// <param name="textureFlags">true if the texture needs to support unordered read write.</param>
 /// <param name="usage">The usage.</param>
 /// <returns>A new instance of 1D <see cref="Texture" /> class.</returns>
 /// <remarks>The first dimension of mipMapTextures describes the number of array (Texture Array), second dimension is the mipmap, the third is the texture data for a particular mipmap.</remarks>
 public static Texture New1D(GraphicsDevice device, int width, PixelFormat format, IntPtr dataPtr, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
 {
     return(New(device, TextureDescription.New1D(width, format, textureFlags, usage), new[] { new DataBox(dataPtr, 0, 0), }));
 }
예제 #3
0
 /// <summary>
 /// Creates a new 1D <see cref="Texture"/>.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="width">The width.</param>
 /// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param>
 /// <param name="format">Describes the format to use.</param>
 /// <param name="usage">The usage.</param>
 /// <param name="textureFlags">true if the texture needs to support unordered read write.</param>
 /// <param name="arraySize">Size of the texture 2D array, default to 1.</param>
 /// <returns>
 /// A new instance of 1D <see cref="Texture"/> class.
 /// </returns>
 public static Texture New1D(GraphicsDevice device, int width, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, int arraySize = 1, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(New(device, TextureDescription.New1D(width, mipCount, format, textureFlags, arraySize, usage)));
 }