Class VulkanLWJGLTemporaryAllocator
java.lang.Object
com.io7m.jcoronado.lwjgl.VulkanLWJGLTemporaryAllocator
- All Implemented Interfaces:
VulkanTemporaryAllocatorType
public final class VulkanLWJGLTemporaryAllocator
extends Object
implements VulkanTemporaryAllocatorType
An LWJGL based implementation of the
VulkanTemporaryAllocatorType
interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface VulkanTemporaryAllocatorType
VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,E>, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T, E> -
Method Summary
Modifier and TypeMethodDescriptionstatic VulkanTemporaryAllocatorTypecreate()<T, E extends Exception>
TwithAllocation(long size, long alignment, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T, E> receiver) Allocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.<T, E extends Exception>
TwithAllocationBuffer(long size, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) Allocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.<T, E extends Exception>
TwithAllocationBufferInitialized(byte[] data, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) Allocatedata.lengthoctets of memory, aligned toalignment, initialize it with the contents ofdata, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.
-
Method Details
-
create
- Returns:
- A new temporary allocator
-
withAllocation
public <T, E extends Exception> T withAllocation(long size, long alignment, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T, E> receiver) throws VulkanException, EDescription copied from interface:VulkanTemporaryAllocatorTypeAllocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.- Specified by:
withAllocationin interfaceVulkanTemporaryAllocatorType- Type Parameters:
T- The type of returned valuesE- The type of raised exceptions- Parameters:
size- The size of the memoryalignment- The alignment of the memoryreceiver- The receiver of the allocated memory- Returns:
- The value returned by
receiver - Throws:
VulkanException- IfreceiverraisesVulkanExceptionE- IfreceiverraisesE
-
withAllocationBuffer
public <T, E extends Exception> T withAllocationBuffer(long size, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) throws VulkanException, EDescription copied from interface:VulkanTemporaryAllocatorTypeAllocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.- Specified by:
withAllocationBufferin interfaceVulkanTemporaryAllocatorType- Type Parameters:
T- The type of returned valuesE- The type of raised exceptions- Parameters:
size- The size of the memoryalignment- The alignment of the memoryreceiver- The receiver of the allocated memory- Returns:
- The value returned by
receiver - Throws:
VulkanException- IfreceiverraisesVulkanExceptionE- IfreceiverraisesE
-
withAllocationBufferInitialized
public <T, E extends Exception> T withAllocationBufferInitialized(byte[] data, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) throws VulkanException, EDescription copied from interface:VulkanTemporaryAllocatorTypeAllocatedata.lengthoctets of memory, aligned toalignment, initialize it with the contents ofdata, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.- Specified by:
withAllocationBufferInitializedin interfaceVulkanTemporaryAllocatorType- Type Parameters:
T- The type of returned valuesE- The type of raised exceptions- Parameters:
data- The initial contents of the memoryalignment- The alignment of the memoryreceiver- The receiver of the allocated memory- Returns:
- The value returned by
receiver - Throws:
VulkanException- IfreceiverraisesVulkanExceptionE- IfreceiverraisesE
-