org.lwjgl.util.vma.VmaAllocateDeviceMemoryFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-vma Show documentation
Show all versions of lwjgl-vma Show documentation
An easy to integrate Vulkan memory allocation library.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.util.vma;
import javax.annotation.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Instances of this class may be set to the {@link VmaDeviceMemoryCallbacks} struct.
*
* Type
*
*
* void (*) (
* VmaAllocator allocator,
* uint32_t memoryType,
* VkDeviceMemory memory,
* VkDeviceSize size
* )
*/
public abstract class VmaAllocateDeviceMemoryFunction extends Callback implements VmaAllocateDeviceMemoryFunctionI {
/**
* Creates a {@code VmaAllocateDeviceMemoryFunction} instance from the specified function pointer.
*
* @return the new {@code VmaAllocateDeviceMemoryFunction}
*/
public static VmaAllocateDeviceMemoryFunction create(long functionPointer) {
VmaAllocateDeviceMemoryFunctionI instance = Callback.get(functionPointer);
return instance instanceof VmaAllocateDeviceMemoryFunction
? (VmaAllocateDeviceMemoryFunction)instance
: new Container(functionPointer, instance);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
@Nullable
public static VmaAllocateDeviceMemoryFunction createSafe(long functionPointer) {
return functionPointer == NULL ? null : create(functionPointer);
}
/** Creates a {@code VmaAllocateDeviceMemoryFunction} instance that delegates to the specified {@code VmaAllocateDeviceMemoryFunctionI} instance. */
public static VmaAllocateDeviceMemoryFunction create(VmaAllocateDeviceMemoryFunctionI instance) {
return instance instanceof VmaAllocateDeviceMemoryFunction
? (VmaAllocateDeviceMemoryFunction)instance
: new Container(instance.address(), instance);
}
protected VmaAllocateDeviceMemoryFunction() {
super(SIGNATURE);
}
private VmaAllocateDeviceMemoryFunction(long functionPointer) {
super(functionPointer);
}
private static final class Container extends VmaAllocateDeviceMemoryFunction {
private final VmaAllocateDeviceMemoryFunctionI delegate;
Container(long functionPointer, VmaAllocateDeviceMemoryFunctionI delegate) {
super(functionPointer);
this.delegate = delegate;
}
@Override
public void invoke(long allocator, int memoryType, long memory, long size) {
delegate.invoke(allocator, memoryType, memory, size);
}
}
}