STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Friends | List of all members
Concurrency::graphics::texture_view< _Value_type, _Rank > Class Template Reference

A texture_view provides read and write access to a texture. Note that currently texture_view can only be used to read textures whose value type is int, unsigned int and float with default 32 bit bpse. To read other texture formats, use texture_view<const _Value_type, _Rank>. More...

#include <amp_graphics.h>

Inheritance diagram for Concurrency::graphics::texture_view< _Value_type, _Rank >:
Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >

Public Member Functions

 texture_view (texture< _Value_type, _Rank > &_Src, unsigned int _Mipmap_level=0) __CPU_ONLY
 Construct a texture_view of a texture _Src on host. More...
 
 texture_view (texture< _Value_type, _Rank > &_Src) __GPU_ONLY
 Construct a texture_view of a texture _Src on an accelerator. More...
 
 texture_view (const texture_view< _Value_type, _Rank > &_Other) __GPU
 Construct a texture_view from another texture_view. Both are views of the same texture. More...
 
texture_view< _Value_type, _Rank > & operator= (const texture_view< _Value_type, _Rank > &_Other) __GPU
 Assignment operator. This texture_view becomes a view of the same texture which _Other is a view of. More...
 
 ~texture_view () __GPU
 Destructor More...
 
const _Value_type operator[] (const index< _Rank > &_Index) const __GPU_ONLY
 Get the element value indexed by _Index. More...
 
const _Value_type operator[] (int _I0) const __GPU_ONLY
 Get the element value indexed by _I0. More...
 
const _Value_type operator() (const index< _Rank > &_Index) const __GPU_ONLY
 Get the element value indexed by _Index. More...
 
const _Value_type operator() (int _I0) const __GPU_ONLY
 Get the element value indexed by _I0 More...
 
const _Value_type operator() (int _I0, int _I1) const __GPU_ONLY
 Get the element value indexed by (_I0,_I1) More...
 
const _Value_type operator() (int _I0, int _I1, int _I2) const __GPU_ONLY
 Get the element value indexed by (_I0,_I1,_I2) More...
 
const _Value_type get (const index< _Rank > &_Index) const __GPU_ONLY
 Get the element value indexed by _Index. More...
 
void set (const index< _Rank > &_Index, const _Value_type &_Value) const __GPU_ONLY
 Set the element indexed by _Index with value _Value. More...
 
- Public Member Functions inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
__declspec(property(get=get_extent)) Concurrency Concurrency::extent< _Rank > get_extent () const __GPU
 Returns the extent that defines the shape of this texture or texture view. More...
 
Concurrency::extent< _Rank > get_mipmap_extent (unsigned int _Mipmap_level) const __CPU_ONLY
 Returns the extent for specific mipmap level of this texture or texture view. More...
 
Concurrency::extent< _Rank > get_mipmap_extent (unsigned int _Mipmap_level) const __GPU_ONLY
 Returns the extent for specific mipmap level of this texture or texture view. More...
 
__declspec(property(get=get_accelerator_view)) Concurrency Concurrency::accelerator_view get_accelerator_view () const __CPU_ONLY
 Returns the accelerator_view where this texture or texture view is located. More...
 
 __declspec (property(get=get_bits_per_scalar_element)) unsigned int bits_per_scalar_element
 Returns the number of bits per scalar element More...
 
unsigned int get_bits_per_scalar_element () const __CPU_ONLY
 
 __declspec (property(get=get_mipmap_levels)) unsigned int mipmap_levels
 Query how many mipmap levels are accessible by this texture (or texture view). More...
 
unsigned int get_mipmap_levels () const __GPU
 
 __declspec (property(get=get_data_length)) unsigned int data_length
 Returns the physical data length (in bytes) that is required in order to represent the texture on the host side with its native format. If the texture contains multiple mipmap levels the value represents the sum of physical data length for each accessible mipmap level by this texture (or texture view). More...
 
unsigned int get_data_length () const __CPU_ONLY
 

Friends

class texture_view< const _Value_type, _Rank >
 

Additional Inherited Members

- Public Types inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
typedef _Value_type value_type
 
typedef _Short_vector_type_traits< _Value_type >::_Scalar_type scalar_type
 
- Static Public Attributes inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
static const int rank = _Rank
 
- Protected Types inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
typedef Concurrency::details::_Texture_descriptor _Texture_descriptor
 
