Interface VulkanTemporaryAllocatorType
- All Known Implementing Classes:
VulkanLWJGLTemporaryAllocator
public interface VulkanTemporaryAllocatorType
An allocator for temporary, aligned memory. The API is designed such that it should be very
difficult, short of deliberate sabotage, to leak memory or use memory after it has been freed.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA receiver of allocated memory.static interfaceA receiver of allocated memory. -
Method Summary
Modifier and TypeMethodDescription<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
-
withAllocation
<T,E extends Exception> T withAllocation(long size, long alignment, VulkanTemporaryAllocatorType.RawMemoryReceiverType<T, E> receiver) throws VulkanException, EAllocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.- 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
<T,E extends Exception> T withAllocationBuffer(long size, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) throws VulkanException, EAllocatesizeoctets of memory, aligned toalignment, pass it toreceiver, then unconditionally deallocate the memory before returning the value ofTreturned byreceiver.- 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
<T,E extends Exception> T withAllocationBufferInitialized(byte[] data, long alignment, VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T, E> receiver) throws VulkanException, EAllocatedata.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.- 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
-