Package icyllis.arc3d.engine

# Class UploadBufferManager

java.lang.Object
icyllis.arc3d.engine.UploadBufferManager

public class UploadBufferManager extends Object
Allocates staging buffers to update GPU-only buffer and image sub resources.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final long`
  `SMALL_BUFFER_SIZE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UploadBufferManager(ResourceProvider resourceProvider)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `flush(List<@SharedPtr Resource> outResourceRefs)`
  Finalizes all buffers and transfers ownership of them to given list.
  `static long`
  `getLargeBufferSize(long minBytes)`
  Return an appropriate size for dedicated upload buffer to improve resource reuse.
  `long`
  `getUploadPointer(long requiredBytes, long requiredAlignment, BufferViewInfo outInfo)`
  Allocate a staging buffer for uploading, return mapped pointer.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SMALL_BUFFER_SIZE

    public static final long SMALL_BUFFER_SIZE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### UploadBufferManager

    public UploadBufferManager(ResourceProvider resourceProvider)

- ## Method Details

  - ### getLargeBufferSize

    public static long getLargeBufferSize(long minBytes)
    Return an appropriate size for dedicated upload buffer to improve resource reuse. Values invalid input: '<'= 4 MB will pop up to the next power of 2. Values invalid input: '<'= 64 MB will go up half the floor power of 2. Values > 64 MB will go up to the next multiple of 16 MB.

  - ### getUploadPointer

    public long getUploadPointer(long requiredBytes, long requiredAlignment, BufferViewInfo outInfo)
    Allocate a staging buffer for uploading, return mapped pointer.
    Parameters:
      `outInfo` - buffer bind info
    Returns:
      write-only address, or NULL

  - ### flush

    public void flush(List<@SharedPtr Resource> outResourceRefs)
    Finalizes all buffers and transfers ownership of them to given list.
    Parameters:
      `outResourceRefs` - receive ownership of resources