コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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 D3D11RenderTargetViewDesc(
     D3D11Texture2D texture,
     D3D11RtvDimension viewDimension,
     DxgiFormat format)
     : this(texture, viewDimension, format, 0, 0, uint.MaxValue)
 {
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct.
        /// </summary>
        /// <param name="buffer">A buffer.</param>
        /// <param name="format">The viewing format.</param>
        /// <param name="firstElement">The buffer and the first element to access.</param>
        /// <param name="numElements">The total number of elements in the view.</param>
        public D3D11RenderTargetViewDesc(
            D3D11Buffer buffer,
            DxgiFormat format,
            uint firstElement,
            uint numElements)
        {
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }

            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.format        = format;
            this.viewDimension = D3D11RtvDimension.Buffer;
            this.buffer        = new D3D11BufferRtv
            {
                FirstElement = firstElement,
                NumElements  = numElements
            };
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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 D3D11RenderTargetViewDesc(
     D3D11RtvDimension viewDimension,
     DxgiFormat format,
     uint mipSlice)
     : this(viewDimension, format, mipSlice, 0, uint.MaxValue)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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="firtArraySlice">The index of the first element to use in an array of elements.</param>
 public D3D11RenderTargetViewDesc(
     D3D11Texture2D texture,
     D3D11RtvDimension viewDimension,
     DxgiFormat format,
     uint mipSlice,
     uint firtArraySlice)
     : this(texture, viewDimension, format, mipSlice, firtArraySlice, uint.MaxValue)
 {
 }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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="firtWSlice">The first depth level to use.</param>
        /// <param name="wsize">The number of depth levels to use in the render-target view.</param>
        public D3D11RenderTargetViewDesc(
            D3D11Texture3D texture,
            DxgiFormat format,
            uint mipSlice,
            uint firtWSlice,
            uint wsize)
        {
            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 = D3D11RtvDimension.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 - firtWSlice;
                }
            }

            this.format    = format;
            this.texture3D = new D3D11Texture3DRtv
            {
                MipSlice    = mipSlice,
                FirstWSlice = firtWSlice,
                WSize       = wsize
            };
        }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct.
 /// </summary>
 /// <param name="viewDimension">The resource type of the view.</param>
 public D3D11RenderTargetViewDesc(
     D3D11RtvDimension viewDimension)
     : this(viewDimension, DxgiFormat.Unknown, 0, 0, uint.MaxValue)
 {
 }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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="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(
            D3D11Texture2D 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.Texture2DArray ||
                  viewDimension == D3D11RtvDimension.Texture2DMsArray)))
            {
                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.Texture2D:
                this.texture2D = new D3D11Texture2DRtv
                {
                    MipSlice = mipSlice
                };
                break;

            case D3D11RtvDimension.Texture2DArray:
                this.texture2DArray = new D3D11Texture2DArrayRtv
                {
                    MipSlice        = mipSlice,
                    FirstArraySlice = firtArraySlice,
                    ArraySize       = arraySize
                };
                break;

            case D3D11RtvDimension.Texture2DMs:
                this.texture2DMs = new D3D11Texture2DMsRtv
                {
                };
                break;

            case D3D11RtvDimension.Texture2DMsArray:
                this.texture2DMsArray = new D3D11Texture2DMsArrayRtv
                {
                    FirstArraySlice = firtArraySlice,
                    ArraySize       = arraySize
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("viewDimension");
            }
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> 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="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(
            D3D11RtvDimension viewDimension,
            DxgiFormat format,
            uint mipSlice,
            uint firtArraySlice,
            uint arraySize)
        {
            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.format        = format;
            this.viewDimension = viewDimension;

            switch (viewDimension)
            {
            case D3D11RtvDimension.Buffer:
                this.buffer = new D3D11BufferRtv
                {
                    FirstElement = mipSlice,
                    NumElements  = firtArraySlice
                };
                break;

            case D3D11RtvDimension.Texture1D:
                this.texture1D = new D3D11Texture1DRtv
                {
                    MipSlice = mipSlice
                };
                break;

            case D3D11RtvDimension.Texture1DArray:
                this.texture1DArray = new D3D11Texture1DArrayRtv
                {
                    MipSlice        = mipSlice,
                    FirstArraySlice = firtArraySlice,
                    ArraySize       = arraySize
                };
                break;

            case D3D11RtvDimension.Texture2D:
                this.texture2D = new D3D11Texture2DRtv
                {
                    MipSlice = mipSlice
                };
                break;

            case D3D11RtvDimension.Texture2DArray:
                this.texture2DArray = new D3D11Texture2DArrayRtv
                {
                    MipSlice        = mipSlice,
                    FirstArraySlice = firtArraySlice,
                    ArraySize       = arraySize
                };
                break;

            case D3D11RtvDimension.Texture2DMs:
                this.texture2DMs = new D3D11Texture2DMsRtv
                {
                };
                break;

            case D3D11RtvDimension.Texture2DMsArray:
                this.texture2DMsArray = new D3D11Texture2DMsArrayRtv
                {
                    FirstArraySlice = firtArraySlice,
                    ArraySize       = arraySize
                };
                break;

            case D3D11RtvDimension.Texture3D:
                this.texture3D = new D3D11Texture3DRtv
                {
                    MipSlice    = mipSlice,
                    FirstWSlice = firtArraySlice,
                    WSize       = arraySize
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("viewDimension");
            }
        }