Example #1
0
        public static Texture ToTextureView(this Texture texture, ViewType type, int arraySlice, int mipLevel)
        {
            var viewDescription = texture.ViewDescription;

            viewDescription.Type       = type;
            viewDescription.ArraySlice = arraySlice;
            viewDescription.MipLevel   = mipLevel;
            return(texture.ToTextureView(viewDescription));
        }
Example #2
0
        /// <summary>
        /// Gets a view on this depth stencil texture as a readonly depth stencil texture.
        /// </summary>
        /// <returns>A new texture object that is bouded to the requested view.</returns>
        public static Texture ToDepthStencilReadOnlyTexture(this Texture texture)
        {
            if (!texture.IsDepthStencil)
            {
                throw new NotSupportedException("This texture is not a valid depth stencil texture");
            }

            var viewDescription = texture.ViewDescription;

            viewDescription.Flags = TextureFlags.DepthStencilReadOnly;
            return(texture.ToTextureView(viewDescription));
        }