STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Concurrency::details::_Texture Class Reference

#include <amprt.h>

Inheritance diagram for Concurrency::details::_Texture:
Concurrency::details::_Buffer Concurrency::details::_Reference_counter

Public Member Functions

_AMPIMP _Event _Copy_to_async (_Out_ _Texture *_Dest, const size_t *_Copy_extent, const size_t *_Src_offset, const size_t *_Dst_offset, unsigned int _Src_mipmap_level, unsigned int _Dst_mipmap_level)
 
size_t _Get_width (unsigned int _Mip_offset=0) const
 
size_t _Get_height (unsigned int _Mip_offset=0) const
 
size_t _Get_depth (unsigned int _Mip_offset=0) const
 
unsigned int _Get_rank () const
 
unsigned int _Get_texture_format () const
 
unsigned int _Get_view_format () const
 
unsigned int _Get_num_channels () const
 
unsigned int _Get_bits_per_channel () const
 
unsigned int _Get_bits_per_element () const
 
unsigned int _Get_data_length (unsigned int _Most_detailed_mipmap_level, unsigned int _View_mipmap_levels, const size_t *_Extents=nullptr) const
 
unsigned int _Get_mip_levels () const
 
size_t _Get_row_pitch () const
 
void _Set_row_pitch (size_t _Val)
 
size_t _Get_depth_pitch () const
 
void _Set_depth_pitch (size_t _Val)
 
- Public Member Functions inherited from Concurrency::details::_Buffer
_AMPIMP void _Map_buffer (_Access_mode _Map_type, bool _Wait)
 
_AMPIMP _Event _Map_buffer_async (_Access_mode _Map_type)
 
_AMPIMP void _Unmap_buffer ()
 
_AMPIMP _Event _Copy_to_async (_Out_ _Buffer *_Dest, size_t _Num_elems, size_t _Src_offset=0, size_t _Dest_offset=0)
 
_AMPIMP _Event _Copy_to_async (_Out_ _Buffer *_Dest, _View_shape_ptr _Src_shape, _View_shape_ptr _Dest_shape)
 
_AMPIMP accelerator_view _Get_accelerator_view () const
 
_AMPIMP accelerator_view _Get_access_on_accelerator_view () const
 
_AMPIMP void _Register_view (_In_ _View_key _Key)
 
_AMPIMP void _Unregister_view (_In_ _View_key _Key)
 
_Ret_ void_Get_data_ptr () const
 
_Ret_ void_Get_host_ptr () const
 
size_t _Get_elem_size () const
 
size_t _Get_num_elems () const
 
_Ret_ _Accelerator_view_impl * _Get_accelerator_view_impl () const
 
_Ret_ _Accelerator_view_impl * _Get_access_on_accelerator_view_impl () const
 
bool _Owns_data () const
 
_AMPIMP bool _Exclusively_owns_data ()
 
bool _Is_staging () const
 
_Access_mode _Get_allowed_host_access_mode () const
 
access_type _Get_allowed_host_access_type () const
 
bool _Is_host_accessible (_Access_mode _Requested_access_mode) const
 
_Access_mode _Get_current_host_access_mode () const
 
bool _Is_temp () const
 
bool _Is_adopted () const
 
bool _Is_buffer () const
 
_AMPIMP bool _Is_mappable () const
 
- Public Member Functions inherited from Concurrency::details::_Reference_counter
 _Reference_counter ()
 
virtual ~_Reference_counter () noexcept(false)
 
size_t _Add_reference ()
 
size_t _Remove_reference ()
 
_AMPIMP void _Release ()
 
size_t _Get_reference_count ()
 

Static Public Member Functions

static _AMPIMP _Ret_ _Texture *__cdecl _Create_texture (accelerator_view _Accelerator_view, unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, unsigned int _Mip_levels, _Short_vector_base_type_id _Type_id, unsigned int _Num_channels, unsigned int _Bits_per_channel, bool _Is_temp=false)
 
static _AMPIMP _Ret_ _Texture *__cdecl _Adopt_texture (unsigned int _Rank, _Texture_base_type_id _Id, _In_ IUnknown *_Data_ptr, accelerator_view _Accelerator_view, unsigned int _View_format)
 
static _AMPIMP _Ret_ _Texture *__cdecl _Create_stage_texture (accelerator_view _Accelerator_view, accelerator_view _Access_on_accelerator_view, unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, unsigned int _Mip_levels, unsigned int _Format, bool _Is_temp=false)
 
static _AMPIMP _Ret_ _Texture *__cdecl _Create_stage_texture (accelerator_view _Accelerator_view, accelerator_view _Access_on_accelerator_view, unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, unsigned int _Mip_levels, _Short_vector_base_type_id _Type_id, unsigned int _Num_channels, unsigned int _Bits_per_channel)
 
