org.lwjgl.vulkan.VkReallocationFunctionI 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 org.lwjgl.system.*;
import static org.lwjgl.system.dyncall.DynCallback.*;
/**
* Application-defined memory reallocation function.
*
* C Specification
*
* The type of {@code pfnReallocation} is:
*
* typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)(
void* pUserData,
void* pOriginal,
size_t size,
size_t alignment,
VkSystemAllocationScope allocationScope);
*
* Description
*
* {@code pfnReallocation} must return an allocation with enough space for {@code size} bytes, and the contents of the original allocation from bytes zero to min(original size, new size) - 1
must be preserved in the returned allocation. If {@code size} is larger than the old size, the contents of the additional space are undefined. If satisfying these requirements involves creating a new allocation, then the old allocation should be freed.
*
* If {@code pOriginal} is {@code NULL}, then {@code pfnReallocation} must behave equivalently to a call to {@link VkAllocationFunction} with the same parameter values (without {@code pOriginal}).
*
* If {@code size} is zero, then {@code pfnReallocation} must behave equivalently to a call to {@link VkFreeFunction} with the same {@code pUserData} parameter value, and {@code pMemory} equal to {@code pOriginal}.
*
* If {@code pOriginal} is non-{@code NULL}, the implementation must ensure that {@code alignment} is equal to the {@code alignment} used to originally allocate {@code pOriginal}.
*
* If this function fails and {@code pOriginal} is non-{@code NULL} the application must not free the old allocation.
*
* {@code pfnReallocation} must follow the same rules for return values as tname:PFN_vkAllocationFunction.
*
* See Also
*
* {@link VkAllocationCallbacks}
*/
@FunctionalInterface
public interface VkReallocationFunctionI extends CallbackI.P {
String SIGNATURE = Callback.__stdcall("(ppppi)p");
@Override
default String getSignature() { return SIGNATURE; }
@Override
default long callback(long args) {
return invoke(
dcbArgPointer(args),
dcbArgPointer(args),
dcbArgPointer(args),
dcbArgPointer(args),
dcbArgInt(args)
);
}
/**
* Application-defined memory reallocation function.
*
* @param pUserData the value specified for {@link VkAllocationCallbacks}{@code ::pUserData} in the allocator specified by the application.
* @param pOriginal must be either {@code NULL} or a pointer previously returned by {@code pfnReallocation} or {@code pfnAllocation} of the same allocator.
* @param size the size in bytes of the requested allocation.
* @param alignment the requested alignment of the allocation in bytes and must be a power of two.
* @param allocationScope a {@code VkSystemAllocationScope} value specifying the allocation scope of the lifetime of the allocation, as described here.
*/
long invoke(long pUserData, long pOriginal, long size, long alignment, int allocationScope);
}