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.
    • Method Detail

      • withAllocation

        <T,​E extends java.lang.Exception> T withAllocation​(long size,
                                                                 long alignment,
                                                                 VulkanTemporaryAllocatorType.RawMemoryReceiverType<T,​E> receiver)
                                                          throws VulkanException,
                                                                 E extends java.lang.Exception
        Allocate size octets of memory, aligned to alignment, pass it to receiver, then unconditionally deallocate the memory before returning the value of T returned by receiver.
        Type Parameters:
        T - The type of returned values
        E - The type of raised exceptions
        Parameters:
        size - The size of the memory
        alignment - The alignment of the memory
        receiver - The receiver of the allocated memory
        Returns:
        The value returned by receiver
        Throws:
        VulkanException - If receiver raises VulkanException
        E - If receiver raises E
        E extends java.lang.Exception
      • withAllocationBuffer

        <T,​E extends java.lang.Exception> T withAllocationBuffer​(long size,
                                                                       long alignment,
                                                                       VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,​E> receiver)
                                                                throws VulkanException,
                                                                       E extends java.lang.Exception
        Allocate size octets of memory, aligned to alignment, pass it to receiver, then unconditionally deallocate the memory before returning the value of T returned by receiver.
        Type Parameters:
        T - The type of returned values
        E - The type of raised exceptions
        Parameters:
        size - The size of the memory
        alignment - The alignment of the memory
        receiver - The receiver of the allocated memory
        Returns:
        The value returned by receiver
        Throws:
        VulkanException - If receiver raises VulkanException
        E - If receiver raises E
        E extends java.lang.Exception
      • withAllocationBufferInitialized

        <T,​E extends java.lang.Exception> T withAllocationBufferInitialized​(byte[] data,
                                                                                  long alignment,
                                                                                  VulkanTemporaryAllocatorType.ByteBufferMemoryReceiverType<T,​E> receiver)
                                                                           throws VulkanException,
                                                                                  E extends java.lang.Exception
        Allocate data.length octets of memory, aligned to alignment, initialize it with the contents of data, pass it to receiver, then unconditionally deallocate the memory before returning the value of T returned by receiver.
        Type Parameters:
        T - The type of returned values
        E - The type of raised exceptions
        Parameters:
        data - The initial contents of the memory
        alignment - The alignment of the memory
        receiver - The receiver of the allocated memory
        Returns:
        The value returned by receiver
        Throws:
        VulkanException - If receiver raises VulkanException
        E - If receiver raises E
        E extends java.lang.Exception