Class InstanceDataMemoryPool

java.lang.Object
org.boxutil.manager.InstanceDataMemoryPool

public final class InstanceDataMemoryPool extends Object
  • Method Details

    • isNotSupported

      public static boolean isNotSupported()
    • getBufferID

      public static int getBufferID(@NotNull InstanceType target)
      Returns:
      the buffer object name of SSBO, 0 if never have call malloc with target, or pool was unsupported.

      Without mutex.

    • malloc

      public static MemoryBlock malloc(@NotNull InstanceType target, int count)
      Parameters:
      count - instance data count.
      Returns:
      null when allocation failed.
    • realloc

      public static boolean realloc(@NotNull MemoryBlock memory, int newCount)
      Bad for performance, so recommend to allocation the large enough memory block before all.
      Parameters:
      memory - different from C/C++, will not change the object pointer, only remapping and then copy data if needed.
      newCount - instance data count.
      Returns:
      false when re-allocation failed.
    • split

      public static MemoryBlock split(@NotNull MemoryBlock memory, int newCount, boolean fromStartOrEnd)
    • free

      public static boolean free(@NotNull MemoryBlock memory)
      Even if memory was free, the operation is safe.
      Returns:
      false when still have reference after call.
    • share

      public static MemoryBlock share(@NotNull MemoryBlock memory)