/// <summary> /// Creates a new Cube <see cref="GPUTextureDescription"/>. /// </summary> /// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">The texture flags.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <returns>A new instance of <see cref="GPUTextureDescription"/> class.</returns> public static GPUTextureDescription NewCube(int size, PixelFormat format, GPUTextureFlags textureFlags, int mipCount) { var desc = New2D(size, size, format, textureFlags, mipCount, 6); desc.Dimensions = TextureDimensions.CubeTexture; return(desc); }
/// <summary> /// Creates a new 1D <see cref="GPUTextureDescription" />. /// </summary> /// <param name="width">The width.</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <param name="arraySize">Size of the texture 2D array, default to 1.</param> /// <returns>A new instance of 1D <see cref="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New1D(int width, PixelFormat format, GPUTextureFlags textureFlags, int mipCount, int arraySize) { GPUTextureDescription desc; desc.Dimensions = TextureDimensions.Texture; desc.Width = width; desc.Height = 1; desc.Depth = 1; desc.ArraySize = arraySize; desc.MipLevels = CalculateMipMapCount(mipCount, width); desc.Format = format; desc.MultiSampleLevel = MSAALevel.None; desc.Flags = textureFlags; desc.Usage = GPUResourceUsage.Default; desc.DefaultClearColor = Color.Black; return(desc); }
/// <summary> /// Creates a new 1D <see cref="GPUTextureDescription" /> with a single mipmap. /// </summary> /// <param name="width">The width.</param> /// <param name="format">Describes the format to use.</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="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New1D(int width, PixelFormat format, GPUTextureFlags textureFlags = GPUTextureFlags.ShaderResource | GPUTextureFlags.RenderTarget, int arraySize = 1) { return(New1D(width, format, textureFlags, 1, arraySize)); }
/// <summary> /// Creates a new Cube <see cref="GPUTextureDescription"/>. /// </summary> /// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">The texture flags.</param> /// <returns>A new instance of <see cref="GPUTextureDescription"/> class.</returns> public static GPUTextureDescription NewCube(int size, int mipCount, PixelFormat format, GPUTextureFlags textureFlags = GPUTextureFlags.ShaderResource | GPUTextureFlags.RenderTarget) { return(NewCube(size, format, textureFlags, mipCount)); }
/// <summary> /// Creates a new <see cref="GPUTextureDescription" />. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <returns>A new instance of <see cref="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New3D(int width, int height, int depth, PixelFormat format, GPUTextureFlags textureFlags, int mipCount) { GPUTextureDescription desc; desc.Dimensions = TextureDimensions.VolumeTexture; desc.Width = width; desc.Height = height; desc.Depth = depth; desc.ArraySize = 1; desc.MipLevels = CalculateMipMapCount(mipCount, Mathf.Max(width, height, depth)); desc.Format = format; desc.MultiSampleLevel = MSAALevel.None; desc.Flags = textureFlags; desc.DefaultClearColor = Color.Black; desc.Usage = GPUResourceUsage.Default; return(desc); }
/// <summary> /// Creates a new <see cref="GPUTextureDescription" />. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <returns>A new instance of <see cref="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New3D(int width, int height, int depth, int mipCount, PixelFormat format, GPUTextureFlags textureFlags = GPUTextureFlags.ShaderResource | GPUTextureFlags.RenderTarget) { return(New3D(width, height, depth, format, textureFlags, mipCount)); }
/// <summary> /// Creates a new <see cref="GPUTextureDescription" /> with a single mipmap. /// </summary> /// <param name="size">The size (width, height and depth).</param> /// <param name="format">Describes the format to use.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <returns>A new instance of <see cref="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New3D(Vector3 size, PixelFormat format, GPUTextureFlags textureFlags = GPUTextureFlags.ShaderResource | GPUTextureFlags.RenderTarget) { return(New3D((int)size.X, (int)size.Y, (int)size.Z, 1, format, textureFlags)); }
/// <summary> /// Creates a new <see cref="GPUTextureDescription" />. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="mipCount">Number of mipmaps for the texture. Default is 1. Use 0 to allocate full mip chain.</param> /// <param name="format">Describes the format to use.</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> /// <param name="msaaLevel">The MSAA Level.</param> /// <returns>A new instance of <see cref="GPUTextureDescription" /> class.</returns> public static GPUTextureDescription New2D(int width, int height, int mipCount, PixelFormat format, GPUTextureFlags textureFlags = GPUTextureFlags.ShaderResource | GPUTextureFlags.RenderTarget, int arraySize = 1, MSAALevel msaaLevel = MSAALevel.None) { return(New2D(width, height, format, textureFlags, mipCount, arraySize, msaaLevel)); }