Open 3D Engine Atom Gem API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Member Functions | Friends | List of all members
AZ::RPI::DynamicBuffer Class Reference

#include <DynamicBuffer.h>

Inherits intrusive_base.

Public Member Functions

bool Write (const void *data, uint32_t size)
 Write data to the DyanmicBuffer. The write size can't be larger than this buffer's size.
 
uint32_t GetSize ()
 Get the buffer's size.
 
void * GetBufferAddress ()
 Get the buffer's address. User can write data to the address.
 
RHI::IndexBufferView GetIndexBufferView (RHI::IndexFormat format)
 Get IndexBufferView if this buffer is used as index buffer.
 
RHI::StreamBufferView GetStreamBufferView (uint32_t strideByteCount)
 

Friends

class DynamicBufferAllocator
 

Detailed Description

A DynamicBuffer represents a transient GPU buffer which only be valid for one frame after it's acquired. The acquired DynamicBuffers become invalid when DynamicDrawInterface::Get()->FrameEnd() is called. DynamicBuffers are allocated by DynamicBufferAllocator. Check the description of DynamicBufferAllocator class for detail. The typical usage: // For every frame auto buffer = DynamicDrawInterface::Get()->GetDynamicBuffer(size, RHI::Alignment::InputAssembly); if (buffer) // the buffer could be empty if the allocation failed. { // write data to the buffer buffer->Write(data, size); // Use the buffer view for DrawItem or etc. } Note: DynamicBuffer should only be used for DynamicInputAssembly buffer or Constant buffer (not supported yet).

Member Function Documentation

◆ GetStreamBufferView()

RHI::StreamBufferView AZ::RPI::DynamicBuffer::GetStreamBufferView ( uint32_t  strideByteCount)

Get StreamBufferView if this buffer is used as vertex buffer

Parameters
strideByteCountthe byte count of the element

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