VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | Public Attributes | List of all members
vpp::SNormalizedSampler Struct Reference

Structure describing normalized sampler parameters. More...

#include <vppSampler.hpp>

Public Member Functions

 SNormalizedSampler (float maxLod=1.0f)
 Constructor setting default parameters. More...
 
bool operator< (const SNormalizedSampler &rhs) const
 Ordering operator. Useful for storing sampler descriptions in sets or maps.
 

Public Attributes

unsigned int addressModeU
 Texel addressing mode for the U coordinate. More...
 
unsigned int addressModeV
 Texel addressing mode for the V coordinate. More...
 
unsigned int addressModeW
 Texel addressing mode for the W coordinate. More...
 
unsigned int borderColor
 Defines the color for border texels. More...
 
unsigned int compareOp
 Specifies the comparison function to apply to fetched data before the depth compare operation. More...
 
unsigned int compare
 Enables depth comparison operation for this sampler. More...
 
unsigned int magFilterMode
 Specifies the method of interpolation when upscaling the texture. More...
 
unsigned int minFilterMode
 Specifies the method of interpolation when downscaling the texture. More...
 
unsigned int mipMapMode
 Specifies the method of interpolation between mip levels. More...
 
unsigned int anisotropy
 Enables anisotropic filtering. More...
 
float mipLodBias
 The bias to be added to mipmap LOD (level-of-detail) calculation. More...
 
float maxAnisotropy
 The anisotropy value clamp. Ignored when anisotropy is disabled. More...
 
float minLod
 The minimum value used to clamp the computed LOD value. More...
 
float maxLod
 The maximum value used to clamp the computed LOD value. More...
 

Detailed Description

Structure describing normalized sampler parameters.

Normalized sampler is a sampler using the coordinates in range [ 0, 1 ].

Use SNormalizedSampler structure to define parameters of the sampler and NormalizedSampler class to create the sampler object.

Constructor & Destructor Documentation

◆ SNormalizedSampler()

vpp::SNormalizedSampler::SNormalizedSampler ( float  maxLod = 1.0f)

Constructor setting default parameters.

The default values are given in individual parameter descriptions.

Member Data Documentation

◆ addressModeU

unsigned int vpp::SNormalizedSampler::addressModeU

Texel addressing mode for the U coordinate.

Controls the wraparound of computed integer coordinate of the texel.

Let SIZE be the image size in corresponding direction and i the integer coordinate value (computed from floating-point value). Then the meaning of values is as follows:

  • VK_SAMPLER_ADDRESS_MODE_REPEAT: i mod SIZE
  • VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT: (SIZE-1) - mirror ( ( i mod ( 2*SIZE ) ) - SIZE )
  • VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE: clamp ( i, 0, SIZE-1 )
  • VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER: clamp ( i, -1, SIZE )
  • VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE: clamp ( mirror(i), 0, SIZE-1 )

The functions are defined as:

  • mirror ( n ) = ( n >= 0 ? n : -(1+n) )
  • clamp ( n, a, b ) = ( n < a ? a : ( n > b ? b : n ) )

See section 15.9.1 of the Vulkan specs for more detail.

Default value: VK_SAMPLER_ADDRESS_MODE_REPEAT.

◆ addressModeV

unsigned int vpp::SNormalizedSampler::addressModeV

Texel addressing mode for the V coordinate.

The meaning is the same as for addressModeU. See section 15.9.1 of the Vulkan specs for more detail.

Default value: VK_SAMPLER_ADDRESS_MODE_REPEAT.

◆ addressModeW

unsigned int vpp::SNormalizedSampler::addressModeW

Texel addressing mode for the W coordinate.

The meaning is the same as for addressModeU. See section 15.9.1 of the Vulkan specs for more detail.

Default value: VK_SAMPLER_ADDRESS_MODE_REPEAT.

◆ anisotropy

unsigned int vpp::SNormalizedSampler::anisotropy

Enables anisotropic filtering.

See section 15.9.4 of the Vulkan specification for more details.

Default value: false.

◆ borderColor

unsigned int vpp::SNormalizedSampler::borderColor

Defines the color for border texels.

