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

A sampler class aggregates sampling configuration information to be used for texture sampling. More...

#include <amp_graphics.h>

Public Member Functions

 sampler () __CPU_ONLY
 Constructs a sampler with default filter mode (filter_lienar, same for min, mag, mip), addressing mode (address_clamp, same for all dimensions), and border color (float_4(0.0f, 0.0f, 0.0f, 0.0f)). More...
 
 sampler (filter_mode _Filter_mode) __CPU_ONLY
 Constructs a sampler with specified filter mode (same for min, mag, mip), but with default addressing mode (address_clamp, same for all dimensions) and border color ( float_4(0.0f, 0.0f, 0.0f, 0.0f)). More...
 
 sampler (address_mode _Address_mode, float_4 _Border_color=float_4(0.0f, 0.0f, 0.0f, 0.0f)) __CPU_ONLY
 Constructs a sampler with default filter mode (filter_linear, same for min, mag, mip), but specified addressing mode (same for all dimensions) and border color. More...
 
 sampler (filter_mode _Filter_mode, address_mode _Address_mode, float_4 _Border_color=float_4(0.0f, 0.0f, 0.0f, 0.0f)) __CPU_ONLY
 Constructs a sampler with specified filter mode (same for min, mag, mip), addressing mode (same for all dimensions) and the border color. More...
 
 sampler (const sampler &_Other) __GPU
 Copy constructor. More...
 
 sampler (sampler &&_Other) __GPU
 Move constructor. More...
 
sampleroperator= (const sampler &_Other) __GPU
 Assignment operator. More...
 
sampleroperator= (sampler &&_Other) __GPU
 Move assignment operator. More...
 
__declspec(property(get=get_filter_mode)) Concurrency Concurrency::graphics::filter_mode get_filter_mode () const __GPU
 Returns the sampler's filter mode More...
 
__declspec(property(get=get_address_mode)) Concurrency Concurrency::graphics::address_mode get_address_mode () const __GPU
 Returns the sampler's address mode More...
 
__declspec(property(get=get_border_color)) Concurrency Concurrency::graphics::float_4 get_border_color () const __GPU
 Returns the sampler's border value More...
 

Private Types

typedef Concurrency::details::_Sampler_descriptor _Sampler_descriptor
 

Private Member Functions

 sampler (const _Sampler_descriptor &_Descriptor) __CPU_ONLY
 
_Ret_ _Sampler_Get_sampler_ptr () const __CPU_ONLY
 
void _Initialize () __CPU_ONLY
 
const _Sampler_descriptor_Get_descriptor () const __GPU_ONLY
 

Private Attributes

_Sampler_descriptor _M_sampler_descriptor
 
Concurrency::graphics::filter_mode _M_filter_mode
 
Concurrency::graphics::address_mode _M_address_mode
 
float_4 _M_border_color
 

Friends

template<typename _Value_type , int _Rank>
class texture_view
 
sampler direct3d::make_sampler (_In_ IUnknown *_D3D_sampler) __CPU_ONLY
 
_Ret_ IUnknown * direct3d::get_sampler (const Concurrency::accelerator_view &_Av, const sampler &_Sampler) __CPU_ONLY
 

Detailed Description

A sampler class aggregates sampling configuration information to be used for texture sampling.

Member Typedef Documentation

Constructor & Destructor Documentation

Concurrency::graphics::sampler::sampler ( )
inline

Constructs a sampler with default filter mode (filter_lienar, same for min, mag, mip), addressing mode (address_clamp, same for all dimensions), and border color (float_4(0.0f, 0.0f, 0.0f, 0.0f)).

2908  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
2909  {
2910  _Initialize();
2911  }
Definition: amp_graphics.h:2884
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3089
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Definition: amp_graphics.h:2873
Concurrency::graphics::sampler::sampler ( filter_mode  _Filter_mode)
inline

Constructs a sampler with specified filter mode (same for min, mag, mip), but with default addressing mode (address_clamp, same for all dimensions) and border color ( float_4(0.0f, 0.0f, 0.0f, 0.0f)).

Parameters
_Filter_modeThe filter mode to be used in sampling.
2921  : _M_filter_mode(_Filter_mode),
2923  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
2924  {
2925  _Initialize();
2926  }
Definition: amp_graphics.h:2884
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3089
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Concurrency::graphics::sampler::sampler ( address_mode  _Address_mode,
float_4  _Border_color = float_4(0.0f, 0.0f, 0.0f, 0.0f) 
)
inline

Constructs a sampler with default filter mode (filter_linear, same for min, mag, mip), but specified addressing mode (same for all dimensions) and border color.

Parameters
_Address_modeThe addressing mode to be used in sampling for all dimensions.
_Border_colorThe border color to be used if address mode is address_border. If not specified, default value is float_4(0.f, 0.f, 0.f, 0.f).
2940  _M_address_mode(_Address_mode),
2941  _M_border_color(_Border_color)
2942  {
2943  _Initialize();
2944  }
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3089
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Definition: amp_graphics.h:2873
Concurrency::graphics::sampler::sampler ( filter_mode  _Filter_mode,
address_mode  _Address_mode,
float_4  _Border_color = float_4(0.0f, 0.0f, 0.0f, 0.0f) 
)
inline

Constructs a sampler with specified filter mode (same for min, mag, mip), addressing mode (same for all dimensions) and the border color.

Parameters
_Filter_modeThe filter mode to be used in sampling.
_Address_modeThe addressing mode to be used in sampling for all dimensions.
_Border_colorThe border color to be used if address mode is address_border. If not specified, default value is float_4(0.f, 0.f, 0.f, 0.f).
2960  : _M_filter_mode(_Filter_mode),
2961  _M_address_mode(_Address_mode),
2962  _M_border_color(_Border_color)
2963  {
2964  _Initialize();
2965  }
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3089
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Concurrency::graphics::sampler::sampler ( const sampler _Other)
inline

Copy constructor.

