All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.vulkan.VkAllocationCallbacks Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.3.4
Show newest version
/*
 * 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 containing callback function pointers for memory allocation.
 * 
 * 
Valid Usage
* *
    *
  • {@code pfnAllocation} must be a pointer to a valid user-defined {@link VkAllocationFunction}
  • *
  • {@code pfnReallocation} must be a pointer to a valid user-defined {@link VkReallocationFunction}
  • *
  • {@code pfnFree} must be a pointer to a valid user-defined {@link VkFreeFunction}
  • *
  • If either of {@code pfnInternalAllocation} or {@code pfnInternalFree} is not {@code NULL}, both must be valid callbacks
  • *
* *
See Also
* *

{@link VkAllocationFunction}, {@link VkFreeFunction}, {@link VkInternalAllocationNotification}, {@link VkInternalFreeNotification}, {@link VkReallocationFunction}, {@link VK10#vkAllocateMemory AllocateMemory}, {@link #CreateAndroidSurfaceKHR}, {@link VK10#vkCreateBuffer CreateBuffer}, {@link VK10#vkCreateBufferView CreateBufferView}, {@link VK10#vkCreateCommandPool CreateCommandPool}, {@link VK10#vkCreateComputePipelines CreateComputePipelines}, {@link EXTDebugReport#vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT}, {@link VK10#vkCreateDescriptorPool CreateDescriptorPool}, {@link VK10#vkCreateDescriptorSetLayout CreateDescriptorSetLayout}, {@link VK10#vkCreateDevice CreateDevice}, {@link KHRDisplay#vkCreateDisplayModeKHR CreateDisplayModeKHR}, {@link KHRDisplay#vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR}, {@link VK10#vkCreateEvent CreateEvent}, {@link VK10#vkCreateFence CreateFence}, {@link VK10#vkCreateFramebuffer CreateFramebuffer}, {@link VK10#vkCreateGraphicsPipelines CreateGraphicsPipelines}, {@link VK10#vkCreateImage CreateImage}, {@link VK10#vkCreateImageView CreateImageView}, {@link NVXDeviceGeneratedCommands#vkCreateIndirectCommandsLayoutNVX CreateIndirectCommandsLayoutNVX}, {@link VK10#vkCreateInstance CreateInstance}, {@link #CreateMirSurfaceKHR}, {@link NVXDeviceGeneratedCommands#vkCreateObjectTableNVX CreateObjectTableNVX}, {@link VK10#vkCreatePipelineCache CreatePipelineCache}, {@link VK10#vkCreatePipelineLayout CreatePipelineLayout}, {@link VK10#vkCreateQueryPool CreateQueryPool}, {@link VK10#vkCreateRenderPass CreateRenderPass}, {@link VK10#vkCreateSampler CreateSampler}, {@link VK10#vkCreateSemaphore CreateSemaphore}, {@link VK10#vkCreateShaderModule CreateShaderModule}, {@link KHRDisplaySwapchain#vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR}, {@link KHRSwapchain#vkCreateSwapchainKHR CreateSwapchainKHR}, {@link #CreateWaylandSurfaceKHR}, {@link KHRWin32Surface#vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR}, {@link #CreateXcbSurfaceKHR}, {@link KHRXlibSurface#vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR}, {@link VK10#vkDestroyBuffer DestroyBuffer}, {@link VK10#vkDestroyBufferView DestroyBufferView}, {@link VK10#vkDestroyCommandPool DestroyCommandPool}, {@link EXTDebugReport#vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT}, {@link VK10#vkDestroyDescriptorPool DestroyDescriptorPool}, {@link VK10#vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout}, {@link VK10#vkDestroyDevice DestroyDevice}, {@link VK10#vkDestroyEvent DestroyEvent}, {@link VK10#vkDestroyFence DestroyFence}, {@link VK10#vkDestroyFramebuffer DestroyFramebuffer}, {@link VK10#vkDestroyImage DestroyImage}, {@link VK10#vkDestroyImageView DestroyImageView}, {@link NVXDeviceGeneratedCommands#vkDestroyIndirectCommandsLayoutNVX DestroyIndirectCommandsLayoutNVX}, {@link VK10#vkDestroyInstance DestroyInstance}, {@link NVXDeviceGeneratedCommands#vkDestroyObjectTableNVX DestroyObjectTableNVX}, {@link VK10#vkDestroyPipeline DestroyPipeline}, {@link VK10#vkDestroyPipelineCache DestroyPipelineCache}, {@link VK10#vkDestroyPipelineLayout DestroyPipelineLayout}, {@link VK10#vkDestroyQueryPool DestroyQueryPool}, {@link VK10#vkDestroyRenderPass DestroyRenderPass}, {@link VK10#vkDestroySampler DestroySampler}, {@link VK10#vkDestroySemaphore DestroySemaphore}, {@link VK10#vkDestroyShaderModule DestroyShaderModule}, {@link KHRSurface#vkDestroySurfaceKHR DestroySurfaceKHR}, {@link KHRSwapchain#vkDestroySwapchainKHR DestroySwapchainKHR}, {@link VK10#vkFreeMemory FreeMemory}

* *

Member documentation

* *
    *
  • {@code pUserData} – a value to be interpreted by the implementation of the callbacks. When any of the callbacks in {@link VkAllocationCallbacks} are called, the Vulkan implementation will pass this value as the first parameter to the callback. This value can vary each time an allocator is passed into a command, even when the same object takes an allocator in multiple commands.
  • *
  • {@code pfnAllocation} – a pointer to an application-defined memory allocation function of type {@link VkAllocationFunction}.
  • *
  • {@code pfnReallocation} – a pointer to an application-defined memory reallocation function of type {@link VkReallocationFunction}.
  • *
  • {@code pfnFree} – a pointer to an application-defined memory free function of type {@link VkFreeFunction}.
  • *
  • {@code pfnInternalAllocation} – a pointer to an application-defined function that is called by the implementation when the implementation makes internal allocations, and it is of type {@link VkInternalAllocationNotification}.
  • *
  • {@code pfnInternalFree} – a pointer to an application-defined function that is called by the implementation when the implementation frees internal allocations, and it is of type {@link VkInternalFreeNotification}.
  • *
* *

Layout

* *
struct VkAllocationCallbacks {
    void * pUserData;
    {@link VkAllocationFunctionI PFN_vkAllocationFunction} pfnAllocation;
    {@link VkReallocationFunctionI PFN_vkReallocationFunction} pfnReallocation;
    {@link VkFreeFunctionI PFN_vkFreeFunction} pfnFree;
    {@link VkInternalAllocationNotificationI PFN_vkInternalAllocationNotification} pfnInternalAllocation;
    {@link VkInternalFreeNotificationI PFN_vkInternalFreeNotification} pfnInternalFree;
}
*/ public class VkAllocationCallbacks 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 PUSERDATA, PFNALLOCATION, PFNREALLOCATION, PFNFREE, PFNINTERNALALLOCATION, PFNINTERNALFREE; static { Layout layout = __struct( __member(POINTER_SIZE), __member(POINTER_SIZE), __member(POINTER_SIZE), __member(POINTER_SIZE), __member(POINTER_SIZE), __member(POINTER_SIZE) ); SIZEOF = layout.getSize(); ALIGNOF = layout.getAlignment(); PUSERDATA = layout.offsetof(0); PFNALLOCATION = layout.offsetof(1); PFNREALLOCATION = layout.offsetof(2); PFNFREE = layout.offsetof(3); PFNINTERNALALLOCATION = layout.offsetof(4); PFNINTERNALFREE = layout.offsetof(5); } VkAllocationCallbacks(long address, ByteBuffer container) { super(address, container); } /** * Creates a {@link VkAllocationCallbacks} 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 VkAllocationCallbacks(ByteBuffer container) { this(memAddress(container), checkContainer(container, SIZEOF)); } @Override public int sizeof() { return SIZEOF; } /** Returns the value of the {@code pUserData} field. */ public long pUserData() { return npUserData(address()); } /** Returns the value of the {@code pfnAllocation} field. */ public VkAllocationFunction pfnAllocation() { return npfnAllocation(address()); } /** Returns the value of the {@code pfnReallocation} field. */ public VkReallocationFunction pfnReallocation() { return npfnReallocation(address()); } /** Returns the value of the {@code pfnFree} field. */ public VkFreeFunction pfnFree() { return npfnFree(address()); } /** Returns the value of the {@code pfnInternalAllocation} field. */ public VkInternalAllocationNotification pfnInternalAllocation() { return npfnInternalAllocation(address()); } /** Returns the value of the {@code pfnInternalFree} field. */ public VkInternalFreeNotification pfnInternalFree() { return npfnInternalFree(address()); } /** Sets the specified value to the {@code pUserData} field. */ public VkAllocationCallbacks pUserData(long value) { npUserData(address(), value); return this; } /** Sets the specified value to the {@code pfnAllocation} field. */ public VkAllocationCallbacks pfnAllocation(VkAllocationFunctionI value) { npfnAllocation(address(), value); return this; } /** Sets the specified value to the {@code pfnReallocation} field. */ public VkAllocationCallbacks pfnReallocation(VkReallocationFunctionI value) { npfnReallocation(address(), value); return this; } /** Sets the specified value to the {@code pfnFree} field. */ public VkAllocationCallbacks pfnFree(VkFreeFunctionI value) { npfnFree(address(), value); return this; } /** Sets the specified value to the {@code pfnInternalAllocation} field. */ public VkAllocationCallbacks pfnInternalAllocation(VkInternalAllocationNotificationI value) { npfnInternalAllocation(address(), value); return this; } /** Sets the specified value to the {@code pfnInternalFree} field. */ public VkAllocationCallbacks pfnInternalFree(VkInternalFreeNotificationI value) { npfnInternalFree(address(), value); return this; } /** Initializes this struct with the specified values. */ public VkAllocationCallbacks set( long pUserData, VkAllocationFunctionI pfnAllocation, VkReallocationFunctionI pfnReallocation, VkFreeFunctionI pfnFree, VkInternalAllocationNotificationI pfnInternalAllocation, VkInternalFreeNotificationI pfnInternalFree ) { pUserData(pUserData); pfnAllocation(pfnAllocation); pfnReallocation(pfnReallocation); pfnFree(pfnFree); pfnInternalAllocation(pfnInternalAllocation); pfnInternalFree(pfnInternalFree); return this; } /** Unsafe version of {@link #set(VkAllocationCallbacks) set}. */ public VkAllocationCallbacks nset(long struct) { memCopy(struct, address(), SIZEOF); return this; } /** * Copies the specified struct data to this struct. * * @param src the source struct * * @return this struct */ public VkAllocationCallbacks set(VkAllocationCallbacks src) { return nset(src.address()); } // ----------------------------------- /** Returns a new {@link VkAllocationCallbacks} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ public static VkAllocationCallbacks malloc() { return create(nmemAlloc(SIZEOF)); } /** Returns a new {@link VkAllocationCallbacks} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ public static VkAllocationCallbacks calloc() { return create(nmemCalloc(1, SIZEOF)); } /** Returns a new {@link VkAllocationCallbacks} instance allocated with {@link BufferUtils}. */ public static VkAllocationCallbacks create() { return new VkAllocationCallbacks(BufferUtils.createByteBuffer(SIZEOF)); } /** Returns a new {@link VkAllocationCallbacks} instance for the specified memory address or {@code null} if the address is {@code NULL}. */ public static VkAllocationCallbacks create(long address) { return address == NULL ? null : new VkAllocationCallbacks(address, null); } /** * Returns a new {@link VkAllocationCallbacks.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(nmemAlloc(capacity * SIZEOF), capacity); } /** * Returns a new {@link VkAllocationCallbacks.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 VkAllocationCallbacks.Buffer} instance allocated with {@link BufferUtils}. * * @param capacity the buffer capacity */ public static Buffer create(int capacity) { return new Buffer(BufferUtils.createByteBuffer(capacity * SIZEOF)); } /** * Create a {@link VkAllocationCallbacks.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 VkAllocationCallbacks} instance allocated on the thread-local {@link MemoryStack}. */ public static VkAllocationCallbacks mallocStack() { return mallocStack(stackGet()); } /** Returns a new {@link VkAllocationCallbacks} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */ public static VkAllocationCallbacks callocStack() { return callocStack(stackGet()); } /** * Returns a new {@link VkAllocationCallbacks} instance allocated on the specified {@link MemoryStack}. * * @param stack the stack from which to allocate */ public static VkAllocationCallbacks mallocStack(MemoryStack stack) { return create(stack.nmalloc(ALIGNOF, SIZEOF)); } /** * Returns a new {@link VkAllocationCallbacks} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. * * @param stack the stack from which to allocate */ public static VkAllocationCallbacks callocStack(MemoryStack stack) { return create(stack.ncalloc(ALIGNOF, 1, SIZEOF)); } /** * Returns a new {@link VkAllocationCallbacks.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 VkAllocationCallbacks.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 VkAllocationCallbacks.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 VkAllocationCallbacks.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 #pUserData}. */ public static long npUserData(long struct) { return memGetAddress(struct + VkAllocationCallbacks.PUSERDATA); } /** Unsafe version of {@link #pfnAllocation}. */ public static VkAllocationFunction npfnAllocation(long struct) { return VkAllocationFunction.create(memGetAddress(struct + VkAllocationCallbacks.PFNALLOCATION)); } /** Unsafe version of {@link #pfnReallocation}. */ public static VkReallocationFunction npfnReallocation(long struct) { return VkReallocationFunction.create(memGetAddress(struct + VkAllocationCallbacks.PFNREALLOCATION)); } /** Unsafe version of {@link #pfnFree}. */ public static VkFreeFunction npfnFree(long struct) { return VkFreeFunction.create(memGetAddress(struct + VkAllocationCallbacks.PFNFREE)); } /** Unsafe version of {@link #pfnInternalAllocation}. */ public static VkInternalAllocationNotification npfnInternalAllocation(long struct) { return VkInternalAllocationNotification.create(memGetAddress(struct + VkAllocationCallbacks.PFNINTERNALALLOCATION)); } /** Unsafe version of {@link #pfnInternalFree}. */ public static VkInternalFreeNotification npfnInternalFree(long struct) { return VkInternalFreeNotification.create(memGetAddress(struct + VkAllocationCallbacks.PFNINTERNALFREE)); } /** Unsafe version of {@link #pUserData(long) pUserData}. */ public static void npUserData(long struct, long value) { memPutAddress(struct + VkAllocationCallbacks.PUSERDATA, value); } /** Unsafe version of {@link #pfnAllocation(VkAllocationFunctionI) pfnAllocation}. */ public static void npfnAllocation(long struct, VkAllocationFunctionI value) { memPutAddress(struct + VkAllocationCallbacks.PFNALLOCATION, value.address()); } /** Unsafe version of {@link #pfnReallocation(VkReallocationFunctionI) pfnReallocation}. */ public static void npfnReallocation(long struct, VkReallocationFunctionI value) { memPutAddress(struct + VkAllocationCallbacks.PFNREALLOCATION, value.address()); } /** Unsafe version of {@link #pfnFree(VkFreeFunctionI) pfnFree}. */ public static void npfnFree(long struct, VkFreeFunctionI value) { memPutAddress(struct + VkAllocationCallbacks.PFNFREE, value.address()); } /** Unsafe version of {@link #pfnInternalAllocation(VkInternalAllocationNotificationI) pfnInternalAllocation}. */ public static void npfnInternalAllocation(long struct, VkInternalAllocationNotificationI value) { memPutAddress(struct + VkAllocationCallbacks.PFNINTERNALALLOCATION, addressSafe(value)); } /** Unsafe version of {@link #pfnInternalFree(VkInternalFreeNotificationI) pfnInternalFree}. */ public static void npfnInternalFree(long struct, VkInternalFreeNotificationI value) { memPutAddress(struct + VkAllocationCallbacks.PFNINTERNALFREE, addressSafe(value)); } /** * Validates pointer members that should not be {@code NULL}. * * @param struct the struct to validate */ public static void validate(long struct) { check(memGetAddress(struct + VkAllocationCallbacks.PFNALLOCATION)); check(memGetAddress(struct + VkAllocationCallbacks.PFNREALLOCATION)); check(memGetAddress(struct + VkAllocationCallbacks.PFNFREE)); } /** * 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 VkAllocationCallbacks} structs. */ public static class Buffer extends StructBuffer implements NativeResource { /** * Creates a new {@link VkAllocationCallbacks.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 VkAllocationCallbacks#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 VkAllocationCallbacks newInstance(long address) { return new VkAllocationCallbacks(address, container); } @Override protected int sizeof() { return SIZEOF; } /** Returns the value of the {@code pUserData} field. */ public long pUserData() { return VkAllocationCallbacks.npUserData(address()); } /** Returns the value of the {@code pfnAllocation} field. */ public VkAllocationFunction pfnAllocation() { return VkAllocationCallbacks.npfnAllocation(address()); } /** Returns the value of the {@code pfnReallocation} field. */ public VkReallocationFunction pfnReallocation() { return VkAllocationCallbacks.npfnReallocation(address()); } /** Returns the value of the {@code pfnFree} field. */ public VkFreeFunction pfnFree() { return VkAllocationCallbacks.npfnFree(address()); } /** Returns the value of the {@code pfnInternalAllocation} field. */ public VkInternalAllocationNotification pfnInternalAllocation() { return VkAllocationCallbacks.npfnInternalAllocation(address()); } /** Returns the value of the {@code pfnInternalFree} field. */ public VkInternalFreeNotification pfnInternalFree() { return VkAllocationCallbacks.npfnInternalFree(address()); } /** Sets the specified value to the {@code pUserData} field. */ public VkAllocationCallbacks.Buffer pUserData(long value) { VkAllocationCallbacks.npUserData(address(), value); return this; } /** Sets the specified value to the {@code pfnAllocation} field. */ public VkAllocationCallbacks.Buffer pfnAllocation(VkAllocationFunctionI value) { VkAllocationCallbacks.npfnAllocation(address(), value); return this; } /** Sets the specified value to the {@code pfnReallocation} field. */ public VkAllocationCallbacks.Buffer pfnReallocation(VkReallocationFunctionI value) { VkAllocationCallbacks.npfnReallocation(address(), value); return this; } /** Sets the specified value to the {@code pfnFree} field. */ public VkAllocationCallbacks.Buffer pfnFree(VkFreeFunctionI value) { VkAllocationCallbacks.npfnFree(address(), value); return this; } /** Sets the specified value to the {@code pfnInternalAllocation} field. */ public VkAllocationCallbacks.Buffer pfnInternalAllocation(VkInternalAllocationNotificationI value) { VkAllocationCallbacks.npfnInternalAllocation(address(), value); return this; } /** Sets the specified value to the {@code pfnInternalFree} field. */ public VkAllocationCallbacks.Buffer pfnInternalFree(VkInternalFreeNotificationI value) { VkAllocationCallbacks.npfnInternalFree(address(), value); return this; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy