/// <summary>
        /// Initializes a new instance of the <see cref="UnorderedAccessViewDescription1"/> struct.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="viewDimension"></param>
        /// <param name="format"></param>
        /// <param name="mipSlice"></param>
        /// <param name="firstWSlice"></param>
        /// <param name="wSize"></param>
        public UnorderedAccessViewDescription1(
            ID3D11Texture3D texture,
            UnorderedAccessViewDimension viewDimension,
            Format format   = Format.Unknown,
            int mipSlice    = 0,
            int firstWSlice = 0,
            int wSize       = -1) : this()
        {
            ViewDimension = viewDimension;

            if (format == Format.Unknown || wSize == -1)
            {
                var textureDesc = texture.Description;
                if (format == Format.Unknown)
                {
                    format = textureDesc.Format;
                }
                if (wSize == -1)
                {
                    wSize = textureDesc.Depth - firstWSlice;
                }
            }
            Format                = format;
            Texture3D.MipSlice    = mipSlice;
            Texture3D.FirstWSlice = firstWSlice;
            Texture3D.WSize       = wSize;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderTargetViewDescription"/> struct.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="format"></param>
        /// <param name="mipSlice"></param>
        /// <param name="firstWSlice"></param>
        /// <param name="wSize"></param>
        public RenderTargetViewDescription(
            ID3D11Texture3D texture,
            Format format   = Format.Unknown,
            int mipSlice    = 0,
            int firstWSlice = 0,
            int wSize       = -1)
            : this()
        {
            ViewDimension = RenderTargetViewDimension.Texture3D;
            if (format == Format.Unknown || wSize == -1)
            {
                var textureDesc = texture.Description;
                if (format == Format.Unknown)
                {
                    format = textureDesc.Format;
                }
                if (wSize == -1)
                {
                    wSize = textureDesc.Depth - firstWSlice;
                }
            }

            Format                = format;
            Texture3D.MipSlice    = mipSlice;
            Texture3D.FirstWSlice = firstWSlice;
            Texture3D.WSize       = wSize;
        }
예제 #3
0
        public unsafe Span <T> AsSpan <T>(ID3D11Texture3D resource, int mipSlice, int arraySlice) where T : unmanaged
        {
            resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize);
            Span <byte> source = new(DataPointer.ToPointer(), mipSize *DepthPitch);

            return(MemoryMarshal.Cast <byte, T>(source));
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShaderResourceViewDescription1"/> struct.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="format"></param>
        /// <param name="mostDetailedMip"></param>
        /// <param name="mipLevels"></param>
        public ShaderResourceViewDescription1(
            ID3D11Texture3D texture,
            Format format       = Format.Unknown,
            int mostDetailedMip = 0,
            int mipLevels       = -1)
            : this()
        {
            ViewDimension = ShaderResourceViewDimension.Texture3D;
            if (format == Format.Unknown || mipLevels == -1)
            {
                var textureDesc = texture.Description;
                if (format == Format.Unknown)
                {
                    format = textureDesc.Format;
                }
                if (mipLevels == -1)
                {
                    mipLevels = textureDesc.MipLevels - mostDetailedMip;
                }
            }

            Format = format;
            Texture3D.MostDetailedMip = mostDetailedMip;
            Texture3D.MipLevels       = mipLevels;
        }
예제 #5
0
 public unsafe Span <T> AsSpan <T>(ID3D11Texture3D resource, int mipSlice, int arraySlice)
 {
     resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize);
     return(new Span <T>(DataPointer.ToPointer(), mipSize * DepthPitch));
 }