3842 _ASSERTE(_Tex !=
nullptr);
3843 _ASSERTE(_Tex_offset !=
nullptr);
3844 _ASSERTE(_Copy_extent !=
nullptr);
3847 _ASSERTE((_Tex_offset[0] + _Copy_extent[0]) <= _Tex->
_Get_width(_Src_mipmap_level));
3848 _ASSERTE((_Tex_offset[1] + _Copy_extent[1]) <= _Tex->
_Get_height(_Src_mipmap_level));
3849 _ASSERTE((_Tex_offset[2] + _Copy_extent[2]) <= _Tex->
_Get_depth(_Src_mipmap_level));
3851 #pragma warning( push )
3852 #pragma warning( disable : 4127 ) // conditional expression is constant
3853 if ((
sizeof(_Value_type) >
sizeof(
unsigned char)) && (_Tex->
_Get_bits_per_element() != (8U *
sizeof(_Value_type))))
3855 throw runtime_exception(
"Iterator-based copy is not supported on textures where the size of the _Value_type is not equal to the texel size.", E_INVALIDARG);
3857 #pragma warning( pop )
3866 size_t _Depth_slice_size = _Row_size * _Copy_extent[1];
3870 _ASSERTE(_Row_pitch >= _Row_size);
3871 _ASSERTE(_Depth_pitch >= _Depth_slice_size);
3874 (_Tex_offset[1] * _Row_pitch) + (_Tex_offset[2] * _Depth_pitch);
3876 unsigned char *_PTex =
reinterpret_cast<unsigned char*
>(_Tex->
_Get_host_ptr()) + _Tex_offset_in_bytes;
3879 _Row_size /
sizeof(_Value_type), _Copy_extent[1], _Copy_extent[2],
3880 _Row_pitch, _Depth_pitch, _Row_size /
sizeof(_Value_type), _Depth_slice_size /
sizeof(_Value_type));
3892 std::array<size_t, 3> _Copy_chunk_extent;
3893 if (_Preferred_copy_chunk_extent !=
nullptr)
3895 std::copy(&_Preferred_copy_chunk_extent[0], &_Preferred_copy_chunk_extent[3], _Copy_chunk_extent.begin());
3902 std::array<size_t, 3> _Curr_copy_offset;
3903 std::copy(&_Tex_offset[0], &_Tex_offset[3], _Curr_copy_offset.begin());
3905 std::array<size_t, 3> _Remaining_copy_extent;
3906 std::copy(&_Copy_extent[0], &_Copy_extent[3], _Remaining_copy_extent.begin());
3908 bool _Truncated_copy =
false;
3911 std::array<size_t, 3> _Curr_copy_extent;
3912 _Truncated_copy =
_Get_chunked_staging_texture(_Tex, _Copy_chunk_extent.data(), _Remaining_copy_extent.data(), _Curr_copy_extent.data(), &_Staging_tex_ptr);
3915 std::array<size_t, 3> _Staging_tex_offset;
3916 _Staging_tex_offset.fill(0);
3918 _Staging_tex_ptr._Get_ptr(), _Staging_tex_offset.data(), 0,
3919 _Curr_copy_extent.data(), _Copy_chunk_extent.data());
3924 if (!_Truncated_copy)
3927 _Curr_copy_extent, _Staging_tex_offset, _Copy_chunk_extent, _First]()
mutable ->
_Event
3929 return _Copy_async_impl<_Output_iterator, _Value_type>(_Staging_tex_ptr, _Staging_tex_offset.data(), 0, _Curr_copy_extent.data(), _First, _Copy_chunk_extent.data());
3936 _Curr_copy_offset[_Tex->
_Get_rank() - 1] += _Curr_copy_extent[_Tex->
_Get_rank() - 1];
3937 return _Ev._Add_continuation(std::function<
_Event()>([_Staging_tex_ptr, _First, _Curr_copy_extent,
3938 _Staging_tex_offset, _Tex_ptr, _Curr_copy_offset, _Remaining_copy_extent, _Copy_chunk_extent, _Src_mipmap_level]()
mutable ->
_Event
3941 _Output_iterator _New_dst_iter = _First;
3942 _Advance_output_iterator<decltype(_New_dst_iter), size_t>(_New_dst_iter, (((_Curr_copy_extent[0] * _Tex_ptr->_Get_bits_per_element()) >> 3) /
sizeof(_Value_type)) * _Curr_copy_extent[1] * _Curr_copy_extent[2]);
3943 _Event _Ev1 = _Copy_async_impl<_Output_iterator, _Value_type>(_Tex_ptr, _Curr_copy_offset.data(), _Src_mipmap_level, _Remaining_copy_extent.data(), _New_dst_iter, _Copy_chunk_extent.data());
3946 _Event _Ev2 = _Copy_async_impl<_Output_iterator, _Value_type>(_Staging_tex_ptr, _Staging_tex_offset.data(), 0, _Curr_copy_extent.data(), _First, _Copy_chunk_extent.data());
unsigned int _Get_bits_per_element() const
Definition: amprt.h:2251
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2369
void _Get_preferred_copy_chunk_extent(unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, size_t _Bits_per_element, _Out_writes_(3) size_t *_Preferred_copy_chunk_extent)
Definition: amprt.h:2619
_AMPIMP _Event _Add_continuation(const std::function< _Event __cdecl()> &_Continuation_task)
Creates an event which is an ordered collection of this and a continuation task
_Event _Copy_async_impl(_Input_iterator _First, _Input_iterator _Last, const _Texture_base< _Value_type, _Rank > &_Dst, const index< _Rank > &_Dst_offset, const extent< _Rank > &_Copy_extent)
Definition: amp_graphics.h:4033
details::_Reference_counted_obj_ptr< details::_Texture > _Texture_ptr
Definition: amprt.h:309
bool _Get_chunked_staging_texture(_In_ _Texture *_Tex, const size_t *_Copy_chunk_extent, _Inout_ size_t *_Remaining_copy_extent, _Out_ size_t *_Curr_copy_extent, _Out_ _Texture_ptr *_Staging_texture)
Definition: amprt.h:2443
size_t _Get_row_pitch() const
Definition: amprt.h:2311
void _Copy_data_on_host_dst_iter(int _Rank, const _Value_type *_Src, _Output_iterator _Dst, size_t _Width, size_t _Height, size_t _Depth, size_t _Src_row_pitch_in_bytes, size_t _Src_depth_pitch_in_bytes, size_t _Dst_row_pitch, size_t _Dst_depth_pitch)
Definition: amprt.h:2553
size_t _Get_depth(unsigned int _Mip_offset=0) const
Definition: amprt.h:2220
_AMPIMP _Event _Add_event(_Event _Ev)
Creates an event which is an ordered collection of this and _Ev
_Ret_ void * _Get_host_ptr() const
Definition: amprt.h:2019
unsigned int _Get_rank() const
Definition: amprt.h:2225
size_t _Get_depth_pitch() const
Definition: amprt.h:2321
size_t _Get_height(unsigned int _Mip_offset=0) const
Definition: amprt.h:2215
size_t _Get_width(unsigned int _Mip_offset=0) const
Definition: amprt.h:2210