예제 #1
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));
        }
예제 #2
0
        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));
        }
예제 #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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        public unsafe Span <T> AsSpan <T>(int length) where T : unmanaged
        {
            Span <byte> source = new(DataPointer.ToPointer(), length);

            return(MemoryMarshal.Cast <byte, T>(source));
        }
예제 #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));
 }
예제 #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()));
 }
예제 #8
0
 public unsafe Span <T> AsSpan <T>(ID3D11Buffer buffer) => new Span <T>(DataPointer.ToPointer(), buffer.Description.SizeInBytes);
예제 #9
0
 public unsafe Span <T> AsSpan <T>(int sizeInBytes) => new Span <T>(DataPointer.ToPointer(), sizeInBytes);