/// <summary> /// Creates a new <see cref="TextureClearValue"/> for a render target /// </summary> /// <param name="color">The <see cref="Rgba128"/> to optimise clearing for</param> /// <returns>A new <see cref="TextureClearValue"/></returns> public static TextureClearValue CreateForRenderTarget(Rgba128 color) => new TextureClearValue { Color = color };
/// <summary> /// Creates a new <see cref="TextureDesc"/> representing a 2D render target, with no height or width, for unspecified size targets /// </summary> /// <param name="format">The <see cref="BackBufferFormat"/> for the render target</param> /// <param name="clearColor">The <see cref="Rgba128"/> to set to be the optimized clear value</param> /// <param name="msaa">Optionally, the <see cref="MsaaDesc"/> for the render target</param> /// <returns>A new <see cref="TextureDesc"/> representing a render target</returns> public static TextureDesc CreateRenderTargetDesc(DataFormat format, Rgba128 clearColor, MsaaDesc msaa = default) => CreateRenderTargetDesc(format, 0, 0, clearColor, msaa);
/// <summary> /// Creates a new <see cref="TextureDesc"/> representing a 2D render target /// </summary> /// <param name="format">The <see cref="DataFormat"/> for the render target</param> /// <param name="width">The width, in texels, of the target</param> /// <param name="height">The height, in texels, of the target</param> /// <param name="clearColor">The <see cref="Rgba128"/> to set to be the optimized clear value</param> /// <param name="msaa">Optionally, the <see cref="MsaaDesc"/> for the render target</param> /// <returns>A new <see cref="TextureDesc"/> representing a render target</returns> public static TextureDesc CreateRenderTargetDesc(DataFormat format, uint width, uint height, Rgba128 clearColor, MsaaDesc msaa = default) { return(new TextureDesc { Height = height, Width = width, DepthOrArraySize = 1, MipCount = 1, Dimension = TextureDimension.Tex2D, Format = format, ClearValue = TextureClearValue.CreateForRenderTarget(clearColor), Msaa = msaa, ResourceFlags = ResourceFlags.AllowRenderTarget, Layout = TextureLayout.Optimal }); }
/// <summary> /// Creates a new <see cref="TextureDesc"/> representing a 2D render target /// </summary> /// <param name="format">The <see cref="BackBufferFormat"/> for the render target</param> /// <param name="width">The width, in texels, of the target</param> /// <param name="height">The height, in texels, of the target</param> /// <param name="clearColor">The <see cref="Rgba128"/> to set to be the optimized clear value</param> /// <param name="msaa">Optionally, the <see cref="MsaaDesc"/> for the render target</param> /// <returns>A new <see cref="TextureDesc"/> representing a render target</returns> public static TextureDesc CreateRenderTargetDesc(BackBufferFormat format, uint width, uint height, Rgba128 clearColor, MsaaDesc msaa = default) => CreateRenderTargetDesc((DataFormat)format, width, height, clearColor, msaa);