SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::GPUBuffer Class Reference

An opaque handle representing a buffer. More...

Public Member Functions

constexpr GPUBuffer (GPUBufferRaw gPUBuffer={})
 Wraps GPUBuffer. More...
 
 GPUBuffer (GPUDeviceParam device, const GPUBufferCreateInfo &createinfo)
 Creates a buffer object to be used in graphics or compute workflows. More...
 
constexpr bool operator== (const GPUBuffer &other) const =default
 Default comparison operator.
 
constexpr bool operator== (GPUBufferRaw gPUBuffer) const
 Compares with the underlying type.
 
constexpr operator GPUBufferRaw () const
 Unwraps to the underlying GPUBuffer. More...
 

Detailed Description

Used for vertices, indices, indirect draw commands, and general compute data.

Since
This struct is available since SDL 3.2.0.
See also
GPUBuffer.GPUBuffer
GPUCopyPass.UploadToBuffer
GPUCopyPass.DownloadFromBuffer
GPUCopyPass.CopyBufferToBuffer
GPURenderPass.BindVertexBuffers
GPURenderPass.BindIndexBuffer
GPURenderPass.BindVertexStorageBuffers
GPURenderPass.BindFragmentStorageBuffers
GPURenderPass.DrawPrimitivesIndirect
GPURenderPass.DrawIndexedPrimitivesIndirect
GPUComputePass.BindStorageBuffers
GPUComputePass.DispatchIndirect
GPUDevice.ReleaseBuffer

Constructor & Destructor Documentation

◆ GPUBuffer() [1/2]

constexpr SDL::GPUBuffer::GPUBuffer ( GPUBufferRaw  gPUBuffer = {})
inlineconstexpr
Parameters
gPUBufferthe value to be wrapped

◆ GPUBuffer() [2/2]

SDL::GPUBuffer::GPUBuffer ( GPUDeviceParam  device,
const GPUBufferCreateInfo createinfo 
)
inline

The contents of this buffer are undefined until data is written to the buffer.

Note that certain combinations of usage flags are invalid. For example, a buffer cannot have both the VERTEX and INDEX flags.

If you use a STORAGE flag, the data in the buffer must respect std140 layout conventions. In practical terms this means you must ensure that vec3 and vec4 fields are 16-byte aligned.

For better understanding of underlying concepts and memory management with SDL GPU API, you may refer this blog post.

There are optional properties that can be provided through props. These are the supported properties:

  • prop::GPUBuffer.CREATE_NAME_STRING: a name that can be displayed in debugging tools.
Parameters
devicea GPU Context.
createinfoa struct describing the state of the buffer to create.
Postcondition
a buffer object on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
GPUCopyPass.UploadToBuffer
GPUCopyPass.DownloadFromBuffer
GPUCopyPass.CopyBufferToBuffer
GPURenderPass.BindVertexBuffers
GPURenderPass.BindIndexBuffer
GPURenderPass.BindVertexStorageBuffers
GPURenderPass.BindFragmentStorageBuffers
GPURenderPass.DrawPrimitivesIndirect
GPURenderPass.DrawIndexedPrimitivesIndirect
GPUComputePass.BindStorageBuffers
GPUComputePass.DispatchIndirect
GPUDevice.ReleaseBuffer

Member Function Documentation

◆ operator GPUBufferRaw()

constexpr SDL::GPUBuffer::operator GPUBufferRaw ( ) const
inlineconstexpr
Returns
the underlying GPUBufferRaw.

The documentation for this class was generated from the following file: