/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <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> public D3D11UnorderedAccessViewDesc( D3D11UavDimension viewDimension, DxgiFormat format, uint mipSlice) : this(viewDimension, format, mipSlice, 0, uint.MaxValue, D3D11BufferUavOptions.None) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 2D texture.</param> /// <param name="viewDimension">The resource type of the view.</param> /// <param name="format">The viewing format.</param> public D3D11UnorderedAccessViewDesc( D3D11Texture2D texture, D3D11UavDimension 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="buffer">A buffer.</param> /// <param name="format">The viewing format.</param> /// <param name="firstElement">The number of bytes between the beginning of the buffer and the first element to access.</param> /// <param name="numElements">The total number of elements in the view.</param> /// <param name="options">The view options for a buffer.</param> public D3D11UnorderedAccessViewDesc( D3D11Buffer buffer, DxgiFormat format, uint firstElement, uint numElements, D3D11BufferUavOptions options) { if (buffer == null) { throw new ArgumentNullException("buffer"); } this.buffer = new D3D11BufferUav(); this.texture1D = new D3D11Texture1DUav(); this.texture1DArray = new D3D11Texture1DArrayUav(); this.texture2D = new D3D11Texture2DUav(); this.texture2DArray = new D3D11Texture2DArrayUav(); this.texture3D = new D3D11Texture3DUav(); this.format = format; this.viewDimension = D3D11UavDimension.Buffer; this.buffer = new D3D11BufferUav { FirstElement = firstElement, NumElements = numElements, Options = options }; }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 2D 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( D3D11Texture2D 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="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <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> /// <param name="arraySize">The number of elements in the array.</param> public D3D11UnorderedAccessViewDesc( D3D11UavDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice, uint arraySize) : this(viewDimension, format, mipSlice, firstArraySlice, arraySize, D3D11BufferUavOptions.None) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 3D texture.</param> /// <param name="format">The viewing format.</param> /// <param name="mipSlice">The index of the mipmap level to use mip slice.</param> /// <param name="firstWSlice">The first depth level to use.</param> /// <param name="wsize">The number of depth levels to use in the render-target view.</param> public D3D11UnorderedAccessViewDesc( D3D11Texture3D texture, DxgiFormat format, uint mipSlice, uint firstWSlice, uint wsize) { if (texture == null) { throw new ArgumentNullException("texture"); } this.buffer = new D3D11BufferUav(); this.texture1D = new D3D11Texture1DUav(); this.texture1DArray = new D3D11Texture1DArrayUav(); this.texture2D = new D3D11Texture2DUav(); this.texture2DArray = new D3D11Texture2DArrayUav(); this.texture3D = new D3D11Texture3DUav(); this.viewDimension = D3D11UavDimension.Texture3D; if (format == DxgiFormat.Unknown || wsize == uint.MaxValue) { var description = texture.Description; if (format == DxgiFormat.Unknown) { format = description.Format; } if (wsize == uint.MaxValue) { wsize = description.Depth - firstWSlice; } } this.format = format; this.texture3D = new D3D11Texture3DUav { MipSlice = mipSlice, FirstWSlice = firstWSlice, WSize = wsize }; }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="viewDimension">The resource type of the view.</param> public D3D11UnorderedAccessViewDesc( D3D11UavDimension viewDimension) : this(viewDimension, DxgiFormat.Unknown, 0, 0, uint.MaxValue, D3D11BufferUavOptions.None) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <param name="texture">A 2D 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> /// <param name="arraySize">The number of elements in the array.</param> public D3D11UnorderedAccessViewDesc( D3D11Texture2D texture, D3D11UavDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice, uint arraySize) { if (texture == null) { throw new ArgumentNullException("texture"); } this.buffer = new D3D11BufferUav(); this.texture1D = new D3D11Texture1DUav(); this.texture1DArray = new D3D11Texture1DArrayUav(); this.texture2D = new D3D11Texture2DUav(); this.texture2DArray = new D3D11Texture2DArrayUav(); this.texture3D = new D3D11Texture3DUav(); this.viewDimension = viewDimension; if (format == DxgiFormat.Unknown || (arraySize == uint.MaxValue && viewDimension == D3D11UavDimension.Texture2DArray)) { 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 D3D11UavDimension.Texture2D: this.texture2D = new D3D11Texture2DUav { MipSlice = mipSlice }; break; case D3D11UavDimension.Texture2DArray: this.texture2DArray = new D3D11Texture2DArrayUav { MipSlice = mipSlice, FirstArraySlice = firstArraySlice, ArraySize = arraySize }; break; default: throw new ArgumentOutOfRangeException("viewDimension"); } }
/// <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> public D3D11UnorderedAccessViewDesc( D3D11Texture1D texture, D3D11UavDimension viewDimension) : this(texture, viewDimension, DxgiFormat.Unknown, 0, 0, uint.MaxValue) { }
/// <summary> /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct. /// </summary> /// <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> /// <param name="arraySize">The number of elements in the array.</param> /// <param name="bufferOptions">The view options for a buffer.</param> public D3D11UnorderedAccessViewDesc( D3D11UavDimension viewDimension, DxgiFormat format, uint mipSlice, uint firstArraySlice, uint arraySize, D3D11BufferUavOptions bufferOptions) { this.buffer = new D3D11BufferUav(); this.texture1D = new D3D11Texture1DUav(); this.texture1DArray = new D3D11Texture1DArrayUav(); this.texture2D = new D3D11Texture2DUav(); this.texture2DArray = new D3D11Texture2DArrayUav(); this.texture3D = new D3D11Texture3DUav(); this.format = format; this.viewDimension = viewDimension; switch (viewDimension) { case D3D11UavDimension.Buffer: this.buffer = new D3D11BufferUav { FirstElement = mipSlice, NumElements = firstArraySlice, Options = bufferOptions }; break; case D3D11UavDimension.Texture1D: this.texture1D = new D3D11Texture1DUav { MipSlice = mipSlice }; break; case D3D11UavDimension.Texture1DArray: this.texture1DArray = new D3D11Texture1DArrayUav { MipSlice = mipSlice, FirstArraySlice = firstArraySlice, ArraySize = arraySize }; break; case D3D11UavDimension.Texture2D: this.texture2D = new D3D11Texture2DUav { MipSlice = mipSlice }; break; case D3D11UavDimension.Texture2DArray: this.texture2DArray = new D3D11Texture2DArrayUav { MipSlice = mipSlice, FirstArraySlice = firstArraySlice, ArraySize = arraySize }; break; case D3D11UavDimension.Texture3D: this.texture3D = new D3D11Texture3DUav { MipSlice = mipSlice, FirstWSlice = firstArraySlice, WSize = arraySize }; break; default: throw new ArgumentOutOfRangeException("viewDimension"); } }