/// <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="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");
            }
        }