3819 #pragma warning( push )
3820 #pragma warning( disable : 4127 ) // conditional expression is constant
3821 if ((
sizeof(_Value_type) >
sizeof(
unsigned char)) && (_Tex->
_Get_bits_per_element() != (8U *
sizeof(_Value_type))))
3823 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);
3825 #pragma warning( pop )
3834 size_t _Depth_slice_size = _Row_size * _Copy_extent[1];
3839 _ASSERTE(_Depth_pitch >= _Depth_slice_size);
3842 (_Tex_offset[1] * _Row_pitch) + (_Tex_offset[2] * _Depth_pitch);
3844 unsigned char *_PTex =
reinterpret_cast<unsigned char*
>(_Tex->
_Get_host_ptr()) + _Tex_offset_in_bytes;
3847 _Row_size /
sizeof(_Value_type), _Copy_extent[1], _Copy_extent[2],
3848 _Row_pitch, _Depth_pitch, _Row_size /
sizeof(_Value_type), _Depth_slice_size /
sizeof(_Value_type));
3860 std::array<size_t, 3> _Copy_chunk_extent;
3861 if (_Preferred_copy_chunk_extent !=
nullptr)
3863 std::copy(&_Preferred_copy_chunk_extent[0], &_Preferred_copy_chunk_extent[3], _Copy_chunk_extent.begin());
3870 std::array<size_t, 3> _Curr_copy_offset;
3871 std::copy(&_Tex_offset[0], &_Tex_offset[3], _Curr_copy_offset.begin());
3873 std::array<size_t, 3> _Remaining_copy_extent;
3874 std::copy(&_Copy_extent[0], &_Copy_extent[3], _Remaining_copy_extent.begin());
3876 bool _Truncated_copy =
false;
3879 std::array<size_t, 3> _Curr_copy_extent;
3880 _Truncated_copy =
_Get_chunked_staging_texture(_Tex, _Copy_chunk_extent.data(), _Remaining_copy_extent.data(), _Curr_copy_extent.data(), &_Staging_tex_ptr);
3883 std::array<size_t, 3> _Staging_tex_offset;
3884 _Staging_tex_offset.fill(0);
3886 _Staging_tex_ptr._Get_ptr(), _Staging_tex_offset.data(), 0,
3887 _Curr_copy_extent.data(), _Copy_chunk_extent.data());
3892 if (!_Truncated_copy)
3895 _Curr_copy_extent, _Staging_tex_offset, _Copy_chunk_extent, _First]()
mutable ->
_Event
3897 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());
3904 _Curr_copy_offset[_Tex->
_Get_rank() - 1] += _Curr_copy_extent[_Tex->
_Get_rank() - 1];
3905 return _Ev._Add_continuation(std::function<
_Event()>([_Staging_tex_ptr, _First, _Curr_copy_extent,
3906 _Staging_tex_offset, _Tex_ptr, _Curr_copy_offset, _Remaining_copy_extent, _Copy_chunk_extent, _Src_mipmap_level]()
mutable ->
_Event
3909 _Output_iterator _New_dst_iter = _First;
3910 _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]);
3911 _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());
3914 _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:2327
_OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2072
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:2693
_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:4001
details::_Reference_counted_obj_ptr< details::_Texture > _Texture_ptr
Definition: amprt.h:303
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:2519
size_t _Get_row_pitch() const
Definition: amprt.h:2387
size_t _Get_depth(unsigned int _Mip_offset=0) const
Definition: amprt.h:2296
_AMPIMP _Event _Add_event(_Event _Ev)
Creates an event which is an ordered collection of this and _Ev
#define _ASSERTE(expr)
Definition: crtdbg.h:216
_Ret_ void * _Get_host_ptr() const
Definition: amprt.h:2095
unsigned int _Get_rank() const
Definition: amprt.h:2301
size_t _Get_depth_pitch() const
Definition: amprt.h:2397
size_t _Get_height(unsigned int _Mip_offset=0) const
Definition: amprt.h:2291
void _Copy_data_on_host(int _Rank, _Input_iterator _Src, _Out_ _Value_type *_Dst, size_t _Width, size_t _Height, size_t _Depth, size_t _Dst_row_pitch_in_bytes, size_t _Dst_depth_pitch_in_bytes, size_t _Src_row_pitch, size_t _Src_depth_pitch)
Definition: amprt.h:2564
size_t _Get_width(unsigned int _Mip_offset=0) const
Definition: amprt.h:2286