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

org.lwjgl.vulkan.VkReallocationFunction 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 javax.annotation.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.MemoryUtil.*;

/**
 * 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 {@code PFN_vkAllocationFunction}.

* *
See Also
* *

{@link VkAllocationCallbacks}

*/ public abstract class VkReallocationFunction extends Callback implements VkReallocationFunctionI { /** * Creates a {@code VkReallocationFunction} instance from the specified function pointer. * * @return the new {@code VkReallocationFunction} */ public static VkReallocationFunction create(long functionPointer) { VkReallocationFunctionI instance = Callback.get(functionPointer); return instance instanceof VkReallocationFunction ? (VkReallocationFunction)instance : new Container(functionPointer, instance); } /** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */ @Nullable public static VkReallocationFunction createSafe(long functionPointer) { return functionPointer == NULL ? null : create(functionPointer); } /** Creates a {@code VkReallocationFunction} instance that delegates to the specified {@code VkReallocationFunctionI} instance. */ public static VkReallocationFunction create(VkReallocationFunctionI instance) { return instance instanceof VkReallocationFunction ? (VkReallocationFunction)instance : new Container(instance.address(), instance); } protected VkReallocationFunction() { super(CIF); } VkReallocationFunction(long functionPointer) { super(functionPointer); } private static final class Container extends VkReallocationFunction { private final VkReallocationFunctionI delegate; Container(long functionPointer, VkReallocationFunctionI delegate) { super(functionPointer); this.delegate = delegate; } @Override public long invoke(long pUserData, long pOriginal, long size, long alignment, int allocationScope) { return delegate.invoke(pUserData, pOriginal, size, alignment, allocationScope); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy