VertexBufferShadow

Represents a shadow of a VertexBuffer that allows manipulation and synchronization of vertex data with a buffer residing in GPU memory. This interface provides methods to upload, download, and manage vertex data in a buffer.

Properties

Link copied to clipboard

The underlying GPU-resident vertex buffer that serves as the data source for this shadow buffer.

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract fun destroy()
Link copied to clipboard
abstract fun download()

Downloads vertex data from the GPU memory into the shadow buffer. This method synchronizes the shadow buffer with the current state of the associated GPU-resident VertexBuffer. Typically used to retrieve the vertex data for inspection or modification.

Link copied to clipboard
abstract fun reader(): BufferReader
Link copied to clipboard
abstract fun upload(offsetInBytes: Int = 0, sizeInBytes: Int = vertexBuffer.vertexCount * vertexBuffer.vertexFormat.size)

Uploads vertex data to the GPU memory from the shadow buffer.

Link copied to clipboard
open fun uploadElements(elementOffset: Int = 0, elementCount: Int = vertexBuffer.vertexCount)

Uploads a specified range of vertices from the shadow buffer to the GPU memory.

Link copied to clipboard
abstract fun writer(): BufferWriter

Creates and returns a BufferWriter to facilitate writing operations to the shadow buffer. The returned BufferWriter allows structured data, such as vectors or matrices, to be written into the buffer for subsequent GPU upload or processing.