A border texel is a texel outside valid range of coordinates. This can happen e.g. if VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER mdoe is set. The substitute color is chosen according to the following:

  • VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK specifies a transparent, floating-point format, black color.
  • VK_BORDER_COLOR_INT_TRANSPARENT_BLACK specifies a transparent, integer format, black color.
  • VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK specifies an opaque, floating-point format, black color.
  • VK_BORDER_COLOR_INT_OPAQUE_BLACK specifies an opaque, integer format, black color.
  • VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE specifies an opaque, floating-point format, white color.
  • VK_BORDER_COLOR_INT_OPAQUE_WHITE specifies an opaque, integer format, white color.

See section 15.3.1 of Vulkan docs for more details.

Default value: VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK.

◆ compare

unsigned int vpp::SNormalizedSampler::compare

Enables depth comparison operation for this sampler.

This field must be set to true if this sampler will be used to sample a depth image with TextureDref, TextureLodDref, TextureProjDref, TextureLodProjDref, TextureGatherDref functions. In such case, also comparison operator must be selected.

Otherwise it must be set to false.

Default value: false.

◆ compareOp

unsigned int vpp::SNormalizedSampler::compareOp

Specifies the comparison function to apply to fetched data before the depth compare operation.

One of the following values:

  • VK_COMPARE_OP_NEVER,
  • VK_COMPARE_OP_LESS,
  • VK_COMPARE_OP_EQUAL,
  • VK_COMPARE_OP_LESS_OR_EQUAL,
  • VK_COMPARE_OP_GREATER,
  • VK_COMPARE_OP_NOT_EQUAL,
  • VK_COMPARE_OP_GREATER_OR_EQUAL,
  • VK_COMPARE_OP_ALWAYS.

Depth comparisons are performed when reading the image with depth comparing functions, namely: TextureDref, TextureLodDref, TextureProjDref, TextureLodProjDref, TextureGatherDref. These functions operate on images containing single floating point values, determining some kind of distance (e.g. from the light source). Depth comparison functions do not return this distance, but rather compares it with specified value and yield either 0.0 or 1.0 value depending on the selected comparison operator. These values are then subject to filtering (interpolation).

This is typically used in shadow map algorithms to create smooth shadows.

See section 15.3.4 of Vulkan docs for more details.

Default value: VK_COMPARE_OP_NEVER.

◆ magFilterMode

unsigned int vpp::SNormalizedSampler::magFilterMode

Specifies the method of interpolation when upscaling the texture.

It has to be one of the values:

  • VK_FILTER_NEAREST specifies nearest filtering (no interpolation).
  • VK_FILTER_LINEAR specifies linear filtering (linear interpolation with neighbours).

See section 15.9.3 of the Vulkan specification for more details.

Default value: VK_FILTER_LINEAR.

◆ maxAnisotropy

float vpp::SNormalizedSampler::maxAnisotropy

The anisotropy value clamp. Ignored when anisotropy is disabled.

Default value: 0.

◆ maxLod

float vpp::SNormalizedSampler::maxLod

The maximum value used to clamp the computed LOD value.

See section 15.6.7 of the Vulkan specification for more details.

Default value: 1 or specified in the constructor.

◆ minFilterMode

unsigned int vpp::SNormalizedSampler::minFilterMode

Specifies the method of interpolation when downscaling the texture.

It has to be one of the values:

  • VK_FILTER_NEAREST specifies nearest filtering (no interpolation).
  • VK_FILTER_LINEAR specifies linear filtering (linear interpolation with neighbours).

See section 15.9.3 of the Vulkan specification for more details.

Default value: VK_FILTER_LINEAR.

◆ minLod

float vpp::SNormalizedSampler::minLod

The minimum value used to clamp the computed LOD value.

See section 15.6.7 of the Vulkan specification for more details.

Default value: 0.

◆ mipLodBias

float vpp::SNormalizedSampler::mipLodBias

The bias to be added to mipmap LOD (level-of-detail) calculation.

See section 15.6.7 of the Vulkan specification for more details.

Default value: 0.

◆ mipMapMode

unsigned int vpp::SNormalizedSampler::mipMapMode

Specifies the method of interpolation between mip levels.

  • VK_SAMPLER_MIPMAP_MODE_NEAREST specifies nearest filtering (no interpolation).
  • VK_SAMPLER_MIPMAP_MODE_LINEAR specifies linear filtering (linear interpolation with neighbours).

See section 15.9.3 of the Vulkan specification for more detail.

Default value: VK_SAMPLER_MIPMAP_MODE_LINEAR.


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