Parameters
_OtherAn object of type sampler from which to initialize this new sampler.
2974  : _M_filter_mode(_Other._M_filter_mode),
2975  _M_address_mode(_Other._M_address_mode),
2976  _M_border_color(_Other._M_border_color),
2977  _M_sampler_descriptor(_Other._M_sampler_descriptor)
2978  {
2979  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Concurrency::graphics::sampler::sampler ( sampler &&  _Other)
inline

Move constructor.

Parameters
_OtherThe sampler to move from.
2988  : _M_filter_mode(_Other._M_filter_mode),
2989  _M_address_mode(_Other._M_address_mode),
2990  _M_border_color(_Other._M_border_color),
2991  _M_sampler_descriptor(_Other._M_sampler_descriptor)
2992  {
2993  _Other._M_sampler_descriptor._M_data_ptr = NULL;
2994  _Other._M_sampler_descriptor._Set_sampler_ptr(NULL);
2995  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
#define NULL
Definition: crtdbg.h:30
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void * _M_data_ptr
Definition: amprt.h:715
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Concurrency::graphics::sampler::sampler ( const _Sampler_descriptor _Descriptor)
inlineprivate
3074  : _M_sampler_descriptor(_Descriptor),
3077  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
3078  {
3079  // Although we could query border value from the adopted sampler, but it's not that useful
3080  // given that this is the only thing that we could query and when the address mode is not
3081  // address_border, border value is not relevant.
3082  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
Definition: amp_graphics.h:2874
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Definition: amp_graphics.h:2886

Member Function Documentation

const _Sampler_descriptor& Concurrency::graphics::sampler::_Get_descriptor ( ) const
inlineprivate
3105  {
3106  return _M_sampler_descriptor;
3107  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
_Ret_ _Sampler* Concurrency::graphics::sampler::_Get_sampler_ptr ( ) const
inlineprivate
3085  {
3087  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
_Ret_ _Sampler * _Get_sampler_ptr() const __CPU_ONLY
Definition: amprt.h:775
void Concurrency::graphics::sampler::_Initialize ( )
inlineprivate
3090  {
3091  // Check if the given filter_mode and address_mode are valid C++ AMP ones
3095  {
3096  throw runtime_exception("Invalid sampler configuration", E_INVALIDARG);
3097  }
3098 
3099  _Sampler_ptr samplerPtr = _Sampler::_Create(_M_filter_mode, _M_address_mode,
3102  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
Definition: amp_graphics.h:2884
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
Definition: amp_graphics.h:2882
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
Definition: amp_graphics.h:2883
Definition: amp_graphics.h:2873
details::_Reference_counted_obj_ptr< details::_Sampler > _Sampler_ptr
Definition: amprt.h:304
Definition: amp_graphics.h:2885
void _Set_sampler_ptr(_In_opt_ _Sampler *_Sampler_ptr) __CPU_ONLY
Definition: amprt.h:780
Definition: amp_graphics.h:2872
__declspec (property(get=get_address_mode)) Concurrency Concurrency::graphics::address_mode Concurrency::graphics::sampler::get_address_mode ( ) const
inline

Returns the sampler's address mode

3055  {
3056  return _M_address_mode;
3057  }
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
__declspec (property(get=get_border_color)) Concurrency Concurrency::graphics::float_4 Concurrency::graphics::sampler::get_border_color ( ) const
inline

Returns the sampler's border value

3064  {
3065  return _M_border_color;
3066  }
float_4 _M_border_color
Definition: amp_graphics.h:3112
__declspec (property(get=get_filter_mode)) Concurrency Concurrency::graphics::filter_mode Concurrency::graphics::sampler::get_filter_mode ( ) const
inline

Returns the sampler's filter mode

3046  {
3047  return _M_filter_mode;
3048  }
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
sampler& Concurrency::graphics::sampler::operator= ( const sampler _Other)
inline

Assignment operator.

Parameters
_OtherAn object of type sampler from which to copy into this sampler.
Returns
A reference to this sampler.
3007  {
3008  if (this != &_Other)
3009  {
3010  _M_filter_mode = _Other._M_filter_mode;
3011  _M_address_mode = _Other._M_address_mode;
3012  _M_border_color = _Other._M_border_color;
3013  _M_sampler_descriptor = _Other._M_sampler_descriptor;
3014  }
3015  return *this;
3016  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111
sampler& Concurrency::graphics::sampler::operator= ( sampler &&  _Other)
inline

Move assignment operator.

Parameters
_OtherAn object of type sampler to move from.
Returns
A reference to this sampler.
3028  {
3029  if (this != &_Other)
3030  {
3031  _M_filter_mode = _Other._M_filter_mode;
3032  _M_address_mode = _Other._M_address_mode;
3033  _M_border_color = _Other._M_border_color;
3034  _M_sampler_descriptor = _Other._M_sampler_descriptor;
3035  _Other._M_sampler_descriptor._M_data_ptr = NULL;
3036  _Other._M_sampler_descriptor._Set_sampler_ptr(NULL);
3037  }
3038  return *this;
3039  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3109
#define NULL
Definition: crtdbg.h:30
float_4 _M_border_color
Definition: amp_graphics.h:3112
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3110
void * _M_data_ptr
Definition: amprt.h:715
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3111

Friends And Related Function Documentation

_Ret_ IUnknown* direct3d::get_sampler ( const Concurrency::accelerator_view _Av,
const sampler _Sampler 
)
friend
sampler direct3d::make_sampler ( _In_ IUnknown *  _D3D_sampler)
friend
template<typename _Value_type , int _Rank>
friend class texture_view
friend

Member Data Documentation

Concurrency::graphics::address_mode Concurrency::graphics::sampler::_M_address_mode
private
float_4 Concurrency::graphics::sampler::_M_border_color
private
Concurrency::graphics::filter_mode Concurrency::graphics::sampler::_M_filter_mode
private
_Sampler_descriptor Concurrency::graphics::sampler::_M_sampler_descriptor
private

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