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)).

2940  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
2941  {
2942  _Initialize();
2943  }
Definition: amp_graphics.h:2916
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3121
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Definition: amp_graphics.h:2905
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.
2953  : _M_filter_mode(_Filter_mode),
2955  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
2956  {
2957  _Initialize();
2958  }
Definition: amp_graphics.h:2916
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3121
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
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).
2972  _M_address_mode(_Address_mode),
2973  _M_border_color(_Border_color)
2974  {
2975  _Initialize();
2976  }
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3121
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Definition: amp_graphics.h:2905
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).
2992  : _M_filter_mode(_Filter_mode),
2993  _M_address_mode(_Address_mode),
2994  _M_border_color(_Border_color)
2995  {
2996  _Initialize();
2997  }
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void _Initialize() __CPU_ONLY
Definition: amp_graphics.h:3121
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Concurrency::graphics::sampler::sampler ( const sampler _Other)
inline

Copy constructor.

Parameters
_OtherAn object of type sampler from which to initialize this new sampler.
3006  : _M_filter_mode(_Other._M_filter_mode),
3007  _M_address_mode(_Other._M_address_mode),
3008  _M_border_color(_Other._M_border_color),
3009  _M_sampler_descriptor(_Other._M_sampler_descriptor)
3010  {
3011  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Concurrency::graphics::sampler::sampler ( sampler &&  _Other)
inline

Move constructor.

Parameters
_OtherThe sampler to move from.
3020  : _M_filter_mode(_Other._M_filter_mode),
3021  _M_address_mode(_Other._M_address_mode),
3022  _M_border_color(_Other._M_border_color),
3023  _M_sampler_descriptor(_Other._M_sampler_descriptor)
3024  {
3025  _Other._M_sampler_descriptor._M_data_ptr = NULL;
3026  _Other._M_sampler_descriptor._Set_sampler_ptr(NULL);
3027  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void * _M_data_ptr
Definition: amprt.h:720
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
#define NULL
Definition: corecrt.h:158
Concurrency::graphics::sampler::sampler ( const _Sampler_descriptor _Descriptor)
inlineprivate
3106  : _M_sampler_descriptor(_Descriptor),
3109  _M_border_color(float_4(0.0f, 0.0f, 0.0f, 0.0f))
3110  {
3111  // Although we could query border value from the adopted sampler, but it's not that useful
3112  // given that this is the only thing that we could query and when the address mode is not
3113  // address_border, border value is not relevant.
3114  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
Definition: amp_graphics.h:2906
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Definition: amp_graphics.h:2918

Member Function Documentation

const _Sampler_descriptor& Concurrency::graphics::sampler::_Get_descriptor ( ) const
inlineprivate
3137  {
3138  return _M_sampler_descriptor;
3139  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
_Ret_ _Sampler* Concurrency::graphics::sampler::_Get_sampler_ptr ( ) const
inlineprivate
3117  {
3119  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
_Ret_ _Sampler * _Get_sampler_ptr() const __CPU_ONLY
Definition: amprt.h:780
void Concurrency::graphics::sampler::_Initialize ( )
inlineprivate
3122  {
3123  // Check if the given filter_mode and address_mode are valid C++ AMP ones
3127  {
3128  throw runtime_exception("Invalid sampler configuration", E_INVALIDARG);
3129  }
3130 
3131  _Sampler_ptr samplerPtr = _Sampler::_Create(_M_filter_mode, _M_address_mode,
3134  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
Definition: amp_graphics.h:2916
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
Definition: amp_graphics.h:2914
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
Definition: amp_graphics.h:2915
Definition: amp_graphics.h:2905
details::_Reference_counted_obj_ptr< details::_Sampler > _Sampler_ptr
Definition: amprt.h:310
Definition: amp_graphics.h:2917
void _Set_sampler_ptr(_In_opt_ _Sampler *_Sampler_ptr) __CPU_ONLY
Definition: amprt.h:785
Definition: amp_graphics.h:2904
__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

3087  {
3088  return _M_address_mode;
3089  }
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
__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

3096  {
3097  return _M_border_color;
3098  }
float_4 _M_border_color
Definition: amp_graphics.h:3144
__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

3078  {
3079  return _M_filter_mode;
3080  }
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
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.
3039  {
3040  if (this != &_Other)
3041  {
3042  _M_filter_mode = _Other._M_filter_mode;
3043  _M_address_mode = _Other._M_address_mode;
3044  _M_border_color = _Other._M_border_color;
3045  _M_sampler_descriptor = _Other._M_sampler_descriptor;
3046  }
3047  return *this;
3048  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
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.
3060  {
3061  if (this != &_Other)
3062  {
3063  _M_filter_mode = _Other._M_filter_mode;
3064  _M_address_mode = _Other._M_address_mode;
3065  _M_border_color = _Other._M_border_color;
3066  _M_sampler_descriptor = _Other._M_sampler_descriptor;
3067  _Other._M_sampler_descriptor._M_data_ptr = NULL;
3068  _Other._M_sampler_descriptor._Set_sampler_ptr(NULL);
3069  }
3070  return *this;
3071  }
_Sampler_descriptor _M_sampler_descriptor
Definition: amp_graphics.h:3141
float_4 _M_border_color
Definition: amp_graphics.h:3144
Concurrency::graphics::filter_mode _M_filter_mode
Definition: amp_graphics.h:3142
void * _M_data_ptr
Definition: amprt.h:720
Concurrency::graphics::address_mode _M_address_mode
Definition: amp_graphics.h:3143
#define NULL
Definition: corecrt.h:158

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: