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 ()
 
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
2322  {
2323  // For texture adopted from interop, return 0.
2324  return _Is_adopted() ? 0 : _M_bits_per_channel;
2325  }
bool _Is_adopted() const
Definition: amprt.h:2157
unsigned int _M_bits_per_channel
Definition: amprt.h:2437
unsigned int Concurrency::details::_Texture::_Get_bits_per_element ( ) const
inline
2328  {
2330  }
unsigned int _M_bits_per_channel
Definition: amprt.h:2437
unsigned int _M_num_channels
Definition: amprt.h:2438
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
2333  {
2334  _ASSERTE(_View_mipmap_levels);
2335 
2336  unsigned long long _Bits_per_byte = 8ULL;
2337  unsigned long long _Total_bytes = 0ULL;
2338 
2339  unsigned int _Mip_level = _Most_detailed_mipmap_level;
2340 
2341  // Sum up data length (in bytes) of all mipmap levels in the view
2342  for (unsigned int _Mip_offset=0; _Mip_offset < _View_mipmap_levels; ++_Mip_offset)
2343  {
2344  unsigned long long _Width = 1ULL;
2345  unsigned long long _Height = 1ULL;
2346  unsigned long long _Depth = 1ULL;
2347 
2348  if (_Extents)
2349  {
2350  switch (_M_rank)
2351  {
2352  case 3:
2353  _Depth = (_Extents[2] >> _Mip_level) ? (_Extents[2] >> _Mip_level) : 1U;
2354  // deliberately fall thru
2355  case 2:
2356  _Height = (_Extents[1] >> _Mip_level) ? (_Extents[1] >> _Mip_level) : 1U;
2357  // deliberately fall thru
2358  case 1:
2359  _Width = (_Extents[0] >> _Mip_level) ? (_Extents[0] >> _Mip_level) : 1U;
2360  break;
2361  default:
2362  _ASSERTE(false); // textures are only rank 1-3
2363  }
2364  }
2365  else
2366  {
2367  _Width = _Get_width(_Mip_level);
2368  _Height = _Get_height(_Mip_level);
2369  _Depth = _Get_depth(_Mip_level);
2370  }
2371 
2372  // Note _Get_bits_per_element() can be smaller than 8
2373  // Use unsigned long long to avoid integer overflow
2374  _Total_bytes += ((_Width * _Height * _Depth * static_cast<unsigned long long>(_Get_bits_per_element())) + _Bits_per_byte - 1) / _Bits_per_byte;
2375 
2376  _Mip_level++;
2377  }
2378 
2379  return static_cast<unsigned int>(_Total_bytes);
2380  }
unsigned int _Get_bits_per_element() const
Definition: amprt.h:2327
size_t _Get_depth(unsigned int _Mip_offset=0) const
Definition: amprt.h:2296
unsigned int _M_rank
Definition: amprt.h:2431
#define _ASSERTE(expr)
Definition: crtdbg.h:216
size_t _Get_height(unsigned int _Mip_offset=0) const
Definition: amprt.h:2291
size_t _Get_width(unsigned int _Mip_offset=0) const
Definition: amprt.h:2286
size_t Concurrency::details::_Texture::_Get_depth ( unsigned int  _Mip_offset = 0) const
inline
2297  {
2298  return (_M_depth >> _Mip_offset) ? (_M_depth >> _Mip_offset) : 1U;
2299  }
size_t _M_depth
Definition: amprt.h:2434
size_t Concurrency::details::_Texture::_Get_depth_pitch ( ) const
inline
2398  {
2399  return _M_depth_pitch;
2400  }
size_t _M_depth_pitch
Definition: amprt.h:2442
size_t Concurrency::details::_Texture::_Get_height ( unsigned int  _Mip_offset = 0) const
inline
2292  {
2293  return (_M_height >> _Mip_offset) ? (_M_height >> _Mip_offset) : 1U;
2294  }
size_t _M_height
Definition: amprt.h:2433
unsigned int Concurrency::details::_Texture::_Get_mip_levels ( ) const
inline
2383  {
2384  return _M_mip_levels;
2385  }
unsigned int _M_mip_levels
Definition: amprt.h:2439
unsigned int Concurrency::details::_Texture::_Get_num_channels ( ) const
inline
2317  {
2318  return _M_num_channels;
2319  }
unsigned int _M_num_channels
Definition: amprt.h:2438
unsigned int Concurrency::details::_Texture::_Get_rank ( ) const
inline
2302  {
2303  return _M_rank;
2304  }
unsigned int _M_rank
Definition: amprt.h:2431
size_t Concurrency::details::_Texture::_Get_row_pitch ( ) const
inline
2388  {
2389  return _M_row_pitch;
2390  }
size_t _M_row_pitch
Definition: amprt.h:2441
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
2307  {
2308  return _M_texture_format;
2309  }
unsigned int _M_texture_format
Definition: amprt.h:2435
unsigned int Concurrency::details::_Texture::_Get_view_format ( ) const
inline
2312  {
2313  return _M_view_format;
2314  }
unsigned int _M_view_format
Definition: amprt.h:2436
size_t Concurrency::details::_Texture::_Get_width ( unsigned int  _Mip_offset = 0) const
inline
2287  {
2288  return (_M_width >> _Mip_offset) ? (_M_width >> _Mip_offset) : 1U;
2289  }
size_t _M_width
Definition: amprt.h:2432
void Concurrency::details::_Texture::_Set_depth_pitch ( size_t  _Val)
inline
2403  {
2404  _M_depth_pitch = _Val;
2405  }
size_t _M_depth_pitch
Definition: amprt.h:2442
_FwdIt const _Ty _Val
Definition: algorithm:1938
void Concurrency::details::_Texture::_Set_row_pitch ( size_t  _Val)
inline
2393  {
2394  _M_row_pitch = _Val;
2395  }
size_t _M_row_pitch
Definition: amprt.h:2441
_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: