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));
        }
        public unsafe Span <T> AsSpan <T>(ID3D11Texture1D resource, int mipSlice, int arraySlice) where T : unmanaged
        {
            resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize);
            Span <byte> source = new(DataPointer.ToPointer(), mipSize *resource.Description.Format.SizeOfInBytes());

            return(MemoryMarshal.Cast <byte, T>(source));
        }
Esempio n. 3
0
        public static unsafe TType[] PointerToArray <TType>(void *Pointer, int ArrayLength)
        {
            var Array = new TType[ArrayLength];

            GetArrayPointer(Array, (DataPointer) =>
            {
                Memcpy((byte *)DataPointer.ToPointer(), (byte *)Pointer, ArrayLength * Marshal.SizeOf(typeof(TType)));
            });

            return(Array);
        }
        public unsafe Span <T> AsSpan <T>(ID3D11Buffer buffer) where T : unmanaged
        {
            Span <byte> source = new(DataPointer.ToPointer(), buffer.Description.SizeInBytes);

            return(MemoryMarshal.Cast <byte, T>(source));
        }
        public unsafe Span <T> AsSpan <T>(int length) where T : unmanaged
        {
            Span <byte> source = new(DataPointer.ToPointer(), length);

            return(MemoryMarshal.Cast <byte, T>(source));
        }
Esempio n. 6
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));
 }
Esempio n. 7
0
 public unsafe Span <T> AsSpan <T>(ID3D11Texture1D resource, int mipSlice, int arraySlice)
 {
     resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize);
     return(new Span <T>(DataPointer.ToPointer(), mipSize * resource.Description.Format.SizeOfInBytes()));
 }
Esempio n. 8
0
 public unsafe Span <T> AsSpan <T>(ID3D11Buffer buffer) => new Span <T>(DataPointer.ToPointer(), buffer.Description.SizeInBytes);
Esempio n. 9
0
 public unsafe Span <T> AsSpan <T>(int sizeInBytes) => new Span <T>(DataPointer.ToPointer(), sizeInBytes);