org.lwjgl.vulkan.VkPresentInfoKHR Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-vulkan Show documentation
Show all versions of lwjgl-vulkan Show documentation
A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
/**
* Structure describing parameters of a queue presentation.
*
* Valid Usage
*
*
* - Any given element of {@code pImageIndices} must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the {@code pSwapchains} array, and the presented image subresource must be in the {@link KHRSwapchain#VK_IMAGE_LAYOUT_PRESENT_SRC_KHR IMAGE_LAYOUT_PRESENT_SRC_KHR} or {@link KHRSharedPresentableImage#VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR IMAGE_LAYOUT_SHARED_PRESENT_KHR} layout at the time the operation is executed on a {@code VkDevice}
*
*
* Valid Usage (Implicit)
*
*
* - {@code sType} must be {@link KHRSwapchain#VK_STRUCTURE_TYPE_PRESENT_INFO_KHR STRUCTURE_TYPE_PRESENT_INFO_KHR}
* - 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 VkDeviceGroupPresentInfoKHX}, {@link VkDisplayPresentInfoKHR}, {@link VkPresentRegionsKHR}, or {@link VkPresentTimesInfoGOOGLE}
* - Each {@code sType} member in the {@code pNext} chain must be unique
* - If {@code waitSemaphoreCount} is not 0, {@code pWaitSemaphores} must be a pointer to an array of {@code waitSemaphoreCount} valid {@code VkSemaphore} handles
* - {@code pSwapchains} must be a pointer to an array of {@code swapchainCount} valid {@code VkSwapchainKHR} handles
* - {@code pImageIndices} must be a pointer to an array of {@code swapchainCount} {@code uint32_t} values
* - If {@code pResults} is not {@code NULL}, {@code pResults} must be a pointer to an array of {@code swapchainCount} {@code VkResult} values
* - {@code swapchainCount} must be greater than 0
* - Both of the elements of {@code pSwapchains}, and the elements of {@code pWaitSemaphores} that are valid handles must have been created, allocated, or retrieved from the same {@code VkInstance}
*
*
* See Also
*
* {@link KHRSwapchain#vkQueuePresentKHR QueuePresentKHR}
*
* Member documentation
*
*
* - {@code sType} – the type of this structure.
* - {@code pNext} – {@code NULL} or a pointer to an extension-specific structure.
* - {@code waitSemaphoreCount} – the number of semaphores to wait for before issuing the present request. The number may be zero.
* - {@code pWaitSemaphores} – if not {@code NULL}, is an array of {@code VkSemaphore} objects with {@code waitSemaphoreCount} entries, and specifies the semaphores to wait for before issuing the present request.
* - {@code swapchainCount} – the number of swapchains being presented to by this command.
* - {@code pSwapchains} – an array of {@code VkSwapchainKHR} objects with {@code swapchainCount} entries. A given swapchain must not appear in this list more than once.
* - {@code pImageIndices} – an array of indices into the array of each swapchain’s presentable images, with {@code swapchainCount} entries. Each entry in this array identifies the image to present on the corresponding entry in the {@code pSwapchains} array.
* - {@code pResults} – an array of {@code VkResult} typed elements with {@code swapchainCount} entries. Applications that do not need per-swapchain results can use {@code NULL} for {@code pResults}. If non-{@code NULL}, each entry in {@code pResults} will be set to the {@code VkResult} for presenting the swapchain corresponding to the same index in {@code pSwapchains}.
*
*
* Layout
*
*
* struct VkPresentInfoKHR {
* VkStructureType sType;
* const void * pNext;
* uint32_t waitSemaphoreCount;
* const VkSemaphore * pWaitSemaphores;
* uint32_t swapchainCount;
* const VkSwapchainKHR * pSwapchains;
* const uint32_t * pImageIndices;
* VkResult * pResults;
* }
*/
public class VkPresentInfoKHR 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,
WAITSEMAPHORECOUNT,
PWAITSEMAPHORES,
SWAPCHAINCOUNT,
PSWAPCHAINS,
PIMAGEINDICES,
PRESULTS;
static {
Layout layout = __struct(
__member(4),
__member(POINTER_SIZE),
__member(4),
__member(POINTER_SIZE),
__member(4),
__member(POINTER_SIZE),
__member(POINTER_SIZE),
__member(POINTER_SIZE)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
STYPE = layout.offsetof(0);
PNEXT = layout.offsetof(1);
WAITSEMAPHORECOUNT = layout.offsetof(2);
PWAITSEMAPHORES = layout.offsetof(3);
SWAPCHAINCOUNT = layout.offsetof(4);
PSWAPCHAINS = layout.offsetof(5);
PIMAGEINDICES = layout.offsetof(6);
PRESULTS = layout.offsetof(7);
}
VkPresentInfoKHR(long address, ByteBuffer container) {
super(address, container);
}
/**
* Creates a {@link VkPresentInfoKHR} 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 VkPresentInfoKHR(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 waitSemaphoreCount} field. */
@NativeType("uint32_t")
public int waitSemaphoreCount() { return nwaitSemaphoreCount(address()); }
/** Returns a {@link LongBuffer} view of the data pointed to by the {@code pWaitSemaphores} field. */
@NativeType("const VkSemaphore *")
public LongBuffer pWaitSemaphores() { return npWaitSemaphores(address()); }
/** Returns the value of the {@code swapchainCount} field. */
@NativeType("uint32_t")
public int swapchainCount() { return nswapchainCount(address()); }
/** Returns a {@link LongBuffer} view of the data pointed to by the {@code pSwapchains} field. */
@NativeType("const VkSwapchainKHR *")
public LongBuffer pSwapchains() { return npSwapchains(address()); }
/** Returns a {@link IntBuffer} view of the data pointed to by the {@code pImageIndices} field. */
@NativeType("const uint32_t *")
public IntBuffer pImageIndices() { return npImageIndices(address()); }
/** Returns a {@link IntBuffer} view of the data pointed to by the {@code pResults} field. */
@NativeType("VkResult *")
public IntBuffer pResults() { return npResults(address()); }
/** Sets the specified value to the {@code sType} field. */
public VkPresentInfoKHR sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; }
/** Sets the specified value to the {@code pNext} field. */
public VkPresentInfoKHR pNext(@NativeType("const void *") long value) { npNext(address(), value); return this; }
/** Sets the address of the specified {@link LongBuffer} to the {@code pWaitSemaphores} field. */
public VkPresentInfoKHR pWaitSemaphores(@NativeType("const VkSemaphore *") LongBuffer value) { npWaitSemaphores(address(), value); return this; }
/** Sets the specified value to the {@code swapchainCount} field. */
public VkPresentInfoKHR swapchainCount(@NativeType("uint32_t") int value) { nswapchainCount(address(), value); return this; }
/** Sets the address of the specified {@link LongBuffer} to the {@code pSwapchains} field. */
public VkPresentInfoKHR pSwapchains(@NativeType("const VkSwapchainKHR *") LongBuffer value) { npSwapchains(address(), value); return this; }
/** Sets the address of the specified {@link IntBuffer} to the {@code pImageIndices} field. */
public VkPresentInfoKHR pImageIndices(@NativeType("const uint32_t *") IntBuffer value) { npImageIndices(address(), value); return this; }
/** Sets the address of the specified {@link IntBuffer} to the {@code pResults} field. */
public VkPresentInfoKHR pResults(@NativeType("VkResult *") IntBuffer value) { npResults(address(), value); return this; }
/** Initializes this struct with the specified values. */
public VkPresentInfoKHR set(
int sType,
long pNext,
LongBuffer pWaitSemaphores,
int swapchainCount,
LongBuffer pSwapchains,
IntBuffer pImageIndices,
IntBuffer pResults
) {
sType(sType);
pNext(pNext);
pWaitSemaphores(pWaitSemaphores);
swapchainCount(swapchainCount);
pSwapchains(pSwapchains);
pImageIndices(pImageIndices);
pResults(pResults);
return this;
}
/**
* Copies the specified struct data to this struct.
*
* @param src the source struct
*
* @return this struct
*/
public VkPresentInfoKHR set(VkPresentInfoKHR src) {
memCopy(src.address(), address(), SIZEOF);
return this;
}
// -----------------------------------
/** Returns a new {@link VkPresentInfoKHR} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static VkPresentInfoKHR malloc() {
return create(nmemAlloc(SIZEOF));
}
/** Returns a new {@link VkPresentInfoKHR} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static VkPresentInfoKHR calloc() {
return create(nmemCalloc(1, SIZEOF));
}
/** Returns a new {@link VkPresentInfoKHR} instance allocated with {@link BufferUtils}. */
public static VkPresentInfoKHR create() {
return new VkPresentInfoKHR(BufferUtils.createByteBuffer(SIZEOF));
}
/** Returns a new {@link VkPresentInfoKHR} instance for the specified memory address or {@code null} if the address is {@code NULL}. */
public static VkPresentInfoKHR create(long address) {
return address == NULL ? null : new VkPresentInfoKHR(address, null);
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static Buffer malloc(int capacity) {
return create(__malloc(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static Buffer calloc(int capacity) {
return create(nmemCalloc(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static Buffer create(int capacity) {
return new Buffer(__create(capacity, SIZEOF));
}
/**
* Create a {@link VkPresentInfoKHR.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static Buffer create(long address, int capacity) {
return address == NULL ? null : new Buffer(address, null, -1, 0, capacity, capacity);
}
// -----------------------------------
/** Returns a new {@link VkPresentInfoKHR} instance allocated on the thread-local {@link MemoryStack}. */
public static VkPresentInfoKHR mallocStack() {
return mallocStack(stackGet());
}
/** Returns a new {@link VkPresentInfoKHR} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
public static VkPresentInfoKHR callocStack() {
return callocStack(stackGet());
}
/**
* Returns a new {@link VkPresentInfoKHR} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static VkPresentInfoKHR mallocStack(MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, SIZEOF));
}
/**
* Returns a new {@link VkPresentInfoKHR} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static VkPresentInfoKHR callocStack(MemoryStack stack) {
return create(stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated on the thread-local {@link MemoryStack}.
*
* @param capacity the buffer capacity
*/
public static Buffer mallocStack(int capacity) {
return mallocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
*
* @param capacity the buffer capacity
*/
public static Buffer callocStack(int capacity) {
return callocStack(capacity, stackGet());
}
/**
* Returns a new {@link VkPresentInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static Buffer mallocStack(int capacity, MemoryStack stack) {
return create(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link VkPresentInfoKHR.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 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 + VkPresentInfoKHR.STYPE); }
/** Unsafe version of {@link #pNext}. */
public static long npNext(long struct) { return memGetAddress(struct + VkPresentInfoKHR.PNEXT); }
/** Unsafe version of {@link #waitSemaphoreCount}. */
public static int nwaitSemaphoreCount(long struct) { return memGetInt(struct + VkPresentInfoKHR.WAITSEMAPHORECOUNT); }
/** Unsafe version of {@link #pWaitSemaphores() pWaitSemaphores}. */
public static LongBuffer npWaitSemaphores(long struct) { return memLongBuffer(memGetAddress(struct + VkPresentInfoKHR.PWAITSEMAPHORES), nwaitSemaphoreCount(struct)); }
/** Unsafe version of {@link #swapchainCount}. */
public static int nswapchainCount(long struct) { return memGetInt(struct + VkPresentInfoKHR.SWAPCHAINCOUNT); }
/** Unsafe version of {@link #pSwapchains() pSwapchains}. */
public static LongBuffer npSwapchains(long struct) { return memLongBuffer(memGetAddress(struct + VkPresentInfoKHR.PSWAPCHAINS), nswapchainCount(struct)); }
/** Unsafe version of {@link #pImageIndices() pImageIndices}. */
public static IntBuffer npImageIndices(long struct) { return memIntBuffer(memGetAddress(struct + VkPresentInfoKHR.PIMAGEINDICES), nswapchainCount(struct)); }
/** Unsafe version of {@link #pResults() pResults}. */
public static IntBuffer npResults(long struct) { return memIntBuffer(memGetAddress(struct + VkPresentInfoKHR.PRESULTS), nswapchainCount(struct)); }
/** Unsafe version of {@link #sType(int) sType}. */
public static void nsType(long struct, int value) { memPutInt(struct + VkPresentInfoKHR.STYPE, value); }
/** Unsafe version of {@link #pNext(long) pNext}. */
public static void npNext(long struct, long value) { memPutAddress(struct + VkPresentInfoKHR.PNEXT, value); }
/** Sets the specified value to the {@code waitSemaphoreCount} field of the specified {@code struct}. */
public static void nwaitSemaphoreCount(long struct, int value) { memPutInt(struct + VkPresentInfoKHR.WAITSEMAPHORECOUNT, value); }
/** Unsafe version of {@link #pWaitSemaphores(LongBuffer) pWaitSemaphores}. */
public static void npWaitSemaphores(long struct, LongBuffer value) { memPutAddress(struct + VkPresentInfoKHR.PWAITSEMAPHORES, memAddressSafe(value)); nwaitSemaphoreCount(struct, value == null ? 0 : value.remaining()); }
/** Sets the specified value to the {@code swapchainCount} field of the specified {@code struct}. */
public static void nswapchainCount(long struct, int value) { memPutInt(struct + VkPresentInfoKHR.SWAPCHAINCOUNT, value); }
/** Unsafe version of {@link #pSwapchains(LongBuffer) pSwapchains}. */
public static void npSwapchains(long struct, LongBuffer value) { memPutAddress(struct + VkPresentInfoKHR.PSWAPCHAINS, memAddress(value)); }
/** Unsafe version of {@link #pImageIndices(IntBuffer) pImageIndices}. */
public static void npImageIndices(long struct, IntBuffer value) { memPutAddress(struct + VkPresentInfoKHR.PIMAGEINDICES, memAddress(value)); }
/** Unsafe version of {@link #pResults(IntBuffer) pResults}. */
public static void npResults(long struct, IntBuffer value) { memPutAddress(struct + VkPresentInfoKHR.PRESULTS, memAddressSafe(value)); }
/**
* Validates pointer members that should not be {@code NULL}.
*
* @param struct the struct to validate
*/
public static void validate(long struct) {
if (nwaitSemaphoreCount(struct) != 0) {
check(memGetAddress(struct + VkPresentInfoKHR.PWAITSEMAPHORES));
}
check(memGetAddress(struct + VkPresentInfoKHR.PSWAPCHAINS));
check(memGetAddress(struct + VkPresentInfoKHR.PIMAGEINDICES));
}
/**
* Calls {@link #validate(long)} for each struct contained in the specified struct array.
*
* @param array the struct array to validate
* @param count the number of structs in {@code array}
*/
public static void validate(long array, int count) {
for (int i = 0; i < count; i++) {
validate(array + i * SIZEOF);
}
}
// -----------------------------------
/** An array of {@link VkPresentInfoKHR} structs. */
public static class Buffer extends StructBuffer implements NativeResource {
/**
* Creates a new {@link VkPresentInfoKHR.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 VkPresentInfoKHR#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);
}
Buffer(long address, 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, ByteBuffer container, int mark, int pos, int lim, int cap) {
return new Buffer(address, container, mark, pos, lim, cap);
}
@Override
protected VkPresentInfoKHR newInstance(long address) {
return new VkPresentInfoKHR(address, container);
}
@Override
public int sizeof() {
return SIZEOF;
}
/** Returns the value of the {@code sType} field. */
@NativeType("VkStructureType")
public int sType() { return VkPresentInfoKHR.nsType(address()); }
/** Returns the value of the {@code pNext} field. */
@NativeType("const void *")
public long pNext() { return VkPresentInfoKHR.npNext(address()); }
/** Returns the value of the {@code waitSemaphoreCount} field. */
@NativeType("uint32_t")
public int waitSemaphoreCount() { return VkPresentInfoKHR.nwaitSemaphoreCount(address()); }
/** Returns a {@link LongBuffer} view of the data pointed to by the {@code pWaitSemaphores} field. */
@NativeType("const VkSemaphore *")
public LongBuffer pWaitSemaphores() { return VkPresentInfoKHR.npWaitSemaphores(address()); }
/** Returns the value of the {@code swapchainCount} field. */
@NativeType("uint32_t")
public int swapchainCount() { return VkPresentInfoKHR.nswapchainCount(address()); }
/** Returns a {@link LongBuffer} view of the data pointed to by the {@code pSwapchains} field. */
@NativeType("const VkSwapchainKHR *")
public LongBuffer pSwapchains() { return VkPresentInfoKHR.npSwapchains(address()); }
/** Returns a {@link IntBuffer} view of the data pointed to by the {@code pImageIndices} field. */
@NativeType("const uint32_t *")
public IntBuffer pImageIndices() { return VkPresentInfoKHR.npImageIndices(address()); }
/** Returns a {@link IntBuffer} view of the data pointed to by the {@code pResults} field. */
@NativeType("VkResult *")
public IntBuffer pResults() { return VkPresentInfoKHR.npResults(address()); }
/** Sets the specified value to the {@code sType} field. */
public VkPresentInfoKHR.Buffer sType(@NativeType("VkStructureType") int value) { VkPresentInfoKHR.nsType(address(), value); return this; }
/** Sets the specified value to the {@code pNext} field. */
public VkPresentInfoKHR.Buffer pNext(@NativeType("const void *") long value) { VkPresentInfoKHR.npNext(address(), value); return this; }
/** Sets the address of the specified {@link LongBuffer} to the {@code pWaitSemaphores} field. */
public VkPresentInfoKHR.Buffer pWaitSemaphores(@NativeType("const VkSemaphore *") LongBuffer value) { VkPresentInfoKHR.npWaitSemaphores(address(), value); return this; }
/** Sets the specified value to the {@code swapchainCount} field. */
public VkPresentInfoKHR.Buffer swapchainCount(@NativeType("uint32_t") int value) { VkPresentInfoKHR.nswapchainCount(address(), value); return this; }
/** Sets the address of the specified {@link LongBuffer} to the {@code pSwapchains} field. */
public VkPresentInfoKHR.Buffer pSwapchains(@NativeType("const VkSwapchainKHR *") LongBuffer value) { VkPresentInfoKHR.npSwapchains(address(), value); return this; }
/** Sets the address of the specified {@link IntBuffer} to the {@code pImageIndices} field. */
public VkPresentInfoKHR.Buffer pImageIndices(@NativeType("const uint32_t *") IntBuffer value) { VkPresentInfoKHR.npImageIndices(address(), value); return this; }
/** Sets the address of the specified {@link IntBuffer} to the {@code pResults} field. */
public VkPresentInfoKHR.Buffer pResults(@NativeType("VkResult *") IntBuffer value) { VkPresentInfoKHR.npResults(address(), value); return this; }
}
}