Class VkSamplerCreateInfo

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class VkSamplerCreateInfo
    extends Struct
    implements NativeResource
    Structure specifying parameters of a newly created sampler.
    Mapping of OpenGL to Vulkan filter modes

    magFilter values of FILTER_NEAREST and FILTER_LINEAR directly correspond to GL_NEAREST and GL_LINEAR magnification filters. minFilter and mipmapMode combine to correspond to the similarly named OpenGL minification filter of GL_minFilter_MIPMAP_mipmapMode (e.g. minFilter of FILTER_LINEAR and mipmapMode of SAMPLER_MIPMAP_MODE_NEAREST correspond to GL_LINEAR_MIPMAP_NEAREST).

    There are no Vulkan filter modes that directly correspond to OpenGL minification filters of GL_LINEAR or GL_NEAREST, but they can be emulated using SAMPLER_MIPMAP_MODE_NEAREST, minLod = 0, and maxLod = 0.25, and using minFilter = FILTER_LINEAR or minFilter = FILTER_NEAREST, respectively.

    Note that using a maxLod of zero would cause magnification to always be performed, and the magFilter to always be used. This is valid, just not an exact match for OpenGL behavior. Clamping the maximum LOD to 0.25 allows the λ value to be non-zero and minification to be performed, while still always rounding down to the base level. If the minFilter and magFilter are equal, then using a maxLod of zero also works.

    The maximum number of sampler objects which can be simultaneously created on a device is implementation-dependent and specified by the maxSamplerAllocationCount member of the VkPhysicalDeviceLimits structure. If maxSamplerAllocationCount is exceeded, CreateSampler will return ERROR_TOO_MANY_OBJECTS.

    Since VkSampler is a non-dispatchable handle type, implementations may return the same handle for sampler state vectors that are identical. In such cases, all such objects would only count once against the maxSamplerAllocationCount limit.

    Valid Usage
    Valid Usage (Implicit)
    • Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkSamplerReductionModeCreateInfoEXT or VkSamplerYcbcrConversionInfo
    • Each sType member in the pNext chain must be unique
    • flags must be 0
    • magFilter must be a valid VkFilter value
    • minFilter must be a valid VkFilter value
    • mipmapMode must be a valid VkSamplerMipmapMode value
    • addressModeU must be a valid VkSamplerAddressMode value
    • addressModeV must be a valid VkSamplerAddressMode value
    • addressModeW must be a valid VkSamplerAddressMode value
    See Also


    Member documentation

    • sType – the type of this structure.
    • pNextNULL or a pointer to an extension-specific structure.
    • flags – reserved for future use.
    • magFilter – a VkFilter value specifying the magnification filter to apply to lookups.
    • minFilter – a VkFilter value specifying the minification filter to apply to lookups.
    • mipmapMode – a VkSamplerMipmapMode value specifying the mipmap filter to apply to lookups.
    • addressModeU – a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for U coordinate.
    • addressModeV – a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for V coordinate.
    • addressModeW – a VkSamplerAddressMode value specifying the addressing mode for outside [0..1] range for W coordinate.
    • mipLodBias – the bias to be added to mipmap LOD (level-of-detail) calculation and bias provided by image sampling functions in SPIR-V, as described in the Level-of-Detail Operation section.
    • anisotropyEnableTRUE to enable anisotropic filtering, as described in the Texel Anisotropic Filtering section, or FALSE otherwise.
    • maxAnisotropy – the anisotropy value clamp used by the sampler when anisotropyEnable is TRUE. If anisotropyEnable is FALSE, maxAnisotropy is ignored.
    • compareEnableTRUE to enable comparison against a reference value during lookups, or FALSE otherwise.
      • Note: Some implementations will default to shader state if this member does not match.
    • compareOp – a VkCompareOp value specifying the comparison function to apply to fetched data before filtering as described in the Depth Compare Operation section.
    • minLodminLod and maxLod are the values used to clamp the computed LOD value, as described in the Level-of-Detail Operation section.
    • maxLod – see minLod
    • borderColor – a VkBorderColor value specifying the predefined border color to use.
    • unnormalizedCoordinates – controls whether to use unnormalized or normalized texel coordinates to address texels of the image. When set to TRUE, the range of the image coordinates used to lookup the texel is in the range of zero to the image dimensions for x, y and z. When set to FALSE the range of image coordinates is zero to one. When unnormalizedCoordinates is TRUE, samplers have the following requirements:

      When unnormalizedCoordinates is TRUE, images the sampler is used with in the shader have the following requirements:

      When unnormalizedCoordinates is TRUE, image built-in functions in the shader that use the sampler have the following requirements:

      • The functions must not use projection.
      • The functions must not use offsets.


     struct VkSamplerCreateInfo {
         VkStructureType sType;
         void const * pNext;
         VkSamplerCreateFlags flags;
         VkFilter magFilter;
         VkFilter minFilter;
         VkSamplerMipmapMode mipmapMode;
         VkSamplerAddressMode addressModeU;
         VkSamplerAddressMode addressModeV;
         VkSamplerAddressMode addressModeW;
         float mipLodBias;
         VkBool32 anisotropyEnable;
         float maxAnisotropy;
         VkBool32 compareEnable;
         VkCompareOp compareOp;
         float minLod;
         float maxLod;
         VkBorderColor borderColor;
         VkBool32 unnormalizedCoordinates;
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.

        The struct member offsets.
    • Constructor Detail

      • VkSamplerCreateInfo

        public VkSamplerCreateInfo​(java.nio.ByteBuffer container)
        Creates a VkSamplerCreateInfo instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • sType

        public int sType()
        Returns the value of the sType field.
      • pNext

        public long pNext()
        Returns the value of the pNext field.
      • flags

        public int flags()
        Returns the value of the flags field.
      • magFilter

        public int magFilter()
        Returns the value of the magFilter field.
      • minFilter

        public int minFilter()
        Returns the value of the minFilter field.
      • mipmapMode

        public int mipmapMode()
        Returns the value of the mipmapMode field.
      • addressModeU

        public int addressModeU()
        Returns the value of the addressModeU field.
      • addressModeV

        public int addressModeV()
        Returns the value of the addressModeV field.
      • addressModeW

        public int addressModeW()
        Returns the value of the addressModeW field.
      • mipLodBias

        public float mipLodBias()
        Returns the value of the mipLodBias field.
      • anisotropyEnable

        public boolean anisotropyEnable()
        Returns the value of the anisotropyEnable field.
      • maxAnisotropy

        public float maxAnisotropy()
        Returns the value of the maxAnisotropy field.
      • compareEnable

        public boolean compareEnable()
        Returns the value of the compareEnable field.
      • compareOp

        public int compareOp()
        Returns the value of the compareOp field.
      • minLod

        public float minLod()
        Returns the value of the minLod field.
      • maxLod

        public float maxLod()
        Returns the value of the maxLod field.
      • borderColor

        public int borderColor()
        Returns the value of the borderColor field.
      • unnormalizedCoordinates

        public boolean unnormalizedCoordinates()
        Returns the value of the unnormalizedCoordinates field.
      • sType

        public VkSamplerCreateInfo sType​(int value)
        Sets the specified value to the sType field.
      • pNext

        public VkSamplerCreateInfo pNext​(long value)
        Sets the specified value to the pNext field.
      • flags

        public VkSamplerCreateInfo flags​(int value)
        Sets the specified value to the flags field.
      • magFilter

        public VkSamplerCreateInfo magFilter​(int value)
        Sets the specified value to the magFilter field.
      • minFilter

        public VkSamplerCreateInfo minFilter​(int value)
        Sets the specified value to the minFilter field.
      • mipmapMode

        public VkSamplerCreateInfo mipmapMode​(int value)
        Sets the specified value to the mipmapMode field.
      • addressModeU

        public VkSamplerCreateInfo addressModeU​(int value)
        Sets the specified value to the addressModeU field.
      • addressModeV

        public VkSamplerCreateInfo addressModeV​(int value)
        Sets the specified value to the addressModeV field.
      • addressModeW

        public VkSamplerCreateInfo addressModeW​(int value)
        Sets the specified value to the addressModeW field.
      • mipLodBias

        public VkSamplerCreateInfo mipLodBias​(float value)
        Sets the specified value to the mipLodBias field.
      • anisotropyEnable

        public VkSamplerCreateInfo anisotropyEnable​(boolean value)
        Sets the specified value to the anisotropyEnable field.
      • maxAnisotropy

        public VkSamplerCreateInfo maxAnisotropy​(float value)
        Sets the specified value to the maxAnisotropy field.
      • compareEnable

        public VkSamplerCreateInfo compareEnable​(boolean value)
        Sets the specified value to the compareEnable field.
      • compareOp

        public VkSamplerCreateInfo compareOp​(int value)
        Sets the specified value to the compareOp field.
      • minLod

        public VkSamplerCreateInfo minLod​(float value)
        Sets the specified value to the minLod field.
      • maxLod

        public VkSamplerCreateInfo maxLod​(float value)
        Sets the specified value to the maxLod field.
      • borderColor

        public VkSamplerCreateInfo borderColor​(int value)
        Sets the specified value to the borderColor field.
      • unnormalizedCoordinates

        public VkSamplerCreateInfo unnormalizedCoordinates​(boolean value)
        Sets the specified value to the unnormalizedCoordinates field.
      • set

        public VkSamplerCreateInfo set​(int sType,
                                       long pNext,
                                       int flags,
                                       int magFilter,
                                       int minFilter,
                                       int mipmapMode,
                                       int addressModeU,
                                       int addressModeV,
                                       int addressModeW,
                                       float mipLodBias,
                                       boolean anisotropyEnable,
                                       float maxAnisotropy,
                                       boolean compareEnable,
                                       int compareOp,
                                       float minLod,
                                       float maxLod,
                                       int borderColor,
                                       boolean unnormalizedCoordinates)
        Initializes this struct with the specified values.
      • createSafe

        public static VkSamplerCreateInfo createSafe​(long address)
        Like create, but returns null if address is NULL.
      • nsType

        public static int nsType​(long struct)
        Unsafe version of sType().
      • npNext

        public static long npNext​(long struct)
        Unsafe version of pNext().
      • nflags

        public static int nflags​(long struct)
        Unsafe version of flags().
      • nmagFilter

        public static int nmagFilter​(long struct)
        Unsafe version of magFilter().
      • nminFilter

        public static int nminFilter​(long struct)
        Unsafe version of minFilter().
      • nmipmapMode

        public static int nmipmapMode​(long struct)
        Unsafe version of mipmapMode().
      • naddressModeU

        public static int naddressModeU​(long struct)
        Unsafe version of addressModeU().
      • naddressModeV

        public static int naddressModeV​(long struct)
        Unsafe version of addressModeV().
      • naddressModeW

        public static int naddressModeW​(long struct)
        Unsafe version of addressModeW().
      • nmipLodBias

        public static float nmipLodBias​(long struct)
        Unsafe version of mipLodBias().
      • nanisotropyEnable

        public static int nanisotropyEnable​(long struct)
        Unsafe version of anisotropyEnable().
      • nmaxAnisotropy

        public static float nmaxAnisotropy​(long struct)
        Unsafe version of maxAnisotropy().
      • ncompareEnable

        public static int ncompareEnable​(long struct)
        Unsafe version of compareEnable().
      • ncompareOp

        public static int ncompareOp​(long struct)
        Unsafe version of compareOp().
      • nminLod

        public static float nminLod​(long struct)
        Unsafe version of minLod().
      • nmaxLod

        public static float nmaxLod​(long struct)
        Unsafe version of maxLod().
      • nborderColor

        public static int nborderColor​(long struct)
        Unsafe version of borderColor().
      • nunnormalizedCoordinates

        public static int nunnormalizedCoordinates​(long struct)
        Unsafe version of unnormalizedCoordinates().
      • nsType

        public static void nsType​(long struct,
                                  int value)
        Unsafe version of sType.
      • npNext

        public static void npNext​(long struct,
                                  long value)
        Unsafe version of pNext.
      • nflags

        public static void nflags​(long struct,
                                  int value)
        Unsafe version of flags.
      • nmagFilter

        public static void nmagFilter​(long struct,
                                      int value)
        Unsafe version of magFilter.
      • nminFilter

        public static void nminFilter​(long struct,
                                      int value)
        Unsafe version of minFilter.
      • nmipmapMode

        public static void nmipmapMode​(long struct,
                                       int value)
        Unsafe version of mipmapMode.
      • naddressModeU

        public static void naddressModeU​(long struct,
                                         int value)
        Unsafe version of addressModeU.
      • naddressModeV

        public static void naddressModeV​(long struct,
                                         int value)
        Unsafe version of addressModeV.
      • naddressModeW

        public static void naddressModeW​(long struct,
                                         int value)
        Unsafe version of addressModeW.
      • nmipLodBias

        public static void nmipLodBias​(long struct,
                                       float value)
        Unsafe version of mipLodBias.
      • nanisotropyEnable

        public static void nanisotropyEnable​(long struct,
                                             int value)
        Unsafe version of anisotropyEnable.
      • nmaxAnisotropy

        public static void nmaxAnisotropy​(long struct,
                                          float value)
        Unsafe version of maxAnisotropy.
      • ncompareEnable

        public static void ncompareEnable​(long struct,
                                          int value)
        Unsafe version of compareEnable.
      • ncompareOp

        public static void ncompareOp​(long struct,
                                      int value)
        Unsafe version of compareOp.
      • nminLod

        public static void nminLod​(long struct,
                                   float value)
        Unsafe version of minLod.
      • nmaxLod

        public static void nmaxLod​(long struct,
                                   float value)
        Unsafe version of maxLod.
      • nborderColor

        public static void nborderColor​(long struct,
                                        int value)
        Unsafe version of borderColor.
      • nunnormalizedCoordinates

        public static void nunnormalizedCoordinates​(long struct,
                                                    int value)
        Unsafe version of unnormalizedCoordinates.