- Protected Member Functions inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
 _Texture_base () __CPU_ONLY
 
 _Texture_base (const Concurrency::extent< _Rank > &_Ext, unsigned int _Mipmap_levels=1) __CPU_ONLY
 
 _Texture_base (const _Texture_base &_Src) __GPU
 
 _Texture_base (const _Texture_base &_Src, unsigned int _Most_detailed_mipmap_level, unsigned int _View_mipmap_levels) __CPU_ONLY
 
 _Texture_base (const _Texture_base &_Src, bool _Flatten_mipmap_levels) __GPU_ONLY
 
 _Texture_base (const Concurrency::extent< _Rank > &_Ext, const _Texture_descriptor &_Desc) __CPU_ONLY
 
void _Copy_to (const _Texture_base &_Dest) const __CPU_ONLY
 
bool operator== (const _Texture_base &_Other) const __CPU_ONLY
 
 ~_Texture_base () __GPU
 
_Ret_ _Texture_Get_texture () const __CPU_ONLY
 
unsigned int _Get_most_detailed_mipmap_level () const __GPU
 
bool _Are_mipmap_levels_overlapping (const _Texture_base &_Other) const __CPU_ONLY
 
- Protected Attributes inherited from Concurrency::graphics::details::_Texture_base< _Value_type, _Rank >
Concurrency::extent< _Rank > _M_extent
 
_Texture_descriptor _M_texture_descriptor
 

Detailed Description

template<typename _Value_type, int _Rank>
class Concurrency::graphics::texture_view< _Value_type, _Rank >

A texture_view provides read and write access to a texture. Note that currently texture_view can only be used to read textures whose value type is int, unsigned int and float with default 32 bit bpse. To read other texture formats, use texture_view<const _Value_type, _Rank>.

Parameters
_Value_typeThe type of the elements in the texture aggregates.
_RankThe _Rank of the corresponding extent domain.

Constructor & Destructor Documentation

template<typename _Value_type, int _Rank>
Concurrency::graphics::texture_view< _Value_type, _Rank >::texture_view ( texture< _Value_type, _Rank > &  _Src,
unsigned int  _Mipmap_level = 0 
)
inline

Construct a texture_view of a texture _Src on host.

Parameters
_SrcThe texture on which the texture_view is created.
_Mipmap_levelThe specific mipmap level on a _Src texture that this read and write texture_view should bind to. The default value 0, binds to the top mosted detail mipmap level.
2712  : _Texture_base(_Src, _Mipmap_level, /*_View_mipmap_levels=*/1)
2713  {
2714  if (this->_Get_texture()->_Is_staging()) {
2715  throw runtime_exception("texture_view cannot be created from a staging texture object.", E_INVALIDARG);
2716  }
2717  }
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
_Ret_ _Texture * _Get_texture() const __CPU_ONLY
Definition: amp_graphics.h:576
_Texture_base() __CPU_ONLY
Definition: amp_graphics.h:502
template<typename _Value_type, int _Rank>
Concurrency::graphics::texture_view< _Value_type, _Rank >::texture_view ( texture< _Value_type, _Rank > &  _Src)
inline

Construct a texture_view of a texture _Src on an accelerator.

Parameters
_SrcThe texture on which the texture_view is created.
2726  : _Texture_base(_Src, /*_Flatten_mipmap_levels=*/true)
2727  {
2728  static_assert(_Short_vector_type_traits<_Value_type>::_Num_channels == 1, "writable texture_view can only be created from a single-component texture on an accelerator.");
2729  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Unorm_type, "writable texture_view cannot be created from a unorm texture on an accelerator.");
2730  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Norm_type, "writable texture_view cannot be created from a norm texture on an accelerator.");
2731  }
Definition: amprt.h:297
_In_ size_t _Out_opt_ int _In_z_ unsigned char const * _Src
Definition: mbstring.h:1039
_Texture_base() __CPU_ONLY
Definition: amp_graphics.h:502
Definition: amprt.h:296
template<typename _Value_type, int _Rank>
Concurrency::graphics::texture_view< _Value_type, _Rank >::texture_view ( const texture_view< _Value_type, _Rank > &  _Other)
inline

Construct a texture_view from another texture_view. Both are views of the same texture.

Parameters
_OtherThe source texture_view.
2740  : _Texture_base(_Other)
2741  {
2742  }
_Texture_base() __CPU_ONLY
Definition: amp_graphics.h:502
template<typename _Value_type, int _Rank>
Concurrency::graphics::texture_view< _Value_type, _Rank >::~texture_view ( )
inline

Destructor

2764  {
2765  }

Member Function Documentation

template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::get ( const index< _Rank > &  _Index) const
inline

Get the element value indexed by _Index.

Parameters
_IndexThe index.
Returns
The element value indexed by _Index.
2880  {
2881  return (*this)[_Index];
2882  }
_In_ size_t _In_ int _Index
Definition: time.h:102
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator() ( const index< _Rank > &  _Index) const
inline

