Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::SamplerDesc Struct Reference

Sampler description. More...

#include <Sampler.h>

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

Public Member Functions

constexpr bool operator== (const SamplerDesc &RHS) const
 Tests if two sampler descriptions are equal.
 

Public Attributes

FILTER_TYPE MinFilter = FILTER_TYPE_LINEAR
 Texture minification filter, see Diligent::FILTER_TYPE for details.
 
FILTER_TYPE MagFilter = FILTER_TYPE_LINEAR
 Texture magnification filter, see Diligent::FILTER_TYPE for details.
 
FILTER_TYPE MipFilter = FILTER_TYPE_LINEAR
 Mip filter, see Diligent::FILTER_TYPE for details.
 
TEXTURE_ADDRESS_MODE AddressU = TEXTURE_ADDRESS_CLAMP
 
TEXTURE_ADDRESS_MODE AddressV = TEXTURE_ADDRESS_CLAMP
 Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
 
TEXTURE_ADDRESS_MODE AddressW = TEXTURE_ADDRESS_CLAMP
 Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.
 
SAMPLER_FLAGS Flags = SAMPLER_FLAG_NONE
 Sampler flags, see Diligent::SAMPLER_FLAGS for details.
 
Bool UnnormalizedCoords = False
 Indicates whether to use unnormalized texture coordinates.
 
Float32 MipLODBias = 0
 Offset from the calculated mipmap level.
 
Uint32 MaxAnisotropy = 0
 Maximum anisotropy level for the anisotropic filter. Default value: 0.
 
COMPARISON_FUNCTION ComparisonFunc = COMPARISON_FUNC_NEVER
 A function that compares sampled data against existing sampled data when comparison filter is used.
 
Float32 BorderColor [4] = {}
 Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.
 
float MinLOD = 0
 Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels.
 
float MaxLOD = +3.402823466e+38F
 Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels.
 
- Public Attributes inherited from Diligent::DeviceObjectAttribs
const Char * Name = nullptr
 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.

Member Function Documentation

◆ operator==()

bool Diligent::SamplerDesc::operator== ( const SamplerDesc & RHS) const
inlineconstexpr

Tests if two sampler descriptions are equal.

Parameters
[in]RHS- reference to the structure to compare with.
Returns
true if all members of the two structures except for the Name are equal, and false otherwise.
Note
The operator ignores the Name field as it is used for debug purposes and doesn't affect the sampler properties.

Member Data Documentation

◆ AddressU

TEXTURE_ADDRESS_MODE Diligent::SamplerDesc::AddressU = TEXTURE_ADDRESS_CLAMP

Texture address mode for U coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details Default value: Diligent::TEXTURE_ADDRESS_CLAMP.

◆ AddressV

TEXTURE_ADDRESS_MODE Diligent::SamplerDesc::AddressV = TEXTURE_ADDRESS_CLAMP

Texture address mode for V coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.

Default value: Diligent::TEXTURE_ADDRESS_CLAMP.

◆ AddressW

TEXTURE_ADDRESS_MODE Diligent::SamplerDesc::AddressW = TEXTURE_ADDRESS_CLAMP

Texture address mode for W coordinate, see Diligent::TEXTURE_ADDRESS_MODE for details.

Default value: Diligent::TEXTURE_ADDRESS_CLAMP.

◆ BorderColor

Float32 Diligent::SamplerDesc::BorderColor[4] = {}

Border color to use if TEXTURE_ADDRESS_BORDER is specified for AddressU, AddressV, or AddressW.

Default value: {0, 0, 0, 0}

◆ ComparisonFunc

COMPARISON_FUNCTION Diligent::SamplerDesc::ComparisonFunc = COMPARISON_FUNC_NEVER

A function that compares sampled data against existing sampled data when comparison filter is used.

Default value: Diligent::COMPARISON_FUNC_NEVER.

◆ MagFilter

FILTER_TYPE Diligent::SamplerDesc::MagFilter = FILTER_TYPE_LINEAR

Texture magnification filter, see Diligent::FILTER_TYPE for details.

Default value: Diligent::FILTER_TYPE_LINEAR.

◆ MaxLOD

float Diligent::SamplerDesc::MaxLOD = +3.402823466e+38F

Specifies the maximum value that LOD is clamped to before accessing the texture MIP levels.

Must be greater than or equal to MinLOD. Default value: +FLT_MAX.

◆ MinFilter

FILTER_TYPE Diligent::SamplerDesc::MinFilter = FILTER_TYPE_LINEAR

Texture minification filter, see Diligent::FILTER_TYPE for details.

Default value: Diligent::FILTER_TYPE_LINEAR.

◆ MinLOD

float Diligent::SamplerDesc::MinLOD = 0

Specifies the minimum value that LOD is clamped to before accessing the texture MIP levels.

Must be less than or equal to MaxLOD.

Default value: 0.

◆ MipFilter

FILTER_TYPE Diligent::SamplerDesc::MipFilter = FILTER_TYPE_LINEAR

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. Default value: Diligent::FILTER_TYPE_LINEAR.

◆ MipLODBias

Float32 Diligent::SamplerDesc::MipLODBias = 0

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.

Default value: 0.

◆ UnnormalizedCoords

Bool Diligent::SamplerDesc::UnnormalizedCoords = False

Indicates whether to use unnormalized texture coordinates.

When set to True, the range of the image coordinates used to lookup the texel is in the range of 0 to the image size in each dimension. When set to False, the range of image coordinates is 0.0 to 1.0.

Unnormalized coordinates are only supported in Vulkan and Metal.