org.lwjgl.vulkan.VkFreeFunction 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 org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Application-defined memory free function.
*
* C Specification
*
* The type of {@code pfnFree} is:
*
*
* typedef void (VKAPI_PTR *PFN_vkFreeFunction)(
* void* pUserData,
* void* pMemory);
*
* Description
*
* {@code pMemory} may be {@code NULL}, which the callback must handle safely. If {@code pMemory} is non-{@code NULL}, it must be a pointer previously allocated by {@code pfnAllocation} or {@code pfnReallocation}. The application should free this memory.
*
* See Also
*
* {@link VkAllocationCallbacks}
*/
public abstract class VkFreeFunction extends Callback implements VkFreeFunctionI {
/** Creates a {@code VkFreeFunction} instance from the specified function pointer. */
public static VkFreeFunction create(long functionPointer) {
if (functionPointer == NULL) {
return null;
}
VkFreeFunctionI instance = Callback.get(functionPointer);
return instance instanceof VkFreeFunction
? (VkFreeFunction)instance
: new Container(functionPointer, instance);
}
/** Creates a {@code VkFreeFunction} instance that delegates to the specified {@code VkFreeFunctionI} instance. */
public static VkFreeFunction create(VkFreeFunctionI instance) {
return instance instanceof VkFreeFunction
? (VkFreeFunction)instance
: new Container(instance.address(), instance);
}
protected VkFreeFunction() {
super(SIGNATURE);
}
private VkFreeFunction(long functionPointer) {
super(functionPointer);
}
private static final class Container extends VkFreeFunction {
private final VkFreeFunctionI delegate;
Container(long functionPointer, VkFreeFunctionI delegate) {
super(functionPointer);
this.delegate = delegate;
}
@Override
public void invoke(long pUserData, long pMemory) {
delegate.invoke(pUserData, pMemory);
}
}
}