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.
2680  : _Texture_base(_Src, _Mipmap_level, /*_View_mipmap_levels=*/1)
2681  {
2682  if (_Get_texture()->_Is_staging()) {
2683  throw runtime_exception("texture_view cannot be created from a staging texture object.", E_INVALIDARG);
2684  }
2685  }
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_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.
2694  : _Texture_base(_Src, /*_Flatten_mipmap_levels=*/true)
2695  {
2696  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.");
2697  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.");
2698  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.");
2699  }
Definition: amprt.h:291
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_Texture_base() __CPU_ONLY
Definition: amp_graphics.h:502
Definition: amprt.h:290
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.
2708  : _Texture_base(_Other)
2709  {
2710  }
_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

2732  {
2733  }

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.
2848  {
2849  return (*this)[_Index];
2850  }
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.
2780  {
2781  return (*this)[_Index];
2782  }
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.
2794  {
2795  static_assert(_Rank == 1, "const value_type operator()(int) is only permissible on texture_view<value_type, 1>.");
2796  return (*this)[index<1>(_I0)];
2797  }
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)
2812  {
2813  static_assert(_Rank == 2, "const value_type operator()(int, int) is only permissible on texture_view<value_type, 2>.");
2814  return (*this)[index<2>(_I0, _I1)];
2815  }
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)
2833  {
2834  static_assert(_Rank == 3, "const value_type operator()(int, int, int) is only permissible on texture_view<value_type, 3>.");
2835  return (*this)[index<3>(_I0, _I1, _I2)];
2836  }
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.
2719  {
2720  if (this != &_Other)
2721  {
2722  _M_extent = _Other._M_extent;
2723  _M_texture_descriptor = _Other._M_texture_descriptor;
2724  }
2725  return *this;
2726  }
_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.
2745  {
2746  static_assert(_Short_vector_type_traits<_Value_type>::_Num_channels == 1, "Read is only permissible on single-component writable texture_view.");
2747  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Unorm_type, "Read is not permissible on a writable unorm texture_view.");
2748  static_assert(_Short_vector_type_traits<_Value_type>::_Format_base_type_id != _Norm_type, "Read is not permissible on a writable norm texture_view.");
2749 
2750  value_type _Tmp;
2751  _Texture_read_helper<index<_Rank>, _Rank>::func(_M_texture_descriptor._M_data_ptr, &_Tmp, _Index, /*_Mip_level=*/0);
2752  return _Tmp;
2753  }
Definition: amprt.h:291
_Value_type value_type
Definition: amp_graphics.h:412
IUnknown * _M_data_ptr
Definition: amprt.h:553
_Texture_descriptor _M_texture_descriptor
Definition: amp_graphics.h:593
Definition: amprt.h:290
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.
2765  {
2766  static_assert(_Rank == 1, "const value_type operator[](int) is only permissible on texture_view<value_type, 1>.");
2767  return (*this)[index<1>(_I0)];
2768  }
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.
2862  {
2864  }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
IUnknown * _M_data_ptr
Definition: amprt.h:553
_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: