public unsafe Span <T> AsSpan <T>(ID3D11Texture2D resource, int mipSlice, int arraySlice) where T : unmanaged { resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize); Span <byte> source = new Span <byte>(DataPointer.ToPointer(), mipSize * RowPitch); return(MemoryMarshal.Cast <byte, T>(source)); }
public unsafe Span <T> AsSpan <T>(ID3D11Texture2D resource, int mipSlice, int arraySlice) { resource.CalculateSubResourceIndex(mipSlice, arraySlice, out int mipSize); return(new Span <T>(DataPointer.ToPointer(), mipSize * RowPitch)); }