Open 3D Engine AtomTressFX Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Render::SharedBuffer Class Reference

#include <SharedBuffer.h>

Inherits AZ::Render::HairSharedBufferInterface, and SystemTickBus::Handler.

Public Member Functions

 SharedBuffer (AZStd::string bufferName, AZStd::vector< SrgBufferDescriptor > &buffersDescriptors)
 
 AZ_RTTI (AZ::Render::SharedBuffer, "{D910C301-99F7-41B6-A2A6-D566F3B2C030}", AZ::Render::HairSharedBufferInterface)
 
void Init (AZStd::string bufferName, AZStd::vector< SrgBufferDescriptor > &buffersDescriptors)
 
AZStd::intrusive_ptr< HairSharedBufferAllocationAllocate (size_t byteCount) override
 
void DeAllocate (RHI::VirtualAddress allocation) override
 
void DeAllocateNoSignal (RHI::VirtualAddress allocation) override
 
Data::Asset< RPI::BufferAsset > GetBufferAsset () const override
 Returns the shared buffer asset used for all Hair objects and passes.
 
Data::Instance< RPI::Buffer > GetBuffer () override
 Returns the buffer that is used for all skinned mesh outputs.
 
bool UpdateData (const void *sourceData, uint64_t sourceDataSizeInBytes, uint64_t bufferByteOffset=0) override
 Update buffer's content with sourceData at an offset of bufferByteOffset.
 
- Public Member Functions inherited from AZ::Render::HairSharedBufferInterface
 AZ_RTTI (AZ::Render::HairSharedBufferInterface, "{3CCB13CB-16FF-43F5-98DC-F36B2A9F8E5E}")
 
 AZ_DISABLE_COPY_MOVE (HairSharedBufferInterface)
 

Static Public Member Functions

static RHI::BufferViewDescriptor CreateResourceViewWithDifferentFormat (uint32_t offsetInBytes, uint32_t elementCount, uint32_t elementSize, RHI::Format format, RHI::BufferBindFlags overrideBindFlags)
 
- Static Public Member Functions inherited from AZ::Render::HairSharedBufferInterface
static HairSharedBufferInterfaceGet ()
 

Detailed Description

This class represents a single RPI::Buffer used to allocate sub-buffers from the existing buffer that can then be used per draw. In a way, this buffer is used as a memory pool from which sub-buffers are being created. This is very useful when we want to synchronize the use of these buffers via barriers so we declare and pass the entire buffer between passes and therefore we are creating a dependency and barrier for this single buffer, yet as a result all sub-buffers are now getting synced between passes.

Member Function Documentation

◆ Allocate()

AZStd::intrusive_ptr<HairSharedBufferAllocation> AZ::Render::SharedBuffer::Allocate ( size_t  byteCount)
overridevirtual

If the allocation succeeds, returns a ref-counted pointer to a VirtualAddress which will be automatically freed if the ref-count drops to zero If the allocation fails, returns nullptr

Implements AZ::Render::HairSharedBufferInterface.

◆ CreateResourceViewWithDifferentFormat()

static RHI::BufferViewDescriptor AZ::Render::SharedBuffer::CreateResourceViewWithDifferentFormat ( uint32_t  offsetInBytes,
uint32_t  elementCount,
uint32_t  elementSize,
RHI::Format  format,
RHI::BufferBindFlags  overrideBindFlags 
)
static

Utility function to create a resource view of different type than the shared buffer data. Since this class is sub-buffer container, this method should be used after creating a new allocation to be used as a sub-buffer.

◆ DeAllocate()

void AZ::Render::SharedBuffer::DeAllocate ( RHI::VirtualAddress  allocation)
overridevirtual

Mark the memory as available and queue garbage collection to recycle it later (see RHI::Allocator::DeAllocate) After garbage collection is done signal handlers that memory has been freed

Implements AZ::Render::HairSharedBufferInterface.

◆ DeAllocateNoSignal()

void AZ::Render::SharedBuffer::DeAllocateNoSignal ( RHI::VirtualAddress  allocation)
overridevirtual

Same as DeAllocate, but the signal after garbage collection is ignored If multiple allocations succeeded before one failed, use this to release the successful allocations without triggering new events indicating that new memory has been freed

Implements AZ::Render::HairSharedBufferInterface.


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