/// <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>
 public D3D11RenderTargetViewDesc(
     D3D11Texture3D texture,
     DxgiFormat format,
     uint mipSlice)
     : this(texture, format, mipSlice, 0, uint.MaxValue)
 {
 }
 /// <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>
 public D3D11UnorderedAccessViewDesc(
     D3D11Texture3D texture,
     DxgiFormat format,
     uint mipSlice)
     : this(texture, format, mipSlice, 0, uint.MaxValue)
 {
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 /// <param name="format">The viewing format.</param>
 /// <param name="mostDetailedMip">The index of the most detailed mipmap level to use.</param>
 public D3D11ShaderResourceViewDesc(
     D3D11Texture3D texture,
     DxgiFormat format,
     uint mostDetailedMip)
     : this(texture, format, mostDetailedMip, uint.MaxValue)
 {
 }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct.
        /// </summary>
        /// <param name="texture">A 3D texture.</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(
            D3D11Texture3D texture,
            DxgiFormat format,
            uint mostDetailedMip,
            uint mipLevels)
        {
            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 = D3D11SrvDimension.Texture3D;

            if (format == DxgiFormat.Unknown || mipLevels == uint.MaxValue)
            {
                var description = texture.Description;

                if (format == DxgiFormat.Unknown)
                {
                    format = description.Format;
                }

                if (mipLevels == uint.MaxValue)
                {
                    mipLevels = description.MipLevels - mostDetailedMip;
                }
            }

            this.format = format;

            this.texture3D = new D3D11Texture3DSrv
            {
                MostDetailedMip = mostDetailedMip,
                MipLevels       = mipLevels
            };
        }
        /// <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
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct.
        /// </summary>
        /// <param name="texture">A 3D 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="topLeftY">The Y position of the top 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(D3D11Texture3D texture, D3D11RenderTargetView view, float topLeftX, float topLeftY, 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.Texture3D:
                mipSlice = viewDescription.Texture3D.MipSlice;
                break;

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

            uint subResourceWidth  = textureDescription.Width / (uint)(1 << (int)mipSlice);
            uint subResourceHeight = textureDescription.Height / (uint)(1 << (int)mipSlice);

            this.topLeftX = topLeftX;
            this.topLeftY = topLeftY;
            this.width    = (subResourceWidth != 0 ? subResourceWidth : 1) - topLeftX;
            this.height   = (subResourceHeight != 0 ? subResourceHeight : 1) - topLeftY;
            this.minDepth = minDepth;
            this.maxDepth = maxDepth;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct.
 /// </summary>
 /// <param name="texture">A 3D 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="topLeftY">The Y position of the top of the viewport.</param>
 public D3D11Viewport(D3D11Texture3D texture, D3D11RenderTargetView view, float topLeftX, float topLeftY)
     : this(texture, view, topLeftX, topLeftY, 0.0f, 1.0f)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11Viewport"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 /// <param name="view">The render-target view.</param>
 public D3D11Viewport(D3D11Texture3D texture, D3D11RenderTargetView view)
     : this(texture, view, 0.0f, 0.0f, 0.0f, 1.0f)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11RenderTargetViewDesc"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 public D3D11RenderTargetViewDesc(
     D3D11Texture3D texture)
     : this(texture, DxgiFormat.Unknown, 0, 0, uint.MaxValue)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11UnorderedAccessViewDesc"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 public D3D11UnorderedAccessViewDesc(
     D3D11Texture3D texture)
     : this(texture, DxgiFormat.Unknown, 0, 0, uint.MaxValue)
 {
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 /// <param name="format">The viewing format.</param>
 public D3D11ShaderResourceViewDesc(
     D3D11Texture3D texture,
     DxgiFormat format)
     : this(texture, format, 0, uint.MaxValue)
 {
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D3D11ShaderResourceViewDesc"/> struct.
 /// </summary>
 /// <param name="texture">A 3D texture.</param>
 public D3D11ShaderResourceViewDesc(
     D3D11Texture3D texture)
     : this(texture, DxgiFormat.Unknown, 0, uint.MaxValue)
 {
 }