static _AMPIMP _Ret_ _Texture *__cdecl _Get_temp_staging_texture (accelerator_view _Accelerator_view, unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, unsigned int _Mip_levels, unsigned int _Format)
 
static _AMPIMP _Ret_ _Texture *__cdecl _Clone_texture (const _Texture *_Src, const accelerator_view &_Accelerator_view, const accelerator_view &_Associated_av)
 
- Static Public Member Functions inherited from Concurrency::details::_Buffer
static _AMPIMP _Ret_ _Buffer *__cdecl _Create_buffer (accelerator_view _Accelerator_view, accelerator_view _Access_on_accelerator_view, size_t _Num_elems, size_t _Elem_size, bool _Is_temp=false, access_type _Cpu_access_type=access_type_auto)
 
static _AMPIMP _Ret_ _Buffer *__cdecl _Create_buffer (_In_ void *_Data_ptr, accelerator_view _Accelerator_view, size_t _Num_elems, size_t _Elem_size)
 
static _AMPIMP _Ret_ _Buffer *__cdecl _Create_stage_buffer (accelerator_view _Accelerator_view, accelerator_view _Access_on_accelerator_view, size_t _Num_elems, size_t _Elem_size, bool _Is_temp=false)
 
static _AMPIMP _Ret_ _Buffer *__cdecl _Get_temp_staging_buffer (accelerator_view _Av, size_t _Requested_num_elems, size_t _Elem_size)
 

Private Member Functions

 _Texture (_In_ _Accelerator_view_impl *_Av, _In_ void *_Texture_data_ptr, _In_ void *_Host_ptr, _Access_mode _Allowed_host_access_mode, _Access_mode _Current_host_access_mode, unsigned int _Rank, size_t _Width, size_t _Height, size_t _Depth, unsigned int _Mip_levels, unsigned int _Texture_format, unsigned int _View_format, unsigned int _Num_channels, unsigned int _Bits_per_channel, bool _Owns_data, bool _Is_staging, bool _Is_temp, bool _Is_adopted)
 
 ~_Texture ()
 
 _Texture ()
 
 _Texture (const _Texture &rhs)
 
_Textureoperator= (const _Texture &rhs)
 

Private Attributes

unsigned int _M_rank
 
size_t _M_width
 
size_t _M_height
 
size_t _M_depth
 
unsigned int _M_texture_format
 
unsigned int _M_view_format
 
unsigned int _M_bits_per_channel
 
unsigned int _M_num_channels
 
unsigned int _M_mip_levels
 
size_t _M_row_pitch
 
size_t _M_depth_pitch
 

Friends

class _CPU_accelerator_view_impl
 
class _D3D_accelerator_view_impl
 
class _D3D_temp_staging_cache
 

Additional Inherited Members

- Protected Member Functions inherited from Concurrency::details::_Buffer
 _Buffer (_In_ _Accelerator_view_impl *_Av, _In_ void *_Buffer_data_ptr, _In_ void *_Host_ptr, _Access_mode _Allowed_host_access_mode, _Access_mode _Current_host_access_mode, size_t _Num_elems, size_t _Elem_size, bool _Owns_data, bool _Is_staging, bool _Is_temp, bool _Is_adopted)
 
virtual ~_Buffer ()
 
 _Buffer ()
 
 _Buffer (const _Buffer &rhs)
 
_Bufferoperator= (const _Buffer &rhs)
 
void _Set_host_ptr (_In_ void *_Host_ptr, _Access_mode _Host_access_mode=_No_access)
 
void _Set_data_ptr (_In_ IUnknown *_Data_ptr)
 
- Protected Attributes inherited from Concurrency::details::_Buffer
_Accelerator_view_impl_ptr _M_accelerator_view
 
_Accelerator_view_impl_ptr _M_access_on_accelerator_view
 
void_M_data_ptr
 
void_M_host_ptr
 
_Access_mode _M_allowed_host_access_mode
 
_Access_mode _M_current_host_access_mode
 
size_t _M_elem_size
 
size_t _M_num_elems
 
bool _M_owns_data
 
bool _M_is_staging
 
bool _M_is_temp
 
bool _M_is_adopted
 
bool _M_is_buffer
 

Constructor & Destructor Documentation

Concurrency::details::_Texture::_Texture ( _In_ _Accelerator_view_impl *  _Av,
_In_ void _Texture_data_ptr,
_In_ void _Host_ptr,
_Access_mode  _Allowed_host_access_mode,
_Access_mode  _Current_host_access_mode,
unsigned int  _Rank,
size_t  _Width,
size_t  _Height,
size_t  _Depth,
unsigned int  _Mip_levels,
unsigned int  _Texture_format,
unsigned int  _View_format,
unsigned int  _Num_channels,
unsigned int  _Bits_per_channel,
bool  _Owns_data,
bool  _Is_staging,
bool  _Is_temp,
bool  _Is_adopted 
)
private
Concurrency::details::_Texture::~_Texture ( )
private
Concurrency::details::_Texture::_Texture ( )
private
Concurrency::details::_Texture::_Texture ( const _Texture rhs)
private

