|
ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
|
A CPU-accessible SDL_GPUTransferBuffer for staging data to or from the GPU.
More...
#include <TransferBuffer.h>
Public Member Functions | |
| TransferBuffer * | initWithDevice (TransferBuffer *self, RenderDevice *device, const SDL_GPUTransferBufferCreateInfo *info) |
Initializes this TransferBuffer, creating its SDL_GPUTransferBuffer. | |
| void * | map (const TransferBuffer *self, bool cycle) |
| Maps this transfer buffer into CPU-accessible memory for reading or writing. | |
| void | unmap (const TransferBuffer *self) |
Unmaps this transfer buffer previously mapped with map. | |
| Class * | _TransferBuffer (void) |
| The TransferBuffer archetype. | |
Data Fields | |
| Object | object |
| The superclass. | |
| SDL_GPUTransferBuffer * | buffer |
| The underlying SDL transfer buffer. | |
| Uint32 | size |
| The size of this transfer buffer, in bytes. | |
Protected Attributes | |
| TransferBufferInterface * | interface |
| The interface. | |
A CPU-accessible SDL_GPUTransferBuffer for staging data to or from the GPU.
TransferBuffer owns its underlying SDL_GPUTransferBuffer and releases it in dealloc, so a TransferBuffer is freed with release like any other Objectively object. Its buffer field is the raw handle to embed in an SDL_GPUTransferBufferLocation or SDL_GPUTextureTransferInfo when calling CopyPass upload/download methods:
| Class * _TransferBuffer | ( | void | ) |
The TransferBuffer archetype.
| TransferBuffer * initWithDevice | ( | TransferBuffer * | self, |
| RenderDevice * | device, | ||
| const SDL_GPUTransferBufferCreateInfo * | info | ||
| ) |
Initializes this TransferBuffer, creating its SDL_GPUTransferBuffer.
This is the designated initializer.
| self | The TransferBuffer. |
| device | The RenderDevice used to create, map, and release the transfer buffer. Retained. |
| info | Transfer buffer creation parameters (usage: upload or download, size). |
| void * map | ( | const TransferBuffer * | self, |
| bool | cycle | ||
| ) |
Maps this transfer buffer into CPU-accessible memory for reading or writing.
Pass cycle = true to let the driver use a fresh buffer allocation (avoiding a pipeline stall) when the buffer is already in use by the GPU. Call unmap when done; the mapping must not be used after that.
| self | The TransferBuffer. |
| cycle | If true, the driver may cycle to a new backing allocation. |
| void unmap | ( | const TransferBuffer * | self | ) |
Unmaps this transfer buffer previously mapped with map.
The CPU pointer returned by map must not be accessed after this call.
| self | The TransferBuffer. |
| SDL_GPUTransferBuffer* TransferBuffer::buffer |
The underlying SDL transfer buffer.
|
protected |
The interface.
| Object TransferBuffer::object |
The superclass.
| Uint32 TransferBuffer::size |
The size of this transfer buffer, in bytes.