org.lwjgl.vulkan.VkSamplerCreateInfo Maven / Gradle / Ivy
Show all versions of lwjgl-vulkan Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import javax.annotation.*;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
/**
* Structure specifying parameters of a newly created sampler.
*
* Description
*
* Mapping of OpenGL to Vulkan filter modes
*
* {@code magFilter} values of {@link VK10#VK_FILTER_NEAREST FILTER_NEAREST} and {@link VK10#VK_FILTER_LINEAR FILTER_LINEAR} directly correspond to {@code GL_NEAREST} and {@code GL_LINEAR} magnification filters. {@code minFilter} and {@code mipmapMode} combine to correspond to the similarly named OpenGL minification filter of {@code GL_minFilter_MIPMAP_mipmapMode} (e.g. {@code minFilter} of {@link VK10#VK_FILTER_LINEAR FILTER_LINEAR} and {@code mipmapMode} of {@link VK10#VK_SAMPLER_MIPMAP_MODE_NEAREST SAMPLER_MIPMAP_MODE_NEAREST} correspond to {@code GL_LINEAR_MIPMAP_NEAREST}).
*
* There are no Vulkan filter modes that directly correspond to OpenGL minification filters of {@code GL_LINEAR} or {@code GL_NEAREST}, but they can be emulated using {@link VK10#VK_SAMPLER_MIPMAP_MODE_NEAREST SAMPLER_MIPMAP_MODE_NEAREST}, {@code minLod} = 0, and {@code maxLod} = 0.25, and using {@code minFilter} = {@link VK10#VK_FILTER_LINEAR FILTER_LINEAR} or {@code minFilter} = {@link VK10#VK_FILTER_NEAREST FILTER_NEAREST}, respectively.
*
* Note that using a {@code maxLod} of zero would cause magnification to always be performed, and the {@code 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 {@code minFilter} and {@code magFilter} are equal, then using a {@code 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 {@link VkPhysicalDeviceLimits} structure. If {@code maxSamplerAllocationCount} is exceeded, {@link VK10#vkCreateSampler CreateSampler} will return {@link VK10#VK_ERROR_TOO_MANY_OBJECTS ERROR_TOO_MANY_OBJECTS}.
*
* Since {@code 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 {@code maxSamplerAllocationCount} limit.
*
* Valid Usage
*
*
* - The absolute value of {@code mipLodBias} must be less than or equal to {@link VkPhysicalDeviceLimits}{@code ::maxSamplerLodBias}
* - If the anisotropic sampling feature is not enabled, {@code anisotropyEnable} must be {@link VK10#VK_FALSE FALSE}
* - If {@code anisotropyEnable} is {@link VK10#VK_TRUE TRUE}, {@code maxAnisotropy} must be between {@code 1.0} and {@link VkPhysicalDeviceLimits}{@code ::maxSamplerAnisotropy}, inclusive
* - If sampler Y’CBCR conversion is enabled and {@link KHRSamplerYcbcrConversion#VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR} is not set for the format, {@code minFilter} and {@code magFilter} must be equal to the sampler Y’CBCR conversion’s {@code chromaFilter}
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code minFilter} and {@code magFilter} must be equal
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code mipmapMode} must be {@link VK10#VK_SAMPLER_MIPMAP_MODE_NEAREST SAMPLER_MIPMAP_MODE_NEAREST}
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code minLod} and {@code maxLod} must be zero
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code addressModeU} and {@code addressModeV} must each be either {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE} or {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER}
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code anisotropyEnable} must be {@link VK10#VK_FALSE FALSE}
* - If {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, {@code compareEnable} must be {@link VK10#VK_FALSE FALSE}
* - If any of {@code addressModeU}, {@code addressModeV} or {@code addressModeW} are {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER}, {@code borderColor} must be a valid {@code VkBorderColor} value
* - If sampler Y’CBCR conversion is enabled, {@code addressModeU}, {@code addressModeV}, and {@code addressModeW} must be {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE}, {@code anisotropyEnable} must be {@link VK10#VK_FALSE FALSE}, and {@code unnormalizedCoordinates} must be {@link VK10#VK_FALSE FALSE}
* - The sampler reduction mode must be set to {@link EXTSamplerFilterMinmax#VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT} if sampler Y’CBCR conversion is enabled
* - If the {@link KHRSamplerMirrorClampToEdge VK_KHR_sampler_mirror_clamp_to_edge} extension is not enabled, {@code addressModeU}, {@code addressModeV} and {@code addressModeW} must not be {@link KHRSamplerMirrorClampToEdge#VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE}
* - If {@code compareEnable} is {@link VK10#VK_TRUE TRUE}, {@code compareOp} must be a valid {@code VkCompareOp} value
* - If either {@code magFilter} or {@code minFilter} is {@link IMGFilterCubic#VK_FILTER_CUBIC_IMG FILTER_CUBIC_IMG}, {@code anisotropyEnable} must be {@link VK10#VK_FALSE FALSE}
* - If either {@code magFilter} or {@code minFilter} is {@link IMGFilterCubic#VK_FILTER_CUBIC_IMG FILTER_CUBIC_IMG}, the {@code reductionMode} member of {@link VkSamplerReductionModeCreateInfoEXT} must be {@link EXTSamplerFilterMinmax#VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT}
* - If {@code compareEnable} is {@link VK10#VK_TRUE TRUE}, the {@code reductionMode} member of {@link VkSamplerReductionModeCreateInfoEXT} must be {@link EXTSamplerFilterMinmax#VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT}
*
*
* Valid Usage (Implicit)
*
*
* - {@code sType} must be {@link VK10#VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO STRUCTURE_TYPE_SAMPLER_CREATE_INFO}
* - Each {@code pNext} member of any structure (including this one) in the {@code pNext} chain must be either {@code NULL} or a pointer to a valid instance of {@link VkSamplerReductionModeCreateInfoEXT} or {@link VkSamplerYcbcrConversionInfoKHR}
* - Each {@code sType} member in the {@code pNext} chain must be unique
* - {@code flags} must be 0
* - {@code magFilter} must be a valid {@code VkFilter} value
* - {@code minFilter} must be a valid {@code VkFilter} value
* - {@code mipmapMode} must be a valid {@code VkSamplerMipmapMode} value
* - {@code addressModeU} must be a valid {@code VkSamplerAddressMode} value
* - {@code addressModeV} must be a valid {@code VkSamplerAddressMode} value
* - {@code addressModeW} must be a valid {@code VkSamplerAddressMode} value
*
*
* See Also
*
* {@link VK10#vkCreateSampler CreateSampler}
*
* Member documentation
*
*
* - {@code sType} – the type of this structure.
* - {@code pNext} – {@code NULL} or a pointer to an extension-specific structure.
* - {@code flags} – reserved for future use.
* - {@code magFilter} – a {@code VkFilter} value specifying the magnification filter to apply to lookups.
* - {@code minFilter} – a {@code VkFilter} value specifying the minification filter to apply to lookups.
* - {@code mipmapMode} – a {@code VkSamplerMipmapMode} value specifying the mipmap filter to apply to lookups.
* - {@code addressModeU} – a {@code VkSamplerAddressMode} value specifying the addressing mode for outside [0..1] range for U coordinate.
* - {@code addressModeV} – a {@code VkSamplerAddressMode} value specifying the addressing mode for outside [0..1] range for V coordinate.
* - {@code addressModeW} – a {@code VkSamplerAddressMode} value specifying the addressing mode for outside [0..1] range for W coordinate.
* - {@code 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.
* - {@code anisotropyEnable} – {@link VK10#VK_TRUE TRUE} to enable anisotropic filtering, as described in the Texel Anisotropic Filtering section, or {@link VK10#VK_FALSE FALSE} otherwise.
* - {@code maxAnisotropy} – the anisotropy value clamp used by the sampler when {@code anisotropyEnable} is {@link VK10#VK_TRUE TRUE}. If {@code anisotropyEnable} is {@link VK10#VK_FALSE FALSE}, {@code maxAnisotropy} is ignored.
* - {@code compareEnable} – {@link VK10#VK_TRUE TRUE} to enable comparison against a reference value during lookups, or {@link VK10#VK_FALSE FALSE} otherwise.
*
*
* - Note: Some implementations will default to shader state if this member does not match.
*
* - {@code compareOp} – a {@code VkCompareOp} value specifying the comparison function to apply to fetched data before filtering as described in the Depth Compare Operation section.
* - {@code minLod} – {@code minLod} and {@code maxLod} are the values used to clamp the computed LOD value, as described in the Level-of-Detail Operation section. {@code maxLod} must be greater than or equal to {@code minLod}.
* - {@code maxLod} – see {@code minLod}
* - {@code borderColor} – a {@code VkBorderColor} value specifying the predefined border color to use.
* - {@code unnormalizedCoordinates} – controls whether to use unnormalized or normalized texel coordinates to address texels of the image. When set to {@link VK10#VK_TRUE 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 {@link VK10#VK_FALSE FALSE} the range of image coordinates is zero to one. When {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, samplers have the following requirements:
*
*
* - {@code minFilter} and {@code magFilter} must be equal.
* - {@code mipmapMode} must be {@link VK10#VK_SAMPLER_MIPMAP_MODE_NEAREST SAMPLER_MIPMAP_MODE_NEAREST}.
* - {@code minLod} and {@code maxLod} must be zero.
* - {@code addressModeU} and {@code addressModeV} must each be either {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE} or {@link VK10#VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER}.
* - {@code anisotropyEnable} must be {@link VK10#VK_FALSE FALSE}.
* - {@code compareEnable} must be {@link VK10#VK_FALSE FALSE}.
* - The sampler must not enable sampler Y’CBCR conversion.
*
*
* When {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE TRUE}, images the sampler is used with in the shader have the following requirements:
*
*
* - The {@code viewType} must be either {@link VK10#VK_IMAGE_VIEW_TYPE_1D IMAGE_VIEW_TYPE_1D} or {@link VK10#VK_IMAGE_VIEW_TYPE_2D IMAGE_VIEW_TYPE_2D}.
* - The image view must have a single layer and a single mip level.
*
*
* When {@code unnormalizedCoordinates} is {@link VK10#VK_TRUE 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.
*
*
*
* Layout
*
*
* struct VkSamplerCreateInfo {
* VkStructureType sType;
* const void * 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;
* }
*/
public class VkSamplerCreateInfo extends Struct implements NativeResource {
/** The struct size in bytes. */
public static final int SIZEOF;
public static final int ALIGNOF;
/** The struct member offsets. */
public static final int
STYPE,
PNEXT,
FLAGS,
MAGFILTER,
MINFILTER,
MIPMAPMODE,
ADDRESSMODEU,
ADDRESSMODEV,
ADDRESSMODEW,
MIPLODBIAS,
ANISOTROPYENABLE,
MAXANISOTROPY,
COMPAREENABLE,
COMPAREOP,
MINLOD,
MAXLOD,
BORDERCOLOR,
UNNORMALIZEDCOORDINATES;
static {
Layout layout = __struct(
__member(4),
__member(POINTER_SIZE),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4),
__member(4)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
STYPE = layout.offsetof(0);
PNEXT = layout.offsetof(1);
FLAGS = layout.offsetof(2);
MAGFILTER = layout.offsetof(3);
MINFILTER = layout.offsetof(4);
MIPMAPMODE = layout.offsetof(5);
ADDRESSMODEU = layout.offsetof(6);
ADDRESSMODEV = layout.offsetof(7);
ADDRESSMODEW = layout.offsetof(8);
MIPLODBIAS = layout.offsetof(9);
ANISOTROPYENABLE = layout.offsetof(10);
MAXANISOTROPY = layout.offsetof(11);
COMPAREENABLE = layout.offsetof(12);
COMPAREOP = layout.offsetof(13);
MINLOD = layout.offsetof(14);
MAXLOD = layout.offsetof(15);
BORDERCOLOR = layout.offsetof(16);
UNNORMALIZEDCOORDINATES = layout.offsetof(17);
}
VkSamplerCreateInfo(long address, @Nullable ByteBuffer container) {
super(address, container);
}
/**
* Creates a {@link VkSamplerCreateInfo} instance at the current position of the specified {@link 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.
*/
public VkSamplerCreateInfo(ByteBuffer container) {
this(memAddress(container), __checkContainer(container, SIZEOF));
}
@Override
public int sizeof() { return SIZEOF; }
/** Returns the value of the {@code sType} field. */
@NativeType("VkStructureType")
public int sType() { return nsType(address()); }
/** Returns the value of the {@code pNext} field. */
@NativeType("const void *")
public long pNext() { return npNext(address()); }
/** Returns the value of the {@code flags} field. */
@NativeType("VkSamplerCreateFlags")
public int flags() { return nflags(address()); }
/** Returns the value of the {@code magFilter} field. */
@NativeType("VkFilter")
public int magFilter() { return nmagFilter(address()); }
/** Returns the value of the {@code minFilter} field. */
@NativeType("VkFilter")
public int minFilter() { return nminFilter(address()); }
/** Returns the value of the {@code mipmapMode} field. */
@NativeType("VkSamplerMipmapMode")
public int mipmapMode() { return nmipmapMode(address()); }
/** Returns the value of the {@code addressModeU} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeU() { return naddressModeU(address()); }
/** Returns the value of the {@code addressModeV} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeV() { return naddressModeV(address()); }
/** Returns the value of the {@code addressModeW} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeW() { return naddressModeW(address()); }
/** Returns the value of the {@code mipLodBias} field. */
public float mipLodBias() { return nmipLodBias(address()); }
/** Returns the value of the {@code anisotropyEnable} field. */
@NativeType("VkBool32")
public boolean anisotropyEnable() { return nanisotropyEnable(address()) != 0; }
/** Returns the value of the {@code maxAnisotropy} field. */
public float maxAnisotropy() { return nmaxAnisotropy(address()); }
/** Returns the value of the {@code compareEnable} field. */
@NativeType("VkBool32")
public boolean compareEnable() { return ncompareEnable(address()) != 0; }
/** Returns the value of the {@code compareOp} field. */
@NativeType("VkCompareOp")
public int compareOp() { return ncompareOp(address()); }
/** Returns the value of the {@code minLod} field. */
public float minLod() { return nminLod(address()); }
/** Returns the value of the {@code maxLod} field. */
public float maxLod() { return nmaxLod(address()); }
/** Returns the value of the {@code borderColor} field. */
@NativeType("VkBorderColor")
public int borderColor() { return nborderColor(address()); }
/** Returns the value of the {@code unnormalizedCoordinates} field. */
@NativeType("VkBool32")
public boolean unnormalizedCoordinates() { return nunnormalizedCoordinates(address()) != 0; }
/** Sets the specified value to the {@code sType} field. */
public VkSamplerCreateInfo sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; }
/** Sets the specified value to the {@code pNext} field. */
public VkSamplerCreateInfo pNext(@NativeType("const void *") long value) { npNext(address(), value); return this; }
/** Sets the specified value to the {@code flags} field. */
public VkSamplerCreateInfo flags(@NativeType("VkSamplerCreateFlags") int value) { nflags(address(), value); return this; }
/** Sets the specified value to the {@code magFilter} field. */
public VkSamplerCreateInfo magFilter(@NativeType("VkFilter") int value) { nmagFilter(address(), value); return this; }
/** Sets the specified value to the {@code minFilter} field. */
public VkSamplerCreateInfo minFilter(@NativeType("VkFilter") int value) { nminFilter(address(), value); return this; }
/** Sets the specified value to the {@code mipmapMode} field. */
public VkSamplerCreateInfo mipmapMode(@NativeType("VkSamplerMipmapMode") int value) { nmipmapMode(address(), value); return this; }
/** Sets the specified value to the {@code addressModeU} field. */
public VkSamplerCreateInfo addressModeU(@NativeType("VkSamplerAddressMode") int value) { naddressModeU(address(), value); return this; }
/** Sets the specified value to the {@code addressModeV} field. */
public VkSamplerCreateInfo addressModeV(@NativeType("VkSamplerAddressMode") int value) { naddressModeV(address(), value); return this; }
/** Sets the specified value to the {@code addressModeW} field. */
public VkSamplerCreateInfo addressModeW(@NativeType("VkSamplerAddressMode") int value) { naddressModeW(address(), value); return this; }
/** Sets the specified value to the {@code mipLodBias} field. */
public VkSamplerCreateInfo mipLodBias(float value) { nmipLodBias(address(), value); return this; }
/** Sets the specified value to the {@code anisotropyEnable} field. */
public VkSamplerCreateInfo anisotropyEnable(@NativeType("VkBool32") boolean value) { nanisotropyEnable(address(), value ? 1 : 0); return this; }
/** Sets the specified value to the {@code maxAnisotropy} field. */
public VkSamplerCreateInfo maxAnisotropy(float value) { nmaxAnisotropy(address(), value); return this; }
/** Sets the specified value to the {@code compareEnable} field. */
public VkSamplerCreateInfo compareEnable(@NativeType("VkBool32") boolean value) { ncompareEnable(address(), value ? 1 : 0); return this; }
/** Sets the specified value to the {@code compareOp} field. */
public VkSamplerCreateInfo compareOp(@NativeType("VkCompareOp") int value) { ncompareOp(address(), value); return this; }
/** Sets the specified value to the {@code minLod} field. */
public VkSamplerCreateInfo minLod(float value) { nminLod(address(), value); return this; }
/** Sets the specified value to the {@code maxLod} field. */
public VkSamplerCreateInfo maxLod(float value) { nmaxLod(address(), value); return this; }
/** Sets the specified value to the {@code borderColor} field. */
public VkSamplerCreateInfo borderColor(@NativeType("VkBorderColor") int value) { nborderColor(address(), value); return this; }
/** Sets the specified value to the {@code unnormalizedCoordinates} field. */
public VkSamplerCreateInfo unnormalizedCoordinates(@NativeType("VkBool32") boolean value) { nunnormalizedCoordinates(address(), value ? 1 : 0); return this; }
/** Initializes this struct with the specified values. */
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
) {
sType(sType);
pNext(pNext);
flags(flags);
magFilter(magFilter);
minFilter(minFilter);
mipmapMode(mipmapMode);
addressModeU(addressModeU);
addressModeV(addressModeV);
addressModeW(addressModeW);
mipLodBias(mipLodBias);
anisotropyEnable(anisotropyEnable);
maxAnisotropy(maxAnisotropy);
compareEnable(compareEnable);
compareOp(compareOp);
minLod(minLod);
maxLod(maxLod);
borderColor(borderColor);
unnormalizedCoordinates(unnormalizedCoordinates);
return this;
}
/**
* Copies the specified struct data to this struct.
*
* @param src the source struct
*
* @return this struct
*/
public VkSamplerCreateInfo set(VkSamplerCreateInfo src) {
memCopy(src.address(), address(), SIZEOF);
return this;
}
// -----------------------------------
/** Returns a new {@link VkSamplerCreateInfo} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static VkSamplerCreateInfo malloc() {
return create(nmemAllocChecked(SIZEOF));
}
/** Returns a new {@link VkSamplerCreateInfo} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static VkSamplerCreateInfo calloc() {
return create(nmemCallocChecked(1, SIZEOF));
}
/** Returns a new {@link VkSamplerCreateInfo} instance allocated with {@link BufferUtils}. */
public static VkSamplerCreateInfo create() {
return new VkSamplerCreateInfo(BufferUtils.createByteBuffer(SIZEOF));
}
/** Returns a new {@link VkSamplerCreateInfo} instance for the specified memory address. */
public static VkSamplerCreateInfo create(long address) {
return new VkSamplerCreateInfo(address, null);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkSamplerCreateInfo createSafe(long address) {
return address == NULL ? null : create(address);
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer malloc(int capacity) {
return create(__malloc(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer calloc(int capacity) {
return create(nmemCallocChecked(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer create(int capacity) {
return new Buffer(__create(capacity, SIZEOF));
}
/**
* Create a {@link VkSamplerCreateInfo.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer create(long address, int capacity) {
return new Buffer(address, capacity);
}
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkSamplerCreateInfo.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : create(address, capacity);
}
// -----------------------------------
/** Returns a new {@link VkSamplerCreateInfo} instance allocated on the thread-local {@link MemoryStack}. */
public static VkSamplerCreateInfo mallocStack() {
return mallocStack(stackGet());
}
/** Returns a new {@link VkSamplerCreateInfo} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
public static VkSamplerCreateInfo callocStack() {
return callocStack(stackGet());
}
/**
* Returns a new {@link VkSamplerCreateInfo} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static VkSamplerCreateInfo mallocStack(MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, SIZEOF));
}
/**
* Returns a new {@link VkSamplerCreateInfo} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static VkSamplerCreateInfo callocStack(MemoryStack stack) {
return create(stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated on the thread-local {@link MemoryStack}.
*
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer mallocStack(int capacity) {
return mallocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
*
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer callocStack(int capacity) {
return callocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer mallocStack(int capacity, MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link VkSamplerCreateInfo.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkSamplerCreateInfo.Buffer callocStack(int capacity, MemoryStack stack) {
return create(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// -----------------------------------
/** Unsafe version of {@link #sType}. */
public static int nsType(long struct) { return memGetInt(struct + VkSamplerCreateInfo.STYPE); }
/** Unsafe version of {@link #pNext}. */
public static long npNext(long struct) { return memGetAddress(struct + VkSamplerCreateInfo.PNEXT); }
/** Unsafe version of {@link #flags}. */
public static int nflags(long struct) { return memGetInt(struct + VkSamplerCreateInfo.FLAGS); }
/** Unsafe version of {@link #magFilter}. */
public static int nmagFilter(long struct) { return memGetInt(struct + VkSamplerCreateInfo.MAGFILTER); }
/** Unsafe version of {@link #minFilter}. */
public static int nminFilter(long struct) { return memGetInt(struct + VkSamplerCreateInfo.MINFILTER); }
/** Unsafe version of {@link #mipmapMode}. */
public static int nmipmapMode(long struct) { return memGetInt(struct + VkSamplerCreateInfo.MIPMAPMODE); }
/** Unsafe version of {@link #addressModeU}. */
public static int naddressModeU(long struct) { return memGetInt(struct + VkSamplerCreateInfo.ADDRESSMODEU); }
/** Unsafe version of {@link #addressModeV}. */
public static int naddressModeV(long struct) { return memGetInt(struct + VkSamplerCreateInfo.ADDRESSMODEV); }
/** Unsafe version of {@link #addressModeW}. */
public static int naddressModeW(long struct) { return memGetInt(struct + VkSamplerCreateInfo.ADDRESSMODEW); }
/** Unsafe version of {@link #mipLodBias}. */
public static float nmipLodBias(long struct) { return memGetFloat(struct + VkSamplerCreateInfo.MIPLODBIAS); }
/** Unsafe version of {@link #anisotropyEnable}. */
public static int nanisotropyEnable(long struct) { return memGetInt(struct + VkSamplerCreateInfo.ANISOTROPYENABLE); }
/** Unsafe version of {@link #maxAnisotropy}. */
public static float nmaxAnisotropy(long struct) { return memGetFloat(struct + VkSamplerCreateInfo.MAXANISOTROPY); }
/** Unsafe version of {@link #compareEnable}. */
public static int ncompareEnable(long struct) { return memGetInt(struct + VkSamplerCreateInfo.COMPAREENABLE); }
/** Unsafe version of {@link #compareOp}. */
public static int ncompareOp(long struct) { return memGetInt(struct + VkSamplerCreateInfo.COMPAREOP); }
/** Unsafe version of {@link #minLod}. */
public static float nminLod(long struct) { return memGetFloat(struct + VkSamplerCreateInfo.MINLOD); }
/** Unsafe version of {@link #maxLod}. */
public static float nmaxLod(long struct) { return memGetFloat(struct + VkSamplerCreateInfo.MAXLOD); }
/** Unsafe version of {@link #borderColor}. */
public static int nborderColor(long struct) { return memGetInt(struct + VkSamplerCreateInfo.BORDERCOLOR); }
/** Unsafe version of {@link #unnormalizedCoordinates}. */
public static int nunnormalizedCoordinates(long struct) { return memGetInt(struct + VkSamplerCreateInfo.UNNORMALIZEDCOORDINATES); }
/** Unsafe version of {@link #sType(int) sType}. */
public static void nsType(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.STYPE, value); }
/** Unsafe version of {@link #pNext(long) pNext}. */
public static void npNext(long struct, long value) { memPutAddress(struct + VkSamplerCreateInfo.PNEXT, value); }
/** Unsafe version of {@link #flags(int) flags}. */
public static void nflags(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.FLAGS, value); }
/** Unsafe version of {@link #magFilter(int) magFilter}. */
public static void nmagFilter(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.MAGFILTER, value); }
/** Unsafe version of {@link #minFilter(int) minFilter}. */
public static void nminFilter(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.MINFILTER, value); }
/** Unsafe version of {@link #mipmapMode(int) mipmapMode}. */
public static void nmipmapMode(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.MIPMAPMODE, value); }
/** Unsafe version of {@link #addressModeU(int) addressModeU}. */
public static void naddressModeU(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.ADDRESSMODEU, value); }
/** Unsafe version of {@link #addressModeV(int) addressModeV}. */
public static void naddressModeV(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.ADDRESSMODEV, value); }
/** Unsafe version of {@link #addressModeW(int) addressModeW}. */
public static void naddressModeW(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.ADDRESSMODEW, value); }
/** Unsafe version of {@link #mipLodBias(float) mipLodBias}. */
public static void nmipLodBias(long struct, float value) { memPutFloat(struct + VkSamplerCreateInfo.MIPLODBIAS, value); }
/** Unsafe version of {@link #anisotropyEnable(boolean) anisotropyEnable}. */
public static void nanisotropyEnable(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.ANISOTROPYENABLE, value); }
/** Unsafe version of {@link #maxAnisotropy(float) maxAnisotropy}. */
public static void nmaxAnisotropy(long struct, float value) { memPutFloat(struct + VkSamplerCreateInfo.MAXANISOTROPY, value); }
/** Unsafe version of {@link #compareEnable(boolean) compareEnable}. */
public static void ncompareEnable(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.COMPAREENABLE, value); }
/** Unsafe version of {@link #compareOp(int) compareOp}. */
public static void ncompareOp(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.COMPAREOP, value); }
/** Unsafe version of {@link #minLod(float) minLod}. */
public static void nminLod(long struct, float value) { memPutFloat(struct + VkSamplerCreateInfo.MINLOD, value); }
/** Unsafe version of {@link #maxLod(float) maxLod}. */
public static void nmaxLod(long struct, float value) { memPutFloat(struct + VkSamplerCreateInfo.MAXLOD, value); }
/** Unsafe version of {@link #borderColor(int) borderColor}. */
public static void nborderColor(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.BORDERCOLOR, value); }
/** Unsafe version of {@link #unnormalizedCoordinates(boolean) unnormalizedCoordinates}. */
public static void nunnormalizedCoordinates(long struct, int value) { memPutInt(struct + VkSamplerCreateInfo.UNNORMALIZEDCOORDINATES, value); }
// -----------------------------------
/** An array of {@link VkSamplerCreateInfo} structs. */
public static class Buffer extends StructBuffer implements NativeResource {
/**
* Creates a new {@link VkSamplerCreateInfo.Buffer} instance backed by the specified container.
*
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
* by {@link VkSamplerCreateInfo#SIZEOF}, and its mark will be undefined.
*
* The created buffer instance holds a strong reference to the container object.
*/
public Buffer(ByteBuffer container) {
super(container, container.remaining() / SIZEOF);
}
public Buffer(long address, int cap) {
super(address, null, -1, 0, cap, cap);
}
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
super(address, container, mark, pos, lim, cap);
}
@Override
protected Buffer self() {
return this;
}
@Override
protected Buffer newBufferInstance(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
return new Buffer(address, container, mark, pos, lim, cap);
}
@Override
protected VkSamplerCreateInfo newInstance(long address) {
return new VkSamplerCreateInfo(address, container);
}
@Override
public int sizeof() {
return SIZEOF;
}
/** Returns the value of the {@code sType} field. */
@NativeType("VkStructureType")
public int sType() { return VkSamplerCreateInfo.nsType(address()); }
/** Returns the value of the {@code pNext} field. */
@NativeType("const void *")
public long pNext() { return VkSamplerCreateInfo.npNext(address()); }
/** Returns the value of the {@code flags} field. */
@NativeType("VkSamplerCreateFlags")
public int flags() { return VkSamplerCreateInfo.nflags(address()); }
/** Returns the value of the {@code magFilter} field. */
@NativeType("VkFilter")
public int magFilter() { return VkSamplerCreateInfo.nmagFilter(address()); }
/** Returns the value of the {@code minFilter} field. */
@NativeType("VkFilter")
public int minFilter() { return VkSamplerCreateInfo.nminFilter(address()); }
/** Returns the value of the {@code mipmapMode} field. */
@NativeType("VkSamplerMipmapMode")
public int mipmapMode() { return VkSamplerCreateInfo.nmipmapMode(address()); }
/** Returns the value of the {@code addressModeU} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeU() { return VkSamplerCreateInfo.naddressModeU(address()); }
/** Returns the value of the {@code addressModeV} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeV() { return VkSamplerCreateInfo.naddressModeV(address()); }
/** Returns the value of the {@code addressModeW} field. */
@NativeType("VkSamplerAddressMode")
public int addressModeW() { return VkSamplerCreateInfo.naddressModeW(address()); }
/** Returns the value of the {@code mipLodBias} field. */
public float mipLodBias() { return VkSamplerCreateInfo.nmipLodBias(address()); }
/** Returns the value of the {@code anisotropyEnable} field. */
@NativeType("VkBool32")
public boolean anisotropyEnable() { return VkSamplerCreateInfo.nanisotropyEnable(address()) != 0; }
/** Returns the value of the {@code maxAnisotropy} field. */
public float maxAnisotropy() { return VkSamplerCreateInfo.nmaxAnisotropy(address()); }
/** Returns the value of the {@code compareEnable} field. */
@NativeType("VkBool32")
public boolean compareEnable() { return VkSamplerCreateInfo.ncompareEnable(address()) != 0; }
/** Returns the value of the {@code compareOp} field. */
@NativeType("VkCompareOp")
public int compareOp() { return VkSamplerCreateInfo.ncompareOp(address()); }
/** Returns the value of the {@code minLod} field. */
public float minLod() { return VkSamplerCreateInfo.nminLod(address()); }
/** Returns the value of the {@code maxLod} field. */
public float maxLod() { return VkSamplerCreateInfo.nmaxLod(address()); }
/** Returns the value of the {@code borderColor} field. */
@NativeType("VkBorderColor")
public int borderColor() { return VkSamplerCreateInfo.nborderColor(address()); }
/** Returns the value of the {@code unnormalizedCoordinates} field. */
@NativeType("VkBool32")
public boolean unnormalizedCoordinates() { return VkSamplerCreateInfo.nunnormalizedCoordinates(address()) != 0; }
/** Sets the specified value to the {@code sType} field. */
public VkSamplerCreateInfo.Buffer sType(@NativeType("VkStructureType") int value) { VkSamplerCreateInfo.nsType(address(), value); return this; }
/** Sets the specified value to the {@code pNext} field. */
public VkSamplerCreateInfo.Buffer pNext(@NativeType("const void *") long value) { VkSamplerCreateInfo.npNext(address(), value); return this; }
/** Sets the specified value to the {@code flags} field. */
public VkSamplerCreateInfo.Buffer flags(@NativeType("VkSamplerCreateFlags") int value) { VkSamplerCreateInfo.nflags(address(), value); return this; }
/** Sets the specified value to the {@code magFilter} field. */
public VkSamplerCreateInfo.Buffer magFilter(@NativeType("VkFilter") int value) { VkSamplerCreateInfo.nmagFilter(address(), value); return this; }
/** Sets the specified value to the {@code minFilter} field. */
public VkSamplerCreateInfo.Buffer minFilter(@NativeType("VkFilter") int value) { VkSamplerCreateInfo.nminFilter(address(), value); return this; }
/** Sets the specified value to the {@code mipmapMode} field. */
public VkSamplerCreateInfo.Buffer mipmapMode(@NativeType("VkSamplerMipmapMode") int value) { VkSamplerCreateInfo.nmipmapMode(address(), value); return this; }
/** Sets the specified value to the {@code addressModeU} field. */
public VkSamplerCreateInfo.Buffer addressModeU(@NativeType("VkSamplerAddressMode") int value) { VkSamplerCreateInfo.naddressModeU(address(), value); return this; }
/** Sets the specified value to the {@code addressModeV} field. */
public VkSamplerCreateInfo.Buffer addressModeV(@NativeType("VkSamplerAddressMode") int value) { VkSamplerCreateInfo.naddressModeV(address(), value); return this; }
/** Sets the specified value to the {@code addressModeW} field. */
public VkSamplerCreateInfo.Buffer addressModeW(@NativeType("VkSamplerAddressMode") int value) { VkSamplerCreateInfo.naddressModeW(address(), value); return this; }
/** Sets the specified value to the {@code mipLodBias} field. */
public VkSamplerCreateInfo.Buffer mipLodBias(float value) { VkSamplerCreateInfo.nmipLodBias(address(), value); return this; }
/** Sets the specified value to the {@code anisotropyEnable} field. */
public VkSamplerCreateInfo.Buffer anisotropyEnable(@NativeType("VkBool32") boolean value) { VkSamplerCreateInfo.nanisotropyEnable(address(), value ? 1 : 0); return this; }
/** Sets the specified value to the {@code maxAnisotropy} field. */
public VkSamplerCreateInfo.Buffer maxAnisotropy(float value) { VkSamplerCreateInfo.nmaxAnisotropy(address(), value); return this; }
/** Sets the specified value to the {@code compareEnable} field. */
public VkSamplerCreateInfo.Buffer compareEnable(@NativeType("VkBool32") boolean value) { VkSamplerCreateInfo.ncompareEnable(address(), value ? 1 : 0); return this; }
/** Sets the specified value to the {@code compareOp} field. */
public VkSamplerCreateInfo.Buffer compareOp(@NativeType("VkCompareOp") int value) { VkSamplerCreateInfo.ncompareOp(address(), value); return this; }
/** Sets the specified value to the {@code minLod} field. */
public VkSamplerCreateInfo.Buffer minLod(float value) { VkSamplerCreateInfo.nminLod(address(), value); return this; }
/** Sets the specified value to the {@code maxLod} field. */
public VkSamplerCreateInfo.Buffer maxLod(float value) { VkSamplerCreateInfo.nmaxLod(address(), value); return this; }
/** Sets the specified value to the {@code borderColor} field. */
public VkSamplerCreateInfo.Buffer borderColor(@NativeType("VkBorderColor") int value) { VkSamplerCreateInfo.nborderColor(address(), value); return this; }
/** Sets the specified value to the {@code unnormalizedCoordinates} field. */
public VkSamplerCreateInfo.Buffer unnormalizedCoordinates(@NativeType("VkBool32") boolean value) { VkSamplerCreateInfo.nunnormalizedCoordinates(address(), value ? 1 : 0); return this; }
}
}