Get the element value indexed by _Index.

Parameters
_IndexThe index.
Returns
The element value indexed by _Index.
2812  {
2813  return (*this)[_Index];
2814  }
_In_ size_t _In_ int _Index
Definition: time.h:102
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator() ( int  _I0) const
inline

Get the element value indexed by _I0

Parameters
_I0The index.
Returns
The element value indexed by _I0.
2826  {
2827  static_assert(_Rank == 1, "const value_type operator()(int) is only permissible on texture_view<value_type, 1>.");
2828  return (*this)[index<1>(_I0)];
2829  }
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator() ( int  _I0,
int  _I1 
) const
inline

Get the element value indexed by (_I0,_I1)

Parameters
_I0The most-significant component of the index
_I1The least-significant component of the index
Returns
The element value indexed by (_I0,_I1)
2844  {
2845  static_assert(_Rank == 2, "const value_type operator()(int, int) is only permissible on texture_view<value_type, 2>.");
2846  return (*this)[index<2>(_I0, _I1)];
2847  }
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator() ( int  _I0,
int  _I1,
int  _I2 
) const
inline

Get the element value indexed by (_I0,_I1,_I2)

Parameters
_I0The most-significant component of the index
_I1The next-to-most-significant component of the index
_I2The least-significant component of the index
Returns
The element value indexed by (_I0,_I1,_I2)
2865  {
2866  static_assert(_Rank == 3, "const value_type operator()(int, int, int) is only permissible on texture_view<value_type, 3>.");
2867  return (*this)[index<3>(_I0, _I1, _I2)];
2868  }
template<typename _Value_type, int _Rank>
texture_view<_Value_type, _Rank>& Concurrency::graphics::texture_view< _Value_type, _Rank >::operator= ( const texture_view< _Value_type, _Rank > &  _Other)
inline

Assignment operator. This texture_view becomes a view of the same texture which _Other is a view of.

Parameters
_OtherThe source texture_view.
2751  {
2752  if (this != &_Other)
2753  {
2754  this->_M_extent = _Other._M_extent;
2755  this->_M_texture_descriptor = _Other._M_texture_descriptor;
2756  }
2757  return *this;
2758  }
_Texture_descriptor _M_texture_descriptor
Definition: amp_graphics.h:593
Concurrency::extent< _Rank > _M_extent
Definition: amp_graphics.h:592
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator[] ( const index< _Rank > &  _Index) const
inline

Get the element value indexed by _Index.

Parameters
_IndexThe index.
Returns
The element value indexed by _Index.
2777  {
2778  static_assert(_Short_vector_type_traits<_Value_type>::_Num_channels == 1, "Read is only permissible on single-component writable texture_view.");
2779  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Unorm_type, "Read is not permissible on a writable unorm texture_view.");
2780  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Norm_type, "Read is not permissible on a writable norm texture_view.");
2781 
2782  _Value_type _Tmp;
2783  _Texture_read_helper<index<_Rank>, _Rank>::func(this->_M_texture_descriptor._M_data_ptr, &_Tmp, _Index, /*_Mip_level=*/0);
2784  return _Tmp;
2785  }
Definition: amprt.h:297
_In_ size_t _In_ int _Index
Definition: time.h:102
IUnknown * _M_data_ptr
Definition: amprt.h:558
_Texture_descriptor _M_texture_descriptor
Definition: amp_graphics.h:593
Definition: amprt.h:296
template<typename _Value_type, int _Rank>
const _Value_type Concurrency::graphics::texture_view< _Value_type, _Rank >::operator[] ( int  _I0) const
inline

Get the element value indexed by _I0.

Parameters
_I0The index.
Returns
The element value indexed by _I0.
2797  {
2798  static_assert(_Rank == 1, "const value_type operator[](int) is only permissible on texture_view<value_type, 1>.");
2799  return (*this)[index<1>(_I0)];
2800  }
template<typename _Value_type, int _Rank>
void Concurrency::graphics::texture_view< _Value_type, _Rank >::set ( const index< _Rank > &  _Index,
const _Value_type &  _Value 
) const
inline

Set the element indexed by _Index with value _Value.

Parameters
_IndexThe index.
_ValueThe value to be set to the element indexed by _Index.
2894  {
2896  }
_In_ size_t _In_ int _Index
Definition: time.h:102
IUnknown * _M_data_ptr
Definition: amprt.h:558
_In_ _Value
Definition: corecrt_wstdlib.h:65
_Texture_descriptor _M_texture_descriptor
Definition: amp_graphics.h:593

Friends And Related Function Documentation

template<typename _Value_type, int _Rank>
friend class texture_view< const _Value_type, _Rank >
friend

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