Member Function Documentation

static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Adopt_texture ( unsigned int  _Rank,
_Texture_base_type_id  _Id,
_In_ IUnknown *  _Data_ptr,
accelerator_view  _Accelerator_view,
unsigned int  _View_format 
)
static
static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Clone_texture ( const _Texture _Src,
const accelerator_view _Accelerator_view,
const accelerator_view _Associated_av 
)
static
_AMPIMP _Event Concurrency::details::_Texture::_Copy_to_async ( _Out_ _Texture _Dest,
const size_t _Copy_extent,
const size_t _Src_offset,
const size_t _Dst_offset,
unsigned int  _Src_mipmap_level,
unsigned int  _Dst_mipmap_level 
)
static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Create_stage_texture ( accelerator_view  _Accelerator_view,
accelerator_view  _Access_on_accelerator_view,
unsigned int  _Rank,
size_t  _Width,
size_t  _Height,
size_t  _Depth,
unsigned int  _Mip_levels,
unsigned int  _Format,
bool  _Is_temp = false 
)
static
static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Create_stage_texture ( accelerator_view  _Accelerator_view,
accelerator_view  _Access_on_accelerator_view,
unsigned int  _Rank,
size_t  _Width,
size_t  _Height,
size_t  _Depth,
unsigned int  _Mip_levels,
_Short_vector_base_type_id  _Type_id,
unsigned int  _Num_channels,
unsigned int  _Bits_per_channel 
)
static
static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Create_texture ( accelerator_view  _Accelerator_view,
unsigned int  _Rank,
size_t  _Width,
size_t  _Height,
size_t  _Depth,
unsigned int  _Mip_levels,
_Short_vector_base_type_id  _Type_id,
unsigned int  _Num_channels,
unsigned int  _Bits_per_channel,
bool  _Is_temp = false 
)
static
unsigned int Concurrency::details::_Texture::_Get_bits_per_channel ( ) const
inline
2246  {
2247  // For texture adopted from interop, return 0.
2248  return _Is_adopted() ? 0 : _M_bits_per_channel;
2249  }
bool _Is_adopted() const
Definition: amprt.h:2081
unsigned int _M_bits_per_channel
Definition: amprt.h:2361
unsigned int Concurrency::details::_Texture::_Get_bits_per_element ( ) const
inline
2252  {
2254  }
unsigned int _M_bits_per_channel
Definition: amprt.h:2361
unsigned int _M_num_channels
Definition: amprt.h:2362
unsigned int Concurrency::details::_Texture::_Get_data_length ( unsigned int  _Most_detailed_mipmap_level,
unsigned int  _View_mipmap_levels,
const size_t _Extents = nullptr 
) const
inline
2257  {
2258  _ASSERTE(_View_mipmap_levels);
2259 
2260  unsigned long long _Bits_per_byte = 8ULL;
2261  unsigned long long _Total_bytes = 0ULL;
2262 
2263  unsigned int _Mip_level = _Most_detailed_mipmap_level;
2264 
2265  // Sum up data length (in bytes) of all mipmap levels in the view
2266  for (unsigned int _Mip_offset=0; _Mip_offset < _View_mipmap_levels; ++_Mip_offset)
2267  {
2268  unsigned long long _Width = 1ULL;
2269  unsigned long long _Height = 1ULL;
2270  unsigned long long _Depth = 1ULL;
2271 
2272  if (_Extents)
2273  {
2274  switch (_M_rank)
2275  {
2276  case 3:
2277  _Depth = (_Extents[2] >> _Mip_level) ? (_Extents[2] >> _Mip_level) : 1U;
2278  // deliberately fall through
2279  case 2:
2280  _Height = (_Extents[1] >> _Mip_level) ? (_Extents[1] >> _Mip_level) : 1U;
2281  // deliberately fall through
2282  case 1:
2283  _Width = (_Extents[0] >> _Mip_level) ? (_Extents[0] >> _Mip_level) : 1U;
2284  break;
2285  default:
2286  _ASSERTE(false); // textures are only rank 1-3
2287  }
2288  }
2289  else
2290  {
2291  _Width = _Get_width(_Mip_level);
2292  _Height = _Get_height(_Mip_level);
2293  _Depth = _Get_depth(_Mip_level);
2294  }
2295 
2296  // Note _Get_bits_per_element() can be smaller than 8
2297  // Use unsigned long long to avoid integer overflow
2298  _Total_bytes += ((_Width * _Height * _Depth * static_cast<unsigned long long>(_Get_bits_per_element())) + _Bits_per_byte - 1) / _Bits_per_byte;
2299 
2300  _Mip_level++;
2301  }
2302 
2303  return static_cast<unsigned int>(_Total_bytes);
2304  }
unsigned int _Get_bits_per_element() const
Definition: amprt.h:2251
size_t _Get_depth(unsigned int _Mip_offset=0) const
Definition: amprt.h:2220
unsigned int _M_rank
Definition: amprt.h:2355
#define _ASSERTE(expr)
Definition: crtdbg.h:707
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
size_t Concurrency::details::_Texture::_Get_depth ( unsigned int  _Mip_offset = 0) const
inline
2221  {
2222  return (_M_depth >> _Mip_offset) ? (_M_depth >> _Mip_offset) : 1U;
2223  }
size_t _M_depth
Definition: amprt.h:2358
size_t Concurrency::details::_Texture::_Get_depth_pitch ( ) const
inline
2322  {
2323  return _M_depth_pitch;
2324  }
size_t _M_depth_pitch
Definition: amprt.h:2366
size_t Concurrency::details::_Texture::_Get_height ( unsigned int  _Mip_offset = 0) const
inline
2216  {
2217  return (_M_height >> _Mip_offset) ? (_M_height >> _Mip_offset) : 1U;
2218  }
size_t _M_height
Definition: amprt.h:2357
unsigned int Concurrency::details::_Texture::_Get_mip_levels ( ) const
inline
2307  {
2308  return _M_mip_levels;
2309  }
unsigned int _M_mip_levels
Definition: amprt.h:2363
unsigned int Concurrency::details::_Texture::_Get_num_channels ( ) const
inline
2241  {
2242  return _M_num_channels;
2243  }
unsigned int _M_num_channels
Definition: amprt.h:2362
unsigned int Concurrency::details::_Texture::_Get_rank ( ) const
inline
2226  {
2227  return _M_rank;
2228  }
unsigned int _M_rank
Definition: amprt.h:2355
size_t Concurrency::details::_Texture::_Get_row_pitch ( ) const
inline
2312  {
2313  return _M_row_pitch;
2314  }
size_t _M_row_pitch
Definition: amprt.h:2365
static _AMPIMP _Ret_ _Texture* __cdecl Concurrency::details::_Texture::_Get_temp_staging_texture ( accelerator_view  _Accelerator_view,
unsigned int  _Rank,
size_t  _Width,
size_t  _Height,
size_t  _Depth,
unsigned int  _Mip_levels,
unsigned int  _Format 
)
static
unsigned int Concurrency::details::_Texture::_Get_texture_format ( ) const
inline
2231  {
2232  return _M_texture_format;
2233  }
unsigned int _M_texture_format
Definition: amprt.h:2359
unsigned int Concurrency::details::_Texture::_Get_view_format ( ) const
inline
2236  {
2237  return _M_view_format;
2238  }
unsigned int _M_view_format
Definition: amprt.h:2360
size_t Concurrency::details::_Texture::_Get_width ( unsigned int  _Mip_offset = 0) const
inline
2211  {
2212  return (_M_width >> _Mip_offset) ? (_M_width >> _Mip_offset) : 1U;
2213  }
size_t _M_width
Definition: amprt.h:2356
void Concurrency::details::_Texture::_Set_depth_pitch ( size_t  _Val)
inline
2327  {
2328  _M_depth_pitch = _Val;
2329  }
size_t _M_depth_pitch
Definition: amprt.h:2366
_FwdIt const _Ty _Val
Definition: algorithm:1938
void Concurrency::details::_Texture::_Set_row_pitch ( size_t  _Val)
inline
2317  {
2318  _M_row_pitch = _Val;
2319  }
size_t _M_row_pitch
Definition: amprt.h:2365
_FwdIt const _Ty _Val
Definition: algorithm:1938
_Texture& Concurrency::details::_Texture::operator= ( const _Texture rhs)
private

Friends And Related Function Documentation

friend class _CPU_accelerator_view_impl
friend
friend class _D3D_accelerator_view_impl
friend
friend class _D3D_temp_staging_cache
friend

Member Data Documentation

unsigned int Concurrency::details::_Texture::_M_bits_per_channel
private
size_t Concurrency::details::_Texture::_M_depth
private
size_t Concurrency::details::_Texture::_M_depth_pitch
private
size_t Concurrency::details::_Texture::_M_height
private
unsigned int Concurrency::details::_Texture::_M_mip_levels
private
unsigned int Concurrency::details::_Texture::_M_num_channels
private
unsigned int Concurrency::details::_Texture::_M_rank
private
size_t Concurrency::details::_Texture::_M_row_pitch
private
unsigned int Concurrency::details::_Texture::_M_texture_format
private
unsigned int Concurrency::details::_Texture::_M_view_format
private
size_t Concurrency::details::_Texture::_M_width
private

The documentation for this class was generated from the following file: