Class BGFXMemory

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

    public class BGFXMemory
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    Memory must be obtained by calling alloc, copy, or make_ref.

    It is illegal to create this structure on stack and pass it to any bgfx API.

    Layout

    
     struct bgfx_memory_t {
         uint8_t * data();
         uint32_t size();
     }
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BGFXMemory.Buffer
      An array of BGFXMemory structs.
      • Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer

        org.lwjgl.system.Pointer.Default
      • Nested classes/interfaces inherited from class org.lwjgl.system.Struct

        org.lwjgl.system.Struct.StructValidation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALIGNOF
      The struct alignment in bytes.
      static int DATA
      SIZE
      The struct member offsets.
      static int SIZEOF
      The struct size in bytes.
      • Fields inherited from interface org.lwjgl.system.Pointer

        BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE
    • Constructor Summary

      Constructors 
      Constructor Description
      BGFXMemory​(java.nio.ByteBuffer container)
      Creates a BGFXMemory instance at the current position of the specified ByteBuffer container.
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • DATA, SIZE

        The struct member offsets.
    • Constructor Detail

      • BGFXMemory

        public BGFXMemory​(java.nio.ByteBuffer container)
        Creates a BGFXMemory 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()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • data

        public java.nio.ByteBuffer data()
        pointer to data
      • size

        public int size()
        data size
      • data

        public BGFXMemory data​(java.nio.ByteBuffer value)
        Sets the address of the specified ByteBuffer to the data() field.
      • set

        public BGFXMemory set​(BGFXMemory src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

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

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

        public static BGFXMemory create()
        Returns a new BGFXMemory instance allocated with BufferUtils.
      • create

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

        @Nullable
        public static BGFXMemory createSafe​(long address)
        Like create, but returns null if address is NULL.
      • malloc

        public static BGFXMemory.Buffer malloc​(int capacity)
        Returns a new BGFXMemory.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • calloc

        public static BGFXMemory.Buffer calloc​(int capacity)
        Returns a new BGFXMemory.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • create

        public static BGFXMemory.Buffer create​(int capacity)
        Returns a new BGFXMemory.Buffer instance allocated with BufferUtils.
        Parameters:
        capacity - the buffer capacity
      • create

        public static BGFXMemory.Buffer create​(long address,
                                               int capacity)
        Create a BGFXMemory.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static BGFXMemory.Buffer createSafe​(long address,
                                                   int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        @Deprecated
        public static BGFXMemory mallocStack​(org.lwjgl.system.MemoryStack stack)
        Deprecated.
        Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
      • callocStack

        @Deprecated
        public static BGFXMemory callocStack​(org.lwjgl.system.MemoryStack stack)
        Deprecated.
        Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
      • mallocStack

        @Deprecated
        public static BGFXMemory.Buffer mallocStack​(int capacity,
                                                    org.lwjgl.system.MemoryStack stack)
        Deprecated.
        Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
      • callocStack

        @Deprecated
        public static BGFXMemory.Buffer callocStack​(int capacity,
                                                    org.lwjgl.system.MemoryStack stack)
        Deprecated.
        Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
      • malloc

        public static BGFXMemory malloc​(org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • calloc

        public static BGFXMemory calloc​(org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • malloc

        public static BGFXMemory.Buffer malloc​(int capacity,
                                               org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • calloc

        public static BGFXMemory.Buffer calloc​(int capacity,
                                               org.lwjgl.system.MemoryStack stack)
        Returns a new BGFXMemory.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • ndata

        public static java.nio.ByteBuffer ndata​(long struct)
        Unsafe version of data.
      • nsize

        public static int nsize​(long struct)
        Unsafe version of size().
      • ndata

        public static void ndata​(long struct,
                                 java.nio.ByteBuffer value)
        Unsafe version of data.
      • nsize

        public static void nsize​(long struct,
                                 int value)
        Sets the specified value to the size field of the specified struct.
      • validate

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