Diligent Engine API Reference
Public Member Functions | Public Attributes | List of all members
Diligent::SamplerDesc Struct Reference

Sampler description. More...

Inheritance diagram for Diligent::SamplerDesc:
Diligent::DeviceObjectAttribs

Public Member Functions

 SamplerDesc (FILTER_TYPE _MinFilter=FILTER_TYPE_LINEAR, FILTER_TYPE _MagFilter=FILTER_TYPE_LINEAR, FILTER_TYPE _MipFilter=FILTER_TYPE_LINEAR, TEXTURE_ADDRESS_MODE _AddressU=TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_MODE _AddressV=TEXTURE_ADDRESS_CLAMP, TEXTURE_ADDRESS_MODE _AddressW=TEXTURE_ADDRESS_CLAMP, Float32 _MipLODBias=0, Uint32 _MaxAnisotropy=0, COMPARISON_FUNCTION _ComparisonFunc=COMPARISON_FUNC_NEVER, float _MinLOD=0, float _MaxLOD=+FLT_MAX)
 Initializes the structure members. More...
 
bool operator== (const SamplerDesc &RHS) const
 Tests if two structures are equivalent. More...
 
- Public Member Functions inherited from Diligent::DeviceObjectAttribs
 DeviceObjectAttribs ()
 Constructor intializes the structure members with default values.
 

Public Attributes

FILTER_TYPE MinFilter
 Texture minification filter, see Diligent::FILTER_TYPE for details.
 
FILTER_TYPE MagFilter
 Texture magnification filter, see Diligent::FILTER_TYPE for details.
 
FILTER_TYPE MipFilter
 Mip filter, see Diligent::FILTER_TYPE for details. Only FILTER_TYPE_POINT, FILTER_TYPE_LINEAR, FILTER_TYPE_ANISOTROPIC, and FILTER_TYPE_COMPARISON_ANISOTROPIC are allowed.
 
TEXTURE_ADDRESS_MODE AddressU
 Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
 
TEXTURE_ADDRESS_MODE AddressV
 Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
 
TEXTURE_ADDRESS_MODE AddressW
 Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
 
Float32 MipLODBias
 Offset from the calculated mipmap level. For example, if a sampler calculates that a texture should be sampled at mipmap level 1.2 and MipLODBias is 2.3, then the texture will be sampled at mipmap level 3.5.
 
Uint32 MaxAnisotropy
 Maximum anisotropy level for the anisotropic filter.
 
COMPARISON_FUNCTION ComparisonFunc
 A function that compares sampled data against existing sampled data when comparsion filter is used.
 
Float32 BorderColor [4]
 Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
 
float MinLOD
 Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels. Must be less than or equal to MaxLOD.
 
float MaxLOD
 Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels. Must be greater than or equal to MinLOD.
 
- Public Attributes inherited from Diligent::DeviceObjectAttribs
const Char * Name
 Object name.
 

Detailed Description

Sampler description.

This structure describes the sampler state which is used in a call to IRenderDevice::CreateSampler() to create a sampler object.

To create an anisotropic filter, all three filters must either be Diligent::FILTER_TYPE_ANISOTROPIC or Diligent::FILTER_TYPE_COMPARISON_ANISOTROPIC.

MipFilter cannot be comparison filter except for Diligent::FILTER_TYPE_ANISOTROPIC if all three filters have that value.

Both MinFilter and MagFilter must either be regular filters or comparison filters. Mixing comparison and regular filters is an error.

Constructor & Destructor Documentation

◆ SamplerDesc()

Diligent::SamplerDesc::SamplerDesc ( FILTER_TYPE  _MinFilter = FILTER_TYPE_LINEAR,
FILTER_TYPE  _MagFilter = FILTER_TYPE_LINEAR,
FILTER_TYPE  _MipFilter = FILTER_TYPE_LINEAR,
TEXTURE_ADDRESS_MODE  _AddressU = TEXTURE_ADDRESS_CLAMP,
TEXTURE_ADDRESS_MODE  _AddressV = TEXTURE_ADDRESS_CLAMP,
TEXTURE_ADDRESS_MODE  _AddressW = TEXTURE_ADDRESS_CLAMP,
Float32  _MipLODBias = 0,
Uint32  _MaxAnisotropy = 0,
COMPARISON_FUNCTION  _ComparisonFunc = COMPARISON_FUNC_NEVER,
float  _MinLOD = 0,
float  _MaxLOD = +FLT_MAX 
)
inline

Initializes the structure members.

Member Default va
MinFilter FILTER_TYPE_LINEAR
MagFilter FILTER_TYPE_LINEAR
MipFilter FILTER_TYPE_LINEAR
AddressU TEXTURE_ADDRESS_CLAMP
AddressV TEXTURE_ADDRESS_CLAMP
AddressW TEXTURE_ADDRESS_CLAMP
MipLODBias 0
MaxAnisotropy 0
ComparisonFunc COMPARISON_FUNC_NEVER
BorderColor (0,0,0,0)
MinLOD 0
MaxLOD +FLT_MAX

Member Function Documentation

◆ operator==()

bool Diligent::SamplerDesc::operator== ( const SamplerDesc RHS) const
inline

Tests if two structures are equivalent.

Parameters
[in]RHS- reference to the structure to perform comparison with
Returns
  • True if all members of the two structures are equal.
  • False otherwise. The operator ignores DeviceObjectAttribs::Name field as it does not affect the sampler state.