STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Functions
Concurrency::graphics::details Namespace Reference

Classes

struct  _Short_vector_type_traits
 
struct  _Short_vector_type_traits< double >
 
struct  _Short_vector_type_traits< double_2 >
 
struct  _Short_vector_type_traits< double_3 >
 
struct  _Short_vector_type_traits< double_4 >
 
struct  _Short_vector_type_traits< float >
 
struct  _Short_vector_type_traits< float_2 >
 
struct  _Short_vector_type_traits< float_3 >
 
struct  _Short_vector_type_traits< float_4 >
 
struct  _Short_vector_type_traits< int >
 
struct  _Short_vector_type_traits< int_2 >
 
struct  _Short_vector_type_traits< int_3 >
 
struct  _Short_vector_type_traits< int_4 >
 
struct  _Short_vector_type_traits< norm >
 
struct  _Short_vector_type_traits< norm_2 >
 
struct  _Short_vector_type_traits< norm_3 >
 
struct  _Short_vector_type_traits< norm_4 >
 
struct  _Short_vector_type_traits< uint_2 >
 
struct  _Short_vector_type_traits< uint_3 >
 
struct  _Short_vector_type_traits< uint_4 >
 
struct  _Short_vector_type_traits< unorm >
 
struct  _Short_vector_type_traits< unorm_2 >
 
struct  _Short_vector_type_traits< unorm_3 >
 
struct  _Short_vector_type_traits< unorm_4 >
 
struct  _Short_vector_type_traits< unsigned int >
 
class  _Texture_base
 
struct  texture_traits
 
struct  texture_traits< const texture< _Value_type, _Rank > >
 
struct  texture_traits< const texture_view< _Value_type, _Rank > >
 
struct  texture_traits< const texture_view< const _Value_type, _Rank > >
 
struct  texture_traits< const writeonly_texture_view< _Value_type, _Rank > >
 
struct  texture_traits< texture< _Value_type, _Rank > >
 
struct  texture_traits< texture_view< _Value_type, _Rank > >
 
struct  texture_traits< texture_view< const _Value_type, _Rank > >
 
struct  texture_traits< writeonly_texture_view< _Value_type, _Rank > >
 

Functions

template<typename _Short_vector_type >
unsigned int _Get_default_bits_per_scalar_element ()
 
template<int _Rank>
std::array< size_t, 3 > _Get_dimensions (const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
 
template<int _Rank>
std::array< size_t, 3 > _Get_indices (const index< _Rank > &_Idx)
 
template<int _Rank>
Concurrency::extent< _Rank > _Create_extent (size_t _Width, size_t _Height, size_t _Depth)
 
template<typename _Value_type , int _Rank>
_Event _Copy_async_impl (const void *_Src, unsigned int _Src_byte_size, const _Texture_base< _Value_type, _Rank > &_Dst, const index< _Rank > &_Offset, const Concurrency::extent< _Rank > &_Copy_extent)
 
template<typename OutputIterator , typename _Value_type , int _Rank>
_Event _Copy_async_impl (const _Texture_base< _Value_type, _Rank > &_Src, OutputIterator _Dest_iter)
 
template<typename _Value_type , int _Rank>
_Event _Copy_async_impl (const _Texture_base< _Value_type, _Rank > &_Src, const index< _Rank > &_Src_offset, const _Texture_base< _Value_type, _Rank > &_Dst, const index< _Rank > &_Dst_offset, const extent< _Rank > &_Copy_extent)
 
void _Is_valid_data_length (unsigned int _Num_elems, unsigned int _Bits_per_elem)
 
template<typename _Value_type , int _Rank>
unsigned int _Get_section_size (const _Texture_base< _Value_type, _Rank > &_Tex, const extent< _Rank > &_Extent)
 
template<typename _Input_iterator , typename _Value_type >
_Event _Copy_async_impl (_Input_iterator _First, _Input_iterator _Last, _In_ _Texture *_Dst, const size_t *_Dst_offset, unsigned int _Dst_mipmap_level, const size_t *_Copy_extent, const size_t *_Preferred_copy_chunk_extent=NULL)
 
template<typename _Output_iterator , typename _Value_type >
_Event _Copy_async_impl (_Texture *_Tex, const size_t *_Tex_offset, unsigned int _Src_mipmap_level, const size_t *_Copy_extent, _Output_iterator _First, const size_t *_Preferred_copy_chunk_extent=NULL)
 
template<typename _Value_type , int _Rank>
_Event _Copy_async_impl (const _Texture_base< _Value_type, _Rank > &_Src, const index< _Rank > &_Src_offset, const extent< _Rank > &_Copy_extent, _Out_ void *_Dst, unsigned int _Dst_byte_size)
 
template<typename _Output_iterator , typename _Value_type , int _Rank>
_Event _Copy_async_impl (const _Texture_base< _Value_type, _Rank > &_Src, const index< _Rank > &_Src_offset, const extent< _Rank > &_Copy_extent, _Output_iterator _Dest_iter)
 
template<typename _Input_iterator , typename _Value_type , int _Rank>
_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)
 
template<int _Rank>
Concurrency::extent< _Rank > _Make_texture (const Concurrency::accelerator_view &_Av, _In_ IUnknown *_D3D_texture, _Texture_base_type_id _Id, _Inout_ _Texture **_Tex, DXGI_FORMAT _View_format) __CPU_ONLY
 

Function Documentation

template<typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_Copy_async_impl ( const void _Src,
unsigned int  _Src_byte_size,
const _Texture_base< _Value_type, _Rank > &  _Dst,
const index< _Rank > &  _Offset,
const Concurrency::extent< _Rank > &  _Copy_extent 
)
3923 {
3924  _Is_valid_section(_Dst.extent, _Dst_offset, _Copy_extent);
3925 
3926  if (_Dst.get_mipmap_levels() > 1)
3927  {
3928  throw runtime_exception("Invalid destination - multiple mipmap levels cannot be copied from source", E_INVALIDARG);
3929  }
3930 
3931  if (_Src_byte_size < _Get_section_size(_Dst, _Copy_extent))
3932  {
3933  if (_Dst.extent == _Copy_extent)
3934  {
3935  throw runtime_exception("Invalid _Src_byte_size argument. _Src_byte_size is smaller than the total size of _Dst.", E_INVALIDARG);
3936  }
3937  else
3938  {
3939  throw runtime_exception("Invalid _Src_byte_size argument. _Src_byte_size is smaller than the provided section of _Dst.", E_INVALIDARG);
3940  }
3941  }
3942 
3943  _Texture *_Dst_tex_ptr = _Get_texture(_Dst);
3944  std::array<size_t, 3> _Copy_extent_arr = _Get_dimensions(_Copy_extent, /*_Mip_offset=*/0);
3945  std::array<size_t, 3> _Dst_offset_arr = _Get_indices(_Dst_offset);
3946  auto _First = stdext::make_unchecked_array_iterator(reinterpret_cast<const unsigned char*>(_Src));
3947  auto _Last = stdext::make_unchecked_array_iterator(reinterpret_cast<const unsigned char*>(_Src) + _Src_byte_size);
3948 
3949  return _Copy_async_impl<decltype(_First), unsigned char>(_First, _Last, _Dst_tex_ptr, _Dst_offset_arr.data(), _Get_texture_descriptor(_Dst)._Get_most_detailed_mipmap_level(), _Copy_extent_arr.data());
3950 }
unsigned int _Get_section_size(const _Texture_base< _Value_type, _Rank > &_Tex, const extent< _Rank > &_Extent)
Definition: amp_graphics.h:3688
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:729
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1107
std::array< size_t, 3 > _Get_indices(const index< _Rank > &_Idx)
Definition: amp_graphics.h:329
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_FwdIt _Last
Definition: algorithm:1936
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
template<typename OutputIterator , typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_Copy_async_impl ( const _Texture_base< _Value_type, _Rank > &  _Src,
OutputIterator  _Dest_iter 
)
template<typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_Copy_async_impl ( const _Texture_base< _Value_type, _Rank > &  _Src,
const index< _Rank > &  _Src_offset,
const _Texture_base< _Value_type, _Rank > &  _Dst,
const index< _Rank > &  _Dst_offset,
const extent< _Rank > &  _Copy_extent 
)
4025 {
4026  _Is_valid_section(_Src.extent, _Src_offset, _Copy_extent);
4027  _Is_valid_section(_Dst.extent, _Dst_offset, _Copy_extent);
4028 
4030  _Texture_descriptor _Dst_tex_desc = _Get_texture_descriptor(_Dst);
4031 
4032  if (_Src_tex_desc._Get_view_mipmap_levels() != _Dst_tex_desc._Get_view_mipmap_levels())
4033  {
4034  throw runtime_exception("The source and destination textures must have the exactly the same number of mipmap levels for texture copy.", E_INVALIDARG);
4035  }
4036 
4037  bool _Is_whole_texture_copy = (_Src_offset == _Dst_offset && _Src_offset == index<_Rank>() && _Src.extent == _Dst.extent && _Src.extent == _Copy_extent);
4038 
4039  if (_Src_tex_desc._Get_view_mipmap_levels() > 1 && !_Is_whole_texture_copy)
4040  {
4041  throw runtime_exception("Sections are not allowed when copy involves multiple mipmap levels", E_INVALIDARG);
4042  }
4043 
4044  if (_Src_tex_desc._Are_mipmap_levels_overlapping(&_Dst_tex_desc))
4045  {
4046  throw runtime_exception("The source and destination are overlapping areas on the same texture", E_INVALIDARG);
4047  }
4048 
4049  _Texture* _Src_tex = _Get_texture(_Src);
4050  _Texture* _Dst_tex = _Get_texture(_Dst);
4051 
4052  // Formats must be identical for non-adopted textures. Textures created through D3D interop are not subject to this test
4053  // to allow copy between related, but not identical, formats. Attempting to copy between unrelated formats through interop
4054  // will result in exceptions in debug mode and undefined behavior in release mode.
4055  if (!_Src_tex->_Is_adopted() && !_Dst_tex->_Is_adopted() && (_Src_tex->_Get_texture_format() != _Dst_tex->_Get_texture_format()))
4056  {
4057  throw runtime_exception("The source and destination textures are not compatible.", E_INVALIDARG);
4058  }
4059 
4060  std::array<size_t, 3> _Src_offset_arr = _Get_indices(_Src_offset);
4061  std::array<size_t, 3> _Dst_offset_arr = _Get_indices(_Dst_offset);
4062 
4063  _Event _Copy_event;
4064 
4065  unsigned int _Src_most_detailed_mipmap_level = _Src_tex_desc._Get_most_detailed_mipmap_level();
4066  unsigned int _Dst_most_detailed_mipmap_level = _Dst_tex_desc._Get_most_detailed_mipmap_level();
4067 
4068  // Copy all mipmap levels from source to destination one by one.
4069  // Note that the offsets are not allowed therefore only dimensions need to be updated for subsequent mipmap levels
4070  for (unsigned int _Mip_offset = 0; _Mip_offset < _Src_tex_desc._Get_view_mipmap_levels(); ++_Mip_offset)
4071  {
4072  std::array<size_t, 3> _Copy_extent_arr = _Get_dimensions(_Copy_extent, _Mip_offset);
4073 
4074  auto _Step_event = _Copy_async_impl(_Src_tex, _Src_offset_arr.data(), _Src_most_detailed_mipmap_level + _Mip_offset,
4075  _Dst_tex, _Dst_offset_arr.data(), _Dst_most_detailed_mipmap_level + _Mip_offset,
4076  _Copy_extent_arr.data());
4077 
4078  _Copy_event = _Copy_event._Add_event(_Step_event);
4079  }
4080 
4081  return _Copy_event;
4082 }
unsigned int _Get_texture_format() const
Definition: amprt.h:2306
_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
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
bool _Is_adopted() const
Definition: amprt.h:2157
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1107
_AMPIMP _Event _Add_event(_Event _Ev)
Creates an event which is an ordered collection of this and _Ev
std::array< size_t, 3 > _Get_indices(const index< _Rank > &_Idx)
Definition: amp_graphics.h:329
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
unsigned int _Get_view_mipmap_levels() const __GPU
Definition: amprt.h:658
bool _Are_mipmap_levels_overlapping(const _Texture_descriptor *_Other) const __CPU_ONLY
Definition: amprt.h:694
Definition: amprt.h:312
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
template<typename _Input_iterator , typename _Value_type >
_Event Concurrency::graphics::details::_Copy_async_impl ( _Input_iterator  _First,
_Input_iterator  _Last,
_In_ _Texture _Dst,
const size_t _Dst_offset,
unsigned int  _Dst_mipmap_level,
const size_t _Copy_extent,
const size_t _Preferred_copy_chunk_extent = NULL 
)
3700 {
3701  _ASSERTE(_Dst != nullptr);
3702  _ASSERTE(_Dst_offset != nullptr);
3703  _ASSERTE(_Copy_extent != nullptr);
3704 
3705  _ASSERTE((unsigned int)std::distance(_First, _Last) >= (_Copy_extent[0] * _Copy_extent[1] * _Copy_extent[2]));
3706 
3707  // The copy region should be within the bounds of the destination texture
3708  _ASSERTE((_Dst_offset[0] + _Copy_extent[0]) <= _Dst->_Get_width(_Dst_mipmap_level));
3709  _ASSERTE((_Dst_offset[1] + _Copy_extent[1]) <= _Dst->_Get_height(_Dst_mipmap_level));
3710  _ASSERTE((_Dst_offset[2] + _Copy_extent[2]) <= _Dst->_Get_depth(_Dst_mipmap_level));
3711 
3712 #pragma warning( push )
3713 #pragma warning( disable : 4127 ) // conditional expression is constant
3714  if ((sizeof(_Value_type) > sizeof(unsigned char)) && (_Dst->_Get_bits_per_element() != (8U * sizeof(_Value_type))))
3715  {
3716  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);
3717  }
3718 #pragma warning( pop )
3719 
3720  // If the dest is accessible on the host we can perform the copy entirely on the host
3721  if (_Dst->_Get_host_ptr() != NULL)
3722  {
3723  // We have made sure that the three multiplications below won't cause integer overflow when creating the texture
3724  _ASSERTE(((_Dst->_Get_bits_per_element() * _Copy_extent[0]) % (8U * sizeof(_Value_type))) == 0);
3725 
3726  size_t _Row_size = (_Dst->_Get_bits_per_element() * _Copy_extent[0]) >> 3; // in bytes
3727  size_t _Depth_slice_size = _Row_size * _Copy_extent[1];
3728 
3729  size_t _Row_pitch = _Dst->_Get_row_pitch();
3730  size_t _Depth_pitch = _Dst->_Get_depth_pitch();
3731  _ASSERTE(_Row_pitch >= _Row_size);
3732  _ASSERTE(_Depth_pitch >= _Depth_slice_size);
3733 
3734  size_t _Dst_offset_in_bytes = ((_Dst_offset[0] * _Dst->_Get_bits_per_element()) >> 3) +
3735  (_Dst_offset[1] * _Row_pitch) + (_Dst_offset[2] * _Depth_pitch);
3736 
3737  unsigned char *_PDest = reinterpret_cast<unsigned char*>(_Dst->_Get_host_ptr()) + _Dst_offset_in_bytes;
3738 
3739  _Copy_data_on_host(_Dst->_Get_rank(), _First, reinterpret_cast<_Value_type*>(_PDest),
3740  _Row_size / sizeof(_Value_type), _Copy_extent[1], _Copy_extent[2],
3741  _Row_pitch, _Depth_pitch, _Row_size / sizeof(_Value_type), _Depth_slice_size / sizeof(_Value_type));
3742 
3743  return _Event();
3744  }
3745 
3746  // The dest is not accessbile on the host; we need to copy src to
3747  // a temporary staging texture and launch a copy from the staging texture
3748  // to the dest texture.
3749  _Event _Ev;
3750 
3751  // Determine the copy chunk extent
3752  std::array<size_t, 3> _Copy_chunk_extent;
3753  if (_Preferred_copy_chunk_extent != NULL)
3754  {
3755  std::copy(&_Preferred_copy_chunk_extent[0], &_Preferred_copy_chunk_extent[3], _Copy_chunk_extent.begin());
3756  }
3757  else
3758  {
3759  _Get_preferred_copy_chunk_extent(_Dst->_Get_rank(), _Copy_extent[0], _Copy_extent[1], _Copy_extent[2], _Dst->_Get_bits_per_element(), _Copy_chunk_extent.data());
3760  }
3761 
3762  std::array<size_t, 3> _Curr_copy_offset;
3763  std::copy(&_Dst_offset[0], &_Dst_offset[3], _Curr_copy_offset.begin());
3764 
3765  std::array<size_t, 3> _Remaining_copy_extent;
3766  std::copy(&_Copy_extent[0], &_Copy_extent[3], _Remaining_copy_extent.begin());
3767 
3768  bool _Truncated_copy = false;
3769  do
3770  {
3771  _Texture_ptr _Dst_staging_tex_ptr;
3772  std::array<size_t, 3> _Curr_copy_extent;
3773  _Truncated_copy = _Get_chunked_staging_texture(_Dst, _Copy_chunk_extent.data(), _Remaining_copy_extent.data(), _Curr_copy_extent.data(), &_Dst_staging_tex_ptr);
3774 
3775 
3776  // Now copy from the src pointer to the temp staging texture
3777  _Dst_staging_tex_ptr->_Map_buffer(_Write_access, true /* _Wait */);
3778 
3779  std::array<size_t, 3> _Dst_staging_tex_offset;
3780  _Dst_staging_tex_offset.fill(0);
3781  _Event _Temp_ev = _Copy_async_impl<_Input_iterator, _Value_type>(_First, _Last, _Dst_staging_tex_ptr,
3782  _Dst_staging_tex_offset.data(), /*_Dst_mipmap_level=*/0, _Curr_copy_extent.data(), _Copy_chunk_extent.data());
3783 
3784  // Now chain a copy from the temporary staging texture to the _Dst texture
3785  _Texture_ptr _Dst_tex_ptr = _Dst;
3786  _Temp_ev = _Temp_ev._Add_continuation(std::function<_Event()>([_Dst_staging_tex_ptr, _Dst_tex_ptr, _Curr_copy_extent,
3787  _Dst_staging_tex_offset, _Curr_copy_offset, _Dst_mipmap_level]() mutable -> _Event
3788  {
3789  return _Dst_staging_tex_ptr->_Copy_to_async(_Dst_tex_ptr, _Curr_copy_extent.data(), _Dst_staging_tex_offset.data(), _Curr_copy_offset.data(), /*_Src_mipmap_level=*/0, _Dst_mipmap_level);
3790  }));
3791 
3792  _Ev = _Ev._Add_event(_Temp_ev);
3793 
3794  // Now adjust the _Src and _Dst offsets for the remaining part of the copy
3795  if (_Truncated_copy)
3796  {
3797  // The offset only needs to be adjusted in the most significant dimension
3798  _Curr_copy_offset[_Dst->_Get_rank() - 1] += _Curr_copy_extent[_Dst->_Get_rank() - 1];
3799  std::advance(_First, (((_Curr_copy_extent[0] * _Dst->_Get_bits_per_element()) >> 3) / sizeof(_Value_type)) * _Curr_copy_extent[1] * _Curr_copy_extent[2]);
3800  }
3801 
3802  } while (_Truncated_copy);
3803 
3804  return _Ev;
3805 }
_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
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
#define NULL
Definition: crtdbg.h:30
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
_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
void advance(_InIt &_Where, _Diff _Off)
Definition: xutility:695
Definition: amprt.h:312
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
Definition: amprt.h:86
_FwdIt _Last
Definition: algorithm:1936
template<typename _Output_iterator , typename _Value_type >
_Event Concurrency::graphics::details::_Copy_async_impl ( _Texture _Tex,
const size_t _Tex_offset,
unsigned int  _Src_mipmap_level,
const size_t _Copy_extent,
_Output_iterator  _First,
const size_t _Preferred_copy_chunk_extent = NULL 
)
3809 {
3810  _ASSERTE(_Tex != nullptr);
3811  _ASSERTE(_Tex_offset != nullptr);
3812  _ASSERTE(_Copy_extent != nullptr);
3813 
3814  // The copy region should be within the bounds of the source texture
3815  _ASSERTE((_Tex_offset[0] + _Copy_extent[0]) <= _Tex->_Get_width(_Src_mipmap_level));
3816  _ASSERTE((_Tex_offset[1] + _Copy_extent[1]) <= _Tex->_Get_height(_Src_mipmap_level));
3817  _ASSERTE((_Tex_offset[2] + _Copy_extent[2]) <= _Tex->_Get_depth(_Src_mipmap_level));
3818 
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))))
3822  {
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);
3824  }
3825 #pragma warning( pop )
3826 
3827  // If the texture is available on the host then we can perform the copy entirely on the host
3828  if (_Tex->_Get_host_ptr() != nullptr)
3829  {
3830  // We have made sure that the three multiplications below won't cause integer overflow when creating the texture
3831  _ASSERTE(((_Tex->_Get_bits_per_element() * _Copy_extent[0]) % 8U) == 0);
3832 
3833  size_t _Row_size = (_Tex->_Get_bits_per_element() * _Copy_extent[0]) >> 3; // in bytes
3834  size_t _Depth_slice_size = _Row_size * _Copy_extent[1];
3835 
3836  size_t _Row_pitch = _Tex->_Get_row_pitch();
3837  size_t _Depth_pitch = _Tex->_Get_depth_pitch();
3838  _ASSERTE(_Row_pitch >= _Row_size);
3839  _ASSERTE(_Depth_pitch >= _Depth_slice_size);
3840 
3841  size_t _Tex_offset_in_bytes = ((_Tex_offset[0] * _Tex->_Get_bits_per_element()) >> 3) +
3842  (_Tex_offset[1] * _Row_pitch) + (_Tex_offset[2] * _Depth_pitch);
3843 
3844  unsigned char *_PTex = reinterpret_cast<unsigned char*>(_Tex->_Get_host_ptr()) + _Tex_offset_in_bytes;
3845 
3846  _Copy_data_on_host(_Tex->_Get_rank(), reinterpret_cast<_Value_type*>(_PTex), _First,
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));
3849 
3850  return _Event();
3851  }
3852 
3853  // The texture is not accessbile on the host; we need to copy to/from a staging
3854  // texture before the copy to the destination. This is done in chunks, such that
3855  // we can concurrently copy from the source texture to a staging texture while
3856  // copying from a staging texture from a previous chunk to the destination.
3857  _Event _Ev;
3858 
3859  // Determine the copy chunk extent
3860  std::array<size_t, 3> _Copy_chunk_extent;
3861  if (_Preferred_copy_chunk_extent != nullptr)
3862  {
3863  std::copy(&_Preferred_copy_chunk_extent[0], &_Preferred_copy_chunk_extent[3], _Copy_chunk_extent.begin());
3864  }
3865  else
3866  {
3867  _Get_preferred_copy_chunk_extent(_Tex->_Get_rank(), _Copy_extent[0], _Copy_extent[1], _Copy_extent[2], _Tex->_Get_bits_per_element(), _Copy_chunk_extent.data());
3868  }
3869 
3870  std::array<size_t, 3> _Curr_copy_offset;
3871  std::copy(&_Tex_offset[0], &_Tex_offset[3], _Curr_copy_offset.begin());
3872 
3873  std::array<size_t, 3> _Remaining_copy_extent;
3874  std::copy(&_Copy_extent[0], &_Copy_extent[3], _Remaining_copy_extent.begin());
3875 
3876  bool _Truncated_copy = false;
3877 
3878  _Texture_ptr _Staging_tex_ptr;
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);
3881 
3882  // Now copy into the temp staging texture
3883  std::array<size_t, 3> _Staging_tex_offset;
3884  _Staging_tex_offset.fill(0);
3885  _Event _Temp_ev = _Copy_async_impl(_Tex, _Curr_copy_offset.data(), _Src_mipmap_level,
3886  _Staging_tex_ptr._Get_ptr(), _Staging_tex_offset.data(), /*_Dst_mipmap_level=*/0,
3887  _Curr_copy_extent.data(), _Copy_chunk_extent.data());
3888  _Ev = _Ev._Add_event(_Temp_ev);
3889 
3890  // If we have finished our copy, we just need to add a continuation to copy
3891  // from the temporary staging texture to the _Dst pointer
3892  if (!_Truncated_copy)
3893  {
3894  return _Ev._Add_continuation(std::function<_Event()>([_Staging_tex_ptr,
3895  _Curr_copy_extent, _Staging_tex_offset, _Copy_chunk_extent, _First]() mutable -> _Event
3896  {
3897  return _Copy_async_impl<_Output_iterator, _Value_type>(_Staging_tex_ptr, _Staging_tex_offset.data(), /*_Src_mipmap_level=*/0, _Curr_copy_extent.data(), _First, _Copy_chunk_extent.data());
3898  }));
3899  }
3900  else
3901  {
3902  // The copy was truncated. We need to recursively perform the rest of the copy
3903  _Texture_ptr _Tex_ptr = _Tex;
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
3907  {
3908  // Initiate copying of the remaining portion
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());
3912 
3913  // Now copy the data from the temp staging buffer to the _Dst pointer
3914  _Event _Ev2 = _Copy_async_impl<_Output_iterator, _Value_type>(_Staging_tex_ptr, _Staging_tex_offset.data(), /*_Src_mipmap_level=*/0, _Curr_copy_extent.data(), _First, _Copy_chunk_extent.data());
3915 
3916  return _Ev2._Add_event(_Ev1);
3917  }));
3918  }
3919 }
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
Definition: amprt.h:312
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
template<typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_Copy_async_impl ( const _Texture_base< _Value_type, _Rank > &  _Src,
const index< _Rank > &  _Src_offset,
const extent< _Rank > &  _Copy_extent,
_Out_ void _Dst,
unsigned int  _Dst_byte_size 
)
3954 {
3955  _Is_valid_section(_Src.extent, _Src_offset, _Copy_extent);
3956 
3957  if (_Src.get_mipmap_levels() > 1)
3958  {
3959  throw runtime_exception("Invalid source - multiple mipmap levels cannot be copied to destination", E_INVALIDARG);
3960  }
3961 
3962  if (_Get_section_size(_Src, _Copy_extent) > _Dst_byte_size)
3963  {
3964  if (_Src.extent == _Copy_extent)
3965  {
3966  throw runtime_exception("Invalid _Dst_byte_size argument. _Dst_byte_size is smaller than the size of _Src.", E_INVALIDARG);
3967  }
3968  else
3969  {
3970  throw runtime_exception("Invalid _Dst_byte_size argument. _Dst_byte_size is smaller than the provided section of _Src.", E_INVALIDARG);
3971  }
3972  }
3973 
3974  _Texture *_Src_tex_ptr = _Get_texture(_Src);
3975  std::array<size_t, 3> _Copy_extent_arr = _Get_dimensions(_Copy_extent, /*_Mip_offset=*/0);
3976  std::array<size_t, 3> _Src_offset_arr = _Get_indices(_Src_offset);
3977 
3978  auto _First = stdext::make_unchecked_array_iterator(reinterpret_cast<unsigned char*>(_Dst));
3979 
3980  return _Copy_async_impl<decltype(_First), unsigned char>(_Src_tex_ptr, _Src_offset_arr.data(), _Get_texture_descriptor(_Src)._Get_most_detailed_mipmap_level(), _Copy_extent_arr.data(), _First);
3981 }
unsigned int _Get_section_size(const _Texture_base< _Value_type, _Rank > &_Tex, const extent< _Rank > &_Extent)
Definition: amp_graphics.h:3688
unchecked_array_iterator< _Iterator > make_unchecked_array_iterator(_Iterator _Ptr)
Definition: iterator:729
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1107
std::array< size_t, 3 > _Get_indices(const index< _Rank > &_Idx)
Definition: amp_graphics.h:329
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
template<typename _Output_iterator , typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_Copy_async_impl ( const _Texture_base< _Value_type, _Rank > &  _Src,
const index< _Rank > &  _Src_offset,
const extent< _Rank > &  _Copy_extent,
_Output_iterator  _Dest_iter 
)
3985 {
3986  _Is_valid_section(_Src.extent, _Src_offset, _Copy_extent);
3987 
3988  if (_Src.get_mipmap_levels() > 1)
3989  {
3990  throw runtime_exception("Invalid source - multiple mipmap levels cannot be copied to destination", E_INVALIDARG);
3991  }
3992 
3993  _Texture *_Src_tex_ptr = _Get_texture(_Src);
3994  std::array<size_t, 3> _Copy_extent_arr = _Get_dimensions(_Copy_extent, /*_Mip_offset=*/0);
3995  std::array<size_t, 3> _Src_offset_arr = _Get_indices(_Src_offset);
3996 
3997  return _Copy_async_impl<_Output_iterator, _Value_type>(_Src_tex_ptr, _Src_offset_arr.data(), _Get_texture_descriptor(_Src)._Get_most_detailed_mipmap_level(), _Copy_extent_arr.data(), _Dest_iter);
3998 }
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1107
std::array< size_t, 3 > _Get_indices(const index< _Rank > &_Idx)
Definition: amp_graphics.h:329
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
template<typename _Input_iterator , typename _Value_type , int _Rank>
_Event Concurrency::graphics::details::_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 
)
4002 {
4003  _Is_valid_section(_Dst.extent, _Dst_offset, _Copy_extent);
4004  if (static_cast<unsigned int>(std::distance(_First, _Last)) < _Copy_extent.size())
4005  {
4006  throw runtime_exception("Inadequate amount of data supplied through the iterators", E_INVALIDARG);
4007  }
4008 
4009  if (_Dst.get_mipmap_levels() > 1)
4010  {
4011  throw runtime_exception("Invalid destination - multiple mipmap levels cannot be copied from source", E_INVALIDARG);
4012  }
4013 
4014  std::array<size_t, 3> _Copy_extent_arr = _Get_dimensions(_Copy_extent, /*_Mip_offset=*/0);
4015  std::array<size_t, 3> _Dst_offset_arr = _Get_indices(_Dst_offset);
4016 
4017  _Texture *_Dst_tex_ptr = _Get_texture(_Dst);
4018  return _Copy_async_impl<_Input_iterator, _Value_type>(_First, _Last, _Dst_tex_ptr, _Dst_offset_arr.data(), _Get_texture_descriptor(_Dst)._Get_most_detailed_mipmap_level(), _Copy_extent_arr.data());
4019 }
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
iterator_traits< _InIt >::difference_type distance(_InIt _First, _InIt _Last)
Definition: xutility:755
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
static void _Is_valid_section(const _T2< _Rank > &_Base_extent, const _T1< _Rank > &_Section_origin, const _T2< _Rank > &_Section_extent) __CPU_ONLY
Definition: xxamp.h:1107
std::array< size_t, 3 > _Get_indices(const index< _Rank > &_Idx)
Definition: amp_graphics.h:329
_FwdIt _Last
Definition: algorithm:1936
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
template<int _Rank>
Concurrency::extent<_Rank> Concurrency::graphics::details::_Create_extent ( size_t  _Width,
size_t  _Height,
size_t  _Depth 
)
361 {
362  extent<_Rank> _Ext;
363  switch((_Rank)) {
364  case 1:
365  _Ext[0] = static_cast<int>(_Width);
366  break;
367  case 2:
368  _Ext[0] = static_cast<int>(_Height);
369  _Ext[1] = static_cast<int>(_Width);
370  break;
371  case 3:
372  _Ext[0] = static_cast<int>(_Depth);
373  _Ext[1] = static_cast<int>(_Height);
374  _Ext[2] = static_cast<int>(_Width);
375  break;
376  default:
377  _ASSERTE(false);
378  break;
379  }
380  return _Ext;
381 }
#define _ASSERTE(expr)
Definition: crtdbg.h:216
_Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char * _Ext
Definition: stdlib.h:854
template<typename _Short_vector_type >
unsigned int Concurrency::graphics::details::_Get_default_bits_per_scalar_element ( )
291 {
292  return _Short_vector_type_traits<_Short_vector_type>::_Format_base_type_id == _Double_type ?
293  _Short_vector_type_traits<_Short_vector_type>::_Default_bits_per_channel * 2 :
294  _Short_vector_type_traits<_Short_vector_type>::_Default_bits_per_channel;
295 }
Definition: amprt.h:292
template<int _Rank>
std::array<size_t, 3> Concurrency::graphics::details::_Get_dimensions ( const Concurrency::extent< _Rank > &  _Ext,
unsigned int  _Mip_offset 
)
299 {
300  std::array<size_t, 3> _Arr;
301  // For un-used dimensions, use value 1.
302  switch((_Rank)) {
303  case 1:
304  _Arr[0] = static_cast<size_t>((_Ext[0] >> _Mip_offset) ? (_Ext[0] >> _Mip_offset) : 1U);
305  _Arr[1] = 1;
306  _Arr[2] = 1;
307  break;
308  case 2:
309  _Arr[0] = static_cast<size_t>((_Ext[1] >> _Mip_offset) ? (_Ext[1] >> _Mip_offset) : 1U);
310  _Arr[1] = static_cast<size_t>((_Ext[0] >> _Mip_offset) ? (_Ext[0] >> _Mip_offset) : 1U);
311  _Arr[2] = 1;
312  break;
313  case 3:
314  _Arr[0] = static_cast<size_t>((_Ext[2] >> _Mip_offset) ? (_Ext[2] >> _Mip_offset) : 1U);
315  _Arr[1] = static_cast<size_t>((_Ext[1] >> _Mip_offset) ? (_Ext[1] >> _Mip_offset) : 1U);
316  _Arr[2] = static_cast<size_t>((_Ext[0] >> _Mip_offset) ? (_Ext[0] >> _Mip_offset) : 1U);
317  break;
318  default:
319  _ASSERTE(false);
320  _Arr[0] = 1;
321  _Arr[1] = 1;
322  _Arr[2] = 1;
323  break;
324  }
325  return _Arr;
326 }
#define _ASSERTE(expr)
Definition: crtdbg.h:216
template<int _Rank>
std::array<size_t, 3> Concurrency::graphics::details::_Get_indices ( const index< _Rank > &  _Idx)
330 {
331  std::array<size_t, 3> _Arr;
332  // For un-used dimensions, use value 0.
333  switch((_Rank)) {
334  case 1:
335  _Arr[0] = static_cast<size_t>(_Idx[0]);
336  _Arr[1] = 0;
337  _Arr[2] = 0;
338  break;
339  case 2:
340  _Arr[0] = static_cast<size_t>(_Idx[1]);
341  _Arr[1] = static_cast<size_t>(_Idx[0]);
342  _Arr[2] = 0;
343  break;
344  case 3:
345  _Arr[0] = static_cast<size_t>(_Idx[2]);
346  _Arr[1] = static_cast<size_t>(_Idx[1]);
347  _Arr[2] = static_cast<size_t>(_Idx[0]);
348  break;
349  default:
350  _ASSERTE(false);
351  _Arr[0] = 0;
352  _Arr[1] = 0;
353  _Arr[2] = 0;
354  break;
355  }
356  return _Arr;
357 }
#define _ASSERTE(expr)
Definition: crtdbg.h:216
template<typename _Value_type , int _Rank>
unsigned int Concurrency::graphics::details::_Get_section_size ( const _Texture_base< _Value_type, _Rank > &  _Tex,
const extent< _Rank > &  _Extent 
)
3689 {
3690  _Texture* _Tex_ptr = _Get_texture(_Tex);
3691  _Texture_descriptor _Tex_desc = _Get_texture_descriptor(_Tex);
3692 
3693  return _Tex_ptr->_Get_data_length(_Tex_desc._Get_most_detailed_mipmap_level(), _Tex_desc._Get_view_mipmap_levels(), _Get_dimensions(_Extent, /*Mip_offset=*/0).data());
3694 }
_Ret_ _Texture * _Get_texture(const _Texture_type &_Tex) __CPU_ONLY
Definition: xxamp.h:1101
std::array< size_t, 3 > _Get_dimensions(const Concurrency::extent< _Rank > &_Ext, unsigned int _Mip_offset)
Definition: amp_graphics.h:298
Definition: amprt.h:2228
unsigned int _Get_most_detailed_mipmap_level() const __GPU
Definition: amprt.h:653
unsigned int _Get_view_mipmap_levels() const __GPU
Definition: amprt.h:658
unsigned int _Get_data_length(unsigned int _Most_detailed_mipmap_level, unsigned int _View_mipmap_levels, const size_t *_Extents=nullptr) const
Definition: amprt.h:2332
const _Texture_descriptor & _Get_texture_descriptor(const _Texture_type &_Tex) __GPU
Definition: xxamp.h:1095
void Concurrency::graphics::details::_Is_valid_data_length ( unsigned int  _Num_elems,
unsigned int  _Bits_per_elem 
)
inline
597 {
598  unsigned long long _Bytes_per_elem = static_cast<unsigned long long>(_Bits_per_elem / 8U);
599  unsigned long long _Total_bytes = static_cast<unsigned long long>(_Num_elems) * _Bytes_per_elem;
600  if (_Total_bytes > static_cast<unsigned long long>(UINT_MAX))
601  {
602  throw runtime_exception("Invalid - texture data_length exceeds UINT_MAX", E_INVALIDARG);
603  }
604 }
#define UINT_MAX
Definition: limits.h:41
template<int _Rank>
Concurrency::extent<_Rank> Concurrency::graphics::details::_Make_texture ( const Concurrency::accelerator_view _Av,
_In_ IUnknown *  _D3D_texture,
_Texture_base_type_id  _Id,
_Inout_ _Texture **  _Tex,
DXGI_FORMAT  _View_format 
)
4748 {
4749  if (_D3D_texture == NULL)
4750  {
4751  throw runtime_exception("NULL D3D texture pointer.", E_INVALIDARG);
4752  }
4753 
4755  throw runtime_exception("Cannot create D3D texture on a non-D3D accelerator_view.", E_INVALIDARG);
4756  }
4757 
4758  _Texture * _Tex_ptr = _Texture::_Adopt_texture(_Rank, _Id, _D3D_texture, _Av, _View_format);
4759  if (_Tex_ptr->_Is_staging())
4760  {
4761  _Tex_ptr->_Map_buffer(_Write_access, true /* _Wait */);
4762  }
4763  Concurrency::extent<_Rank> _Ext = Concurrency::graphics::details::_Create_extent<_Rank>(_Tex_ptr->_Get_width(), _Tex_ptr->_Get_height(), _Tex_ptr->_Get_depth());
4764 
4765  _Is_valid_extent(_Ext);
4767 
4768  *_Tex = _Tex_ptr;
4769  return _Ext;
4770 }
unsigned int _Get_bits_per_element() const
Definition: amprt.h:2327
static void _Is_valid_extent(const _T< _Rank > &_Tuple) __CPU_ONLY
Definition: xxamp.h:1203
unsigned int size() const __GPU
Returns the total linear size of this extent (in units of elements).
Definition: amp.h:521
size_t _Get_depth(unsigned int _Mip_offset=0) const
Definition: amprt.h:2296
Definition: amprt.h:2228
#define NULL
Definition: crtdbg.h:30
_AMPIMP bool __cdecl _Is_D3D_accelerator_view(const accelerator_view &_Av)
_AMPIMP void _Map_buffer(_Access_mode _Map_type, bool _Wait)
The extent type represents an N-dimensional vector of int which specifies the bounds of an N-dimen...
Definition: amp.h:383
size_t _Get_height(unsigned int _Mip_offset=0) const
Definition: amprt.h:2291
void _Is_valid_data_length(unsigned int _Num_elems, unsigned int _Bits_per_elem)
Definition: amp_graphics.h:596
Definition: amprt.h:86
size_t _Get_width(unsigned int _Mip_offset=0) const
Definition: amprt.h:2286
bool _Is_staging() const
Definition: amprt.h:2127
_Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char _Pre_maybenull_ _Post_z_ char * _Ext
Definition: stdlib.h:854