Class VmaDefragmentationInfo2

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class VmaDefragmentationInfo2
    extends Struct
    implements NativeResource
    Parameters for defragmentation.

    To be used with function DefragmentationBegin.

    Member documentation

    • flags – reserved for future use. Should be 0.
    • allocationCount – number of allocations in pAllocations array
    • pAllocations – Pointer to array of allocations that can be defragmented.

      The array should have allocationCount elements. The array should not contain nulls. Elements in the array should be unique - same allocation cannot occur twice. It is safe to pass allocations that are in the lost state - they are ignored. All allocations not present in this array are considered non-moveable during this defragmentation.

    • pAllocationsChanged – Optional, output. Pointer to array that will be filled with information whether the allocation at certain index has been changed during defragmentation.

      The array should have allocationCount elements. You can pass null if you are not interested in this information.

    • poolCount – number of pools in pPools array
    • pPools – Either null or pointer to array of pools to be defragmented.

      All the allocations in the specified pools can be moved during defragmentation and there is no way to check if they were really moved as in pAllocationsChanged, so you must query all the allocations in all these pools for new VkDeviceMemory and offset using GetAllocationInfo if you might need to recreate buffers and images bound to them.

      The array should have poolCount elements. The array should not contain nulls. Elements in the array should be unique - same pool cannot occur twice.

      Using this array is equivalent to specifying all allocations from the pools in pAllocations. It might be more efficient.

    • maxCpuBytesToMove – Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on CPU side, like memcpy(), memmove().

      VK_WHOLE_SIZE means no limit.

    • maxCpuAllocationsToMove – Maximum number of allocations that can be moved to a different place using transfers on CPU side, like memcpy(), memmove().

      UINT32_MAX means no limit.

    • maxGpuBytesToMove – Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on GPU side, posted to commandBuffer.

      VK_WHOLE_SIZE means no limit.

    • maxGpuAllocationsToMove – Maximum number of allocations that can be moved to a different place using transfers on GPU side, posted to commandBuffer.

      UINT32_MAX means no limit.

    • commandBuffer – Optional. Command buffer where GPU copy commands will be posted.

      If not null, it must be a valid command buffer handle that supports Transfer queue type. It must be in the recording state and outside of a render pass instance. You need to submit it and make sure it finished execution before calling DefragmentationEnd.

      Passing null means that only CPU defragmentation will be performed.

    Layout

    
     struct VmaDefragmentationInfo2 {
         VmaDefragmentationFlags flags;
         uint32_t allocationCount;
         VmaAllocation * pAllocations;
         VkBool32 * pAllocationsChanged;
         uint32_t poolCount;
         VmaPool * pPools;
         VkDeviceSize maxCpuBytesToMove;
         uint32_t maxCpuAllocationsToMove;
         VkDeviceSize maxGpuBytesToMove;
         uint32_t maxGpuAllocationsToMove;
         VkCommandBuffer commandBuffer;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • FLAGS, ALLOCATIONCOUNT, PALLOCATIONS, PALLOCATIONSCHANGED, POOLCOUNT, PPOOLS, MAXCPUBYTESTOMOVE, MAXCPUALLOCATIONSTOMOVE, MAXGPUBYTESTOMOVE, MAXGPUALLOCATIONSTOMOVE, COMMANDBUFFER

        The struct member offsets.
    • Constructor Detail

      • VmaDefragmentationInfo2

        public VmaDefragmentationInfo2​(java.nio.ByteBuffer container)
        Creates a VmaDefragmentationInfo2 instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • flags

        public int flags()
        Returns the value of the flags field.
      • allocationCount

        public int allocationCount()
        Returns the value of the allocationCount field.
      • pAllocations

        public PointerBuffer pAllocations()
        Returns a PointerBuffer view of the data pointed to by the pAllocations field.
      • pAllocationsChanged

        @Nullable
        public java.nio.IntBuffer pAllocationsChanged()
        Returns a IntBuffer view of the data pointed to by the pAllocationsChanged field.
      • poolCount

        public int poolCount()
        Returns the value of the poolCount field.
      • maxCpuBytesToMove

        public long maxCpuBytesToMove()
        Returns the value of the maxCpuBytesToMove field.
      • maxCpuAllocationsToMove

        public int maxCpuAllocationsToMove()
        Returns the value of the maxCpuAllocationsToMove field.
      • maxGpuBytesToMove

        public long maxGpuBytesToMove()
        Returns the value of the maxGpuBytesToMove field.
      • maxGpuAllocationsToMove

        public int maxGpuAllocationsToMove()
        Returns the value of the maxGpuAllocationsToMove field.
      • commandBuffer

        @Nullable
        public long commandBuffer()
        Returns the value of the commandBuffer field.
      • allocationCount

        public VmaDefragmentationInfo2 allocationCount​(int value)
        Sets the specified value to the allocationCount field.
      • pAllocationsChanged

        public VmaDefragmentationInfo2 pAllocationsChanged​(@Nullable
                                                           java.nio.IntBuffer value)
        Sets the address of the specified IntBuffer to the pAllocationsChanged field.
      • poolCount

        public VmaDefragmentationInfo2 poolCount​(int value)
        Sets the specified value to the poolCount field.
      • maxCpuBytesToMove

        public VmaDefragmentationInfo2 maxCpuBytesToMove​(long value)
        Sets the specified value to the maxCpuBytesToMove field.
      • maxCpuAllocationsToMove

        public VmaDefragmentationInfo2 maxCpuAllocationsToMove​(int value)
        Sets the specified value to the maxCpuAllocationsToMove field.
      • maxGpuBytesToMove

        public VmaDefragmentationInfo2 maxGpuBytesToMove​(long value)
        Sets the specified value to the maxGpuBytesToMove field.
      • maxGpuAllocationsToMove

        public VmaDefragmentationInfo2 maxGpuAllocationsToMove​(int value)
        Sets the specified value to the maxGpuAllocationsToMove field.
      • set

        public VmaDefragmentationInfo2 set​(int flags,
                                           int allocationCount,
                                           PointerBuffer pAllocations,
                                           @Nullable
                                           java.nio.IntBuffer pAllocationsChanged,
                                           int poolCount,
                                           @Nullable
                                           PointerBuffer pPools,
                                           long maxCpuBytesToMove,
                                           int maxCpuAllocationsToMove,
                                           long maxGpuBytesToMove,
                                           int maxGpuAllocationsToMove,
                                           @Nullable
                                           VkCommandBuffer commandBuffer)
        Initializes this struct with the specified values.
      • malloc

        public static VmaDefragmentationInfo2 malloc()
        Returns a new VmaDefragmentationInfo2 instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static VmaDefragmentationInfo2 calloc()
        Returns a new VmaDefragmentationInfo2 instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static VmaDefragmentationInfo2 create​(long address)
        Returns a new VmaDefragmentationInfo2 instance for the specified memory address.
      • callocStack

        public static VmaDefragmentationInfo2 callocStack()
        Returns a new VmaDefragmentationInfo2 instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static VmaDefragmentationInfo2 mallocStack​(MemoryStack stack)
        Returns a new VmaDefragmentationInfo2 instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static VmaDefragmentationInfo2 callocStack​(MemoryStack stack)
        Returns a new VmaDefragmentationInfo2 instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • nflags

        public static int nflags​(long struct)
        Unsafe version of flags().
      • nallocationCount

        public static int nallocationCount​(long struct)
        Unsafe version of allocationCount().
      • npAllocationsChanged

        @Nullable
        public static java.nio.IntBuffer npAllocationsChanged​(long struct)
        Unsafe version of pAllocationsChanged.
      • npoolCount

        public static int npoolCount​(long struct)
        Unsafe version of poolCount().
      • npPools

        @Nullable
        public static PointerBuffer npPools​(long struct)
        Unsafe version of pPools.
      • nmaxCpuBytesToMove

        public static long nmaxCpuBytesToMove​(long struct)
        Unsafe version of maxCpuBytesToMove().
      • nmaxCpuAllocationsToMove

        public static int nmaxCpuAllocationsToMove​(long struct)
        Unsafe version of maxCpuAllocationsToMove().
      • nmaxGpuBytesToMove

        public static long nmaxGpuBytesToMove​(long struct)
        Unsafe version of maxGpuBytesToMove().
      • nmaxGpuAllocationsToMove

        public static int nmaxGpuAllocationsToMove​(long struct)
        Unsafe version of maxGpuAllocationsToMove().
      • ncommandBuffer

        public static long ncommandBuffer​(long struct)
        Unsafe version of commandBuffer().
      • nflags

        public static void nflags​(long struct,
                                  int value)
        Unsafe version of flags.
      • nallocationCount

        public static void nallocationCount​(long struct,
                                            int value)
        Sets the specified value to the allocationCount field of the specified struct.
      • npAllocationsChanged

        public static void npAllocationsChanged​(long struct,
                                                @Nullable
                                                java.nio.IntBuffer value)
        Unsafe version of pAllocationsChanged.
      • npoolCount

        public static void npoolCount​(long struct,
                                      int value)
        Sets the specified value to the poolCount field of the specified struct.
      • npPools

        public static void npPools​(long struct,
                                   @Nullable
                                   PointerBuffer value)
        Unsafe version of pPools.
      • nmaxCpuBytesToMove

        public static void nmaxCpuBytesToMove​(long struct,
                                              long value)
        Unsafe version of maxCpuBytesToMove.
      • nmaxCpuAllocationsToMove

        public static void nmaxCpuAllocationsToMove​(long struct,
                                                    int value)
        Unsafe version of maxCpuAllocationsToMove.
      • nmaxGpuBytesToMove

        public static void nmaxGpuBytesToMove​(long struct,
                                              long value)
        Unsafe version of maxGpuBytesToMove.
      • nmaxGpuAllocationsToMove

        public static void nmaxGpuAllocationsToMove​(long struct,
                                                    int value)
        Unsafe version of maxGpuAllocationsToMove.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array