/// <summary> /// Initializes a new instance of the <see cref="D3D11DepthStencilViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The depth-stencil type of the view.</param> /// <param name="format">The viewing format.</param> public D3D11DepthStencilViewDesc( D3D11Texture1D texture, D3D11DsvDimension viewDimension, DxgiFormat format) : this(texture, viewDimension, format, 0, 0, uint.MaxValue, D3D11DepthStencilViewOptions.None) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> public D3D11RenderTargetViewDesc( D3D11Texture1D texture, D3D11RtvDimension viewDimension, DxgiFormat format) : this(texture, viewDimension, format, 0, 0, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> public D3D11UnorderedAccessViewDesc( D3D11Texture1D texture, D3D11UavDimension viewDimension, DxgiFormat format) : this(texture, viewDimension, format, 0, 0, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> public D3D11ShaderResourceViewDesc( D3D11Texture1D texture, D3D11SrvDimension viewDimension, DxgiFormat format) : this(texture, viewDimension, format, 0, uint.MaxValue, 0, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11DepthStencilViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The depth-stencil type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firstArraySlice">The index of the first element to use in an array of elements.</param> public D3D11DepthStencilViewDesc( D3D11Texture1D texture, D3D11DsvDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice) : this(texture, viewDimension, format, mipSlice, firstArraySlice, uint.MaxValue, D3D11DepthStencilViewOptions.None) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firtArraySlice">The index of the first element to use in an array of elements.</param> public D3D11RenderTargetViewDesc( D3D11Texture1D texture, D3D11RtvDimension viewDimension, DxgiFormat format, uint mipSlice, uint firtArraySlice) : this(texture, viewDimension, format, mipSlice, firtArraySlice, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firstArraySlice">The index of the first element to use in an array of elements.</param> public D3D11UnorderedAccessViewDesc( D3D11Texture1D texture, D3D11UavDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice) : this(texture, viewDimension, format, mipSlice, firstArraySlice, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mostDetailedMip">The index of the most detailed mipmap level to use.</param> /// <param name="mipLevels">The maximum number of mipmap levels for the view.</param> public D3D11ShaderResourceViewDesc( D3D11Texture1D texture, D3D11SrvDimension viewDimension, DxgiFormat format, uint mostDetailedMip, uint mipLevels) : this(texture, viewDimension, format, mostDetailedMip, mipLevels, 0, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="view">The render-target view.</param> /// <param name="topLeftX">The X position of the left hand side of the viewport.</param> /// <param name="minDepth">The minimum depth of the viewport.</param> /// <param name="maxDepth">The maximum depth of the viewport.</param> public D3D11Viewport(D3D11Texture1D texture, D3D11RenderTargetView view, float topLeftX, float minDepth, float maxDepth) { if (texture == null) { throw new ArgumentNullException("texture"); } if (view == null) { throw new ArgumentNullException("view"); } var textureDescription = texture.Description; var viewDescription = view.Description; uint mipSlice; switch (viewDescription.ViewDimension) { case D3D11RtvDimension.Texture1D: mipSlice = viewDescription.Texture1D.MipSlice; break; case D3D11RtvDimension.Texture1DArray: mipSlice = viewDescription.Texture1DArray.MipSlice; break; default: throw new ArgumentOutOfRangeException("view"); } uint subResourceWidth = textureDescription.Width / (uint)(1 << (int)mipSlice); this.topLeftX = topLeftX; this.topLeftY = 0.0f; this.width = (subResourceWidth != 0 ? subResourceWidth : 1) - topLeftX; this.height = 1.0f; this.minDepth = minDepth; this.maxDepth = maxDepth; }
/// <summary> /// Initializes a new instance of the <see cref="D3D11DepthStencilViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The depth-stencil type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firstArraySlice">The index of the first element to use in an array of elements.</param> /// <param name="arraySize">The number of elements in the array.</param> /// <param name="options">A value that describes whether the texture is read only.</param> public D3D11DepthStencilViewDesc( D3D11Texture1D texture, D3D11DsvDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice, uint arraySize, D3D11DepthStencilViewOptions options) { if (texture == null) { throw new ArgumentNullException("texture"); } this.texture1D = new D3D11Texture1DDsv(); this.texture1DArray = new D3D11Texture1DArrayDsv(); this.texture2D = new D3D11Texture2DDsv(); this.texture2DArray = new D3D11Texture2DArrayDsv(); this.texture2DMs = new D3D11Texture2DMsDsv(); this.texture2DMsArray = new D3D11Texture2DMsArrayDsv(); this.viewDimension = viewDimension; this.options = options; if (format == DxgiFormat.Unknown || (arraySize == uint.MaxValue && viewDimension == D3D11DsvDimension.Texture1DArray)) { var description = texture.Description; if (format == DxgiFormat.Unknown) { format = description.Format; } if (arraySize == uint.MaxValue) { arraySize = description.ArraySize - firstArraySlice; } } this.format = format; switch (viewDimension) { case D3D11DsvDimension.Texture1D: this.texture1D = new D3D11Texture1DDsv { MipSlice = mipSlice }; break; case D3D11DsvDimension.Texture1DArray: this.texture1DArray = new D3D11Texture1DArrayDsv { MipSlice = mipSlice, FirstArraySlice = firstArraySlice, ArraySize = arraySize }; break; default: throw new ArgumentOutOfRangeException("viewDimension"); } }
/// <summary> /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="view">The render-target view.</param> /// <param name="topLeftX">The X position of the left hand side of the viewport.</param> public D3D11Viewport(D3D11Texture1D texture, D3D11RenderTargetView view, float topLeftX) : this(texture, view, topLeftX, 0.0f, 1.0f) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="view">The render-target view.</param> public D3D11Viewport(D3D11Texture1D texture, D3D11RenderTargetView view) : this(texture, view, 0.0f, 0.0f, 1.0f) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firtArraySlice">The index of the first element to use in an array of elements.</param> /// <param name="arraySize">The number of elements in the array.</param> public D3D11RenderTargetViewDesc( D3D11Texture1D texture, D3D11RtvDimension viewDimension, DxgiFormat format, uint mipSlice, uint firtArraySlice, uint arraySize) { if (texture == null) { throw new ArgumentNullException("texture"); } this.buffer = new D3D11BufferRtv(); this.texture1D = new D3D11Texture1DRtv(); this.texture1DArray = new D3D11Texture1DArrayRtv(); this.texture2D = new D3D11Texture2DRtv(); this.texture2DArray = new D3D11Texture2DArrayRtv(); this.texture2DMs = new D3D11Texture2DMsRtv(); this.texture2DMsArray = new D3D11Texture2DMsArrayRtv(); this.texture3D = new D3D11Texture3DRtv(); this.viewDimension = viewDimension; if (format == DxgiFormat.Unknown || (arraySize == uint.MaxValue && viewDimension == D3D11RtvDimension.Texture1DArray)) { var description = texture.Description; if (format == DxgiFormat.Unknown) { format = description.Format; } if (arraySize == uint.MaxValue) { arraySize = description.ArraySize - firtArraySlice; } } this.format = format; switch (viewDimension) { case D3D11RtvDimension.Texture1D: this.texture1D = new D3D11Texture1DRtv { MipSlice = mipSlice }; break; case D3D11RtvDimension.Texture1DArray: this.texture1DArray = new D3D11Texture1DArrayRtv { MipSlice = mipSlice, FirstArraySlice = firtArraySlice, ArraySize = arraySize }; break; default: throw new ArgumentOutOfRangeException("viewDimension"); } }
/// <summary> /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct. /// </summary> /// <param name="texture">A 1D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> /// <param name="mostDetailedMip">The index of the most detailed mipmap level to use.</param> /// <param name="mipLevels">The maximum number of mipmap levels for the view.</param> /// <param name="firstArraySlice">The index of the first element to use in an array of elements.</param> /// <param name="arraySize">The number of elements in the array.</param> public D3D11ShaderResourceViewDesc( D3D11Texture1D texture, D3D11SrvDimension viewDimension, DxgiFormat format, uint mostDetailedMip, uint mipLevels, uint firstArraySlice, uint arraySize) { if (texture == null) { throw new ArgumentNullException("texture"); } this.buffer = new D3D11BufferSrv(); this.texture1D = new D3D11Texture1DSrv(); this.texture1DArray = new D3D11Texture1DArraySrv(); this.texture2D = new D3D11Texture2DSrv(); this.texture2DArray = new D3D11Texture2DArraySrv(); this.texture2DMs = new D3D11Texture2DMsSrv(); this.texture2DMsArray = new D3D11Texture2DMsArraySrv(); this.texture3D = new D3D11Texture3DSrv(); this.textureCube = new D3D11TextureCubeSrv(); this.textureCubeArray = new D3D11TextureCubeArraySrv(); this.bufferEx = new D3D11BufferExSrv(); this.viewDimension = viewDimension; if (format == DxgiFormat.Unknown || mipLevels == uint.MaxValue || (arraySize == uint.MaxValue && viewDimension == D3D11SrvDimension.Texture1DArray)) { var description = texture.Description; if (format == DxgiFormat.Unknown) { format = description.Format; } if (mipLevels == uint.MaxValue) { mipLevels = description.MipLevels - mostDetailedMip; } if (arraySize == uint.MaxValue) { arraySize = description.ArraySize - firstArraySlice; } } this.format = format; switch (viewDimension) { case D3D11SrvDimension.Texture1D: this.texture1D = new D3D11Texture1DSrv { MostDetailedMip = mostDetailedMip, MipLevels = mipLevels }; break; case D3D11SrvDimension.Texture1DArray: this.texture1DArray = new D3D11Texture1DArraySrv { MostDetailedMip = mostDetailedMip, MipLevels = mipLevels, FirstArraySlice = firstArraySlice, ArraySize = arraySize }; break; default: throw new ArgumentOutOfRangeException("viewDimension"); } }