Class VkSamplerCreateInfo

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VkSamplerCreateInfo>
org.lwjgl.vulkan.VkSamplerCreateInfo
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class VkSamplerCreateInfo extends org.lwjgl.system.Struct<VkSamplerCreateInfo> implements org.lwjgl.system.NativeResource
Structure specifying parameters of a newly created sampler.
Description
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.

Note

For historical reasons, if maxSamplerAllocationCount is exceeded, some implementations may return ERROR_TOO_MANY_OBJECTS. Exceeding this limit will result in undefined behavior, and an application should not rely on the use of the returned error code in order to identify when the limit is reached.

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)
See Also

CreateSampler

Layout


 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 Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • STYPE

      public static final int STYPE
      The struct member offsets.
    • PNEXT

      public static final int PNEXT
      The struct member offsets.
    • FLAGS

      public static final int FLAGS
      The struct member offsets.
    • MAGFILTER

      public static final int MAGFILTER
      The struct member offsets.
    • MINFILTER

      public static final int MINFILTER
      The struct member offsets.
    • MIPMAPMODE

      public static final int MIPMAPMODE
      The struct member offsets.
    • ADDRESSMODEU

      public static final int ADDRESSMODEU
      The struct member offsets.
    • ADDRESSMODEV

      public static final int ADDRESSMODEV
      The struct member offsets.
    • ADDRESSMODEW

      public static final int ADDRESSMODEW
      The struct member offsets.
    • MIPLODBIAS

      public static final int MIPLODBIAS
      The struct member offsets.
    • ANISOTROPYENABLE

      public static final int ANISOTROPYENABLE
      The struct member offsets.
    • MAXANISOTROPY

      public static final int MAXANISOTROPY
      The struct member offsets.
    • COMPAREENABLE

      public static final int COMPAREENABLE
      The struct member offsets.
    • COMPAREOP

      public static final int COMPAREOP
      The struct member offsets.
    • MINLOD

      public static final int MINLOD
      The struct member offsets.
    • MAXLOD

      public static final int MAXLOD
      The struct member offsets.
    • BORDERCOLOR

      public static final int BORDERCOLOR
      The struct member offsets.
    • UNNORMALIZEDCOORDINATES

      public static final int UNNORMALIZEDCOORDINATES
      The struct member offsets.
  • Constructor Details

    • VkSamplerCreateInfo

      public VkSamplerCreateInfo(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 Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<VkSamplerCreateInfo>
    • sType

      public int sType()
      a VkStructureType value identifying this structure.
    • pNext

      public long pNext()
      NULL or a pointer to a structure extending this structure.
    • flags

      public int flags()
      a bitmask of VkSamplerCreateFlagBits describing additional parameters of the sampler.
    • magFilter

      public int magFilter()
      a VkFilter value specifying the magnification filter to apply to lookups.
    • minFilter

      public int minFilter()
      a VkFilter value specifying the minification filter to apply to lookups.
    • mipmapMode

      public int mipmapMode()
      a VkSamplerMipmapMode value specifying the mipmap filter to apply to lookups.
    • addressModeU

      public int addressModeU()
      a VkSamplerAddressMode value specifying the addressing mode for U coordinates outside [0,1).
    • addressModeV

      public int addressModeV()
      a VkSamplerAddressMode value specifying the addressing mode for V coordinates outside [0,1).
    • addressModeW

      public int addressModeW()
      a VkSamplerAddressMode value specifying the addressing mode for W coordinates outside [0,1).
    • mipLodBias

      public float mipLodBias()
      the bias to be added to mipmap LOD calculation and bias provided by image sampling functions in SPIR-V, as described in the LOD Operation section.
    • anisotropyEnable

      public boolean anisotropyEnable()
      TRUE to enable anisotropic filtering, as described in the Texel Anisotropic Filtering section, or FALSE otherwise.
    • maxAnisotropy

      public float maxAnisotropy()
      the anisotropy value clamp used by the sampler when anisotropyEnable is TRUE. If anisotropyEnable is FALSE, maxAnisotropy is ignored.
    • compareEnable

      public boolean compareEnable()
      TRUE 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

      public int compareOp()
      a VkCompareOp value specifying the comparison operator to apply to fetched data before filtering as described in the Depth Compare Operation section.
    • minLod

      public float minLod()
    • maxLod

      public float maxLod()
      used to clamp the maximum of the computed LOD value. To avoid clamping the maximum value, set maxLod to the constant LOD_CLAMP_NONE.
    • borderColor

      public int borderColor()
      a VkBorderColor value specifying the predefined border color to use.
    • unnormalizedCoordinates

      public boolean unnormalizedCoordinates()
      controls whether to use unnormalized or normalized texel coordinates to address texels of the image. When unnormalizedCoordinates is TRUE, the range of the image coordinates used to lookup the texel is in the range of zero to the image size in each dimension. When unnormalizedCoordinates is FALSE, the range of image coordinates is zero to one.

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

      • The viewType must be either IMAGE_VIEW_TYPE_1D or IMAGE_VIEW_TYPE_2D.
      • The image view must have a single layer and a single mip level. 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.
    • sType

      public VkSamplerCreateInfo sType(int value)
      Sets the specified value to the sType() field.
    • sType$Default

      public VkSamplerCreateInfo sType$Default()
      Sets the STRUCTURE_TYPE_SAMPLER_CREATE_INFO value to the sType() field.
    • pNext

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

      Prepends the specified VkOpaqueCaptureDescriptorDataCreateInfoEXT value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerBlockMatchWindowCreateInfoQCOM value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerBorderColorComponentMappingCreateInfoEXT value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerCubicWeightsCreateInfoQCOM value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerCustomBorderColorCreateInfoEXT value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerReductionModeCreateInfo value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerReductionModeCreateInfoEXT value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerYcbcrConversionInfo value to the pNext chain.
    • pNext

      Prepends the specified VkSamplerYcbcrConversionInfoKHR value to the pNext chain.
    • 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.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static VkSamplerCreateInfo malloc()
      Returns a new VkSamplerCreateInfo instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static VkSamplerCreateInfo calloc()
      Returns a new VkSamplerCreateInfo instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static VkSamplerCreateInfo create()
      Returns a new VkSamplerCreateInfo instance allocated with BufferUtils.
    • create

      public static VkSamplerCreateInfo create(long address)
      Returns a new VkSamplerCreateInfo instance for the specified memory address.
    • createSafe

      public static @Nullable VkSamplerCreateInfo createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static VkSamplerCreateInfo.Buffer malloc(int capacity)
      Returns a new VkSamplerCreateInfo.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static VkSamplerCreateInfo.Buffer calloc(int capacity)
      Returns a new VkSamplerCreateInfo.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VkSamplerCreateInfo.Buffer create(int capacity)
      Returns a new VkSamplerCreateInfo.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static VkSamplerCreateInfo.Buffer create(long address, int capacity)
      Create a VkSamplerCreateInfo.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable VkSamplerCreateInfo.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static VkSamplerCreateInfo mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VkSamplerCreateInfo callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkSamplerCreateInfo mallocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static VkSamplerCreateInfo callocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkSamplerCreateInfo.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VkSamplerCreateInfo.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static VkSamplerCreateInfo.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static VkSamplerCreateInfo.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static VkSamplerCreateInfo malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new VkSamplerCreateInfo instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static VkSamplerCreateInfo calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new VkSamplerCreateInfo instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static VkSamplerCreateInfo.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VkSamplerCreateInfo.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static VkSamplerCreateInfo.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new VkSamplerCreateInfo.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • 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.