UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FRawStaticIndexBuffer Class Reference

#include <RawIndexBuffer.h>

+ Inheritance diagram for FRawStaticIndexBuffer:

Public Member Functions

ENGINE_API FRawStaticIndexBuffer (bool InNeedsCPUAccess=false)
 
virtual ENGINE_API ~FRawStaticIndexBuffer ()
 
bool TrySetAllowCPUAccess (bool bAllowCPUAccess)
 
void SetIndex (const uint32 At, const uint32 NewIndexValue)
 
ENGINE_API void SetIndices (const TArray< uint32 > &InIndices, EIndexBufferStride::Type DesiredStride)
 
ENGINE_API void InsertIndices (const uint32 At, const uint32 *IndicesToAppend, const uint32 NumIndicesToAppend)
 
ENGINE_API void AppendIndices (const uint32 *IndicesToAppend, const uint32 NumIndicesToAppend)
 
uint32 GetIndex (const uint32 At) const
 
ENGINE_API void RemoveIndicesAt (const uint32 At, const uint32 NumIndicesToRemove)
 
ENGINE_API void GetCopy (TArray< uint32 > &OutIndices) const
 
void ExpandTo32Bit ()
 
ENGINE_API const uint16AccessStream16 () const
 
ENGINE_API const uint32AccessStream32 () const
 
ENGINE_API FIndexArrayView GetArrayView () const
 
int32 GetNumIndices () const
 
SIZE_T GetAllocatedSize () const
 
bool GetAllowCPUAccess () const
 
int32 GetIndexDataSize () const
 
FBufferRHIRef CreateRHIBuffer (FRHICommandListBase &RHICmdList)
 
void InitRHIForStreaming (FRHIBuffer *IntermediateBuffer, FRHIResourceReplaceBatcher &Batcher)
 
void ReleaseRHIForStreaming (FRHIResourceReplaceBatcher &Batcher)
 
ENGINE_API void Serialize (FArchive &Ar, bool bNeedsCPUAccess)
 
void SerializeMetaData (FArchive &Ar)
 
void ClearMetaData ()
 
void Discard ()
 
virtual ENGINE_API void InitRHI (FRHICommandListBase &RHICmdList) override
 
bool Is32Bit () const
 
- Public Member Functions inherited from FIndexBuffer
RENDERCORE_API FIndexBuffer ()
 
RENDERCORE_API FIndexBuffer (const FIndexBuffer &)
 
RENDERCORE_API FIndexBufferoperator= (const FIndexBuffer &Other)
 
virtual RENDERCORE_API ~FIndexBuffer ()
 
virtual RENDERCORE_API void ReleaseRHI () override
 
virtual RENDERCORE_API FString GetFriendlyName () const override
 
const FBufferRHIRefGetRHI () const
 
RENDERCORE_API void SetRHI (const FBufferRHIRef &BufferRHI)
 
- Public Member Functions inherited from FRenderResource
RENDERCORE_API FRenderResource ()
 
RENDERCORE_API FRenderResource (ERHIFeatureLevel::Type InFeatureLevel)
 
RENDERCORE_API FRenderResource (const FRenderResource &)
 
RENDERCORE_API FRenderResource (FRenderResource &&)
 
RENDERCORE_API FRenderResourceoperator= (const FRenderResource &Other)
 
RENDERCORE_API FRenderResourceoperator= (FRenderResource &&Other)
 
virtual RENDERCORE_API ~FRenderResource ()
 
virtual RENDERCORE_API void InitResource (FRHICommandListBase &RHICmdList)
 
virtual RENDERCORE_API void ReleaseResource ()
 
RENDERCORE_API void UpdateRHI (FRHICommandListBase &RHICmdList)
 
bool IsInitialized () const
 
int32 GetListIndex () const
 
EInitPhase GetInitPhase () const
 
void SetOwnerName (FName InOwnerName)
 
FName GetOwnerName () const
 
void SetResourceName (FName InResourceName)
 
FName GetResourceName () const
 

Additional Inherited Members

- Public Types inherited from FRenderResource
enum class  EInitPhase : uint8 { Pre , Default , MAX }
 
- Static Public Member Functions inherited from FRenderResource
static RENDERCORE_API void ReleaseRHIForAllResources ()
 
static RENDERCORE_API void InitPreRHIResources ()
 
static RENDERCORE_API void ChangeFeatureLevel (ERHIFeatureLevel::Type NewFeatureLevel)
 
static RENDERCORE_API FName SetScopeName (FName Name)
 
- Public Attributes inherited from FIndexBuffer
FBufferRHIRef IndexBufferRHI
 
- Public Attributes inherited from FRenderResource
ERenderResourceState ResourceState = ERenderResourceState::Default
 
- Protected Member Functions inherited from FRenderResource
void SetFeatureLevel (const FStaticFeatureLevel InFeatureLevel)
 
const FStaticFeatureLevel GetFeatureLevel () const
 
bool HasValidFeatureLevel () const
 
template<typename T >
FBufferRHIRef CreateRHIBuffer (FRHICommandListBase &RHICmdList, T &InOutResourceObject, uint32 ResourceCount, EBufferUsageFlags InBufferUsageFlags, const TCHAR *InDebugName)
 
void SetInitPhase (EInitPhase InInitPhase)
 
- Static Protected Member Functions inherited from FRenderResource
static RENDERCORE_API FRHICommandListBaseGetImmediateCommandList ()
 

Constructor & Destructor Documentation

◆ FRawStaticIndexBuffer()

FRawStaticIndexBuffer::FRawStaticIndexBuffer ( bool  InNeedsCPUAccess = false)

Initialization constructor.

Parameters
InNeedsCPUAccessTrue if resource array data should be accessible by the CPU.

◆ ~FRawStaticIndexBuffer()

FRawStaticIndexBuffer::~FRawStaticIndexBuffer ( )
virtualdefault

Member Function Documentation

◆ AccessStream16()

const uint16 * FRawStaticIndexBuffer::AccessStream16 ( ) const

Get the direct read access to index data Only valid if NeedsCPUAccess = true and indices are 16 bit

◆ AccessStream32()

const uint32 * FRawStaticIndexBuffer::AccessStream32 ( ) const

Get the direct read access to index data Only valid if NeedsCPUAccess = true and indices are 32 bit

◆ AppendIndices()

void FRawStaticIndexBuffer::AppendIndices ( const uint32 IndicesToAppend,
const uint32  NumIndicesToAppend 
)

Append indices to the end of the buffer

Parameters
IndicesToAppendPointer to the array of indices to add to the end
NumIndicesToAppendHow many indices are in the IndicesToAppend array

◆ ClearMetaData()

void FRawStaticIndexBuffer::ClearMetaData ( )

◆ CreateRHIBuffer()

FBufferRHIRef FRawStaticIndexBuffer::CreateRHIBuffer ( FRHICommandListBase RHICmdList)

Create an RHI index buffer with CPU data. CPU data may be discarded after creation (see TResourceArray::Discard)

◆ Discard()

void FRawStaticIndexBuffer::Discard ( )

Discard discards the serialized data when it is not needed

◆ ExpandTo32Bit()

void FRawStaticIndexBuffer::ExpandTo32Bit ( )

Expands the 16bit index buffer to 32bit

◆ GetAllocatedSize()

SIZE_T FRawStaticIndexBuffer::GetAllocatedSize ( ) const
inline

Computes the amount of memory allocated to store the indices.

◆ GetAllowCPUAccess()

bool FRawStaticIndexBuffer::GetAllowCPUAccess ( ) const
inline

◆ GetArrayView()

FIndexArrayView FRawStaticIndexBuffer::GetArrayView ( ) const

Retrieves an array view in to the index buffer. The array view allows code to retrieve indices as 32-bit regardless of how they are stored internally without a copy. The array view is valid only if: The buffer was created with NeedsCPUAccess = true OR the resource has not yet been initialized AND SetIndices has not been called since.

◆ GetCopy()

void FRawStaticIndexBuffer::GetCopy ( TArray< uint32 > &  OutIndices) const

Retrieve a copy of the indices in this buffer. Only valid if created with NeedsCPUAccess set to true or the resource has not yet been initialized.

Parameters
OutIndicesArray in which to store the copy of the indices.

◆ GetIndex()

uint32 FRawStaticIndexBuffer::GetIndex ( const uint32  At) const
inline
Returns
Gets a specific index value

◆ GetIndexDataSize()

int32 FRawStaticIndexBuffer::GetIndexDataSize ( ) const
inline

== GetNumIndices() * (b32Bit ? 4 : 2)

◆ GetNumIndices()

int32 FRawStaticIndexBuffer::GetNumIndices ( ) const
inline

Computes the number of indices stored in this buffer.

◆ InitRHI()

void FRawStaticIndexBuffer::InitRHI ( FRHICommandListBase RHICmdList)
overridevirtual

Initializes the RHI resources used by this resource. Called when entering the state where both the resource and the RHI have been initialized. This is only called by the rendering thread.

Reimplemented from FRenderResource.

◆ InitRHIForStreaming()

void FRawStaticIndexBuffer::InitRHIForStreaming ( FRHIBuffer IntermediateBuffer,
FRHIResourceReplaceBatcher Batcher 
)

Take over ownership of IntermediateBuffer

◆ InsertIndices()

void FRawStaticIndexBuffer::InsertIndices ( const uint32  At,
const uint32 IndicesToAppend,
const uint32  NumIndicesToAppend 
)

Insert indices at the given position in the buffer

Parameters
AtIndex to insert at
IndicesToAppendPointer to the array of indices to insert
NumIndicesToAppendHow many indices are in the IndicesToAppend array

◆ Is32Bit()

bool FRawStaticIndexBuffer::Is32Bit ( ) const
inline

◆ ReleaseRHIForStreaming()

void FRawStaticIndexBuffer::ReleaseRHIForStreaming ( FRHIResourceReplaceBatcher Batcher)

Release any GPU resource owned by the RHI object

◆ RemoveIndicesAt()

void FRawStaticIndexBuffer::RemoveIndicesAt ( const uint32  At,
const uint32  NumIndicesToRemove 
)

Removes indices from the buffer

Parameters
AtThe index of the first index to remove
NumIndicesToRemoveHow many indices to remove

◆ Serialize()

void FRawStaticIndexBuffer::Serialize ( FArchive Ar,
bool  bNeedsCPUAccess 
)

Serialization.

Parameters
ArArchive to serialize with
bNeedsCPUAccessWhether the elements need to be accessed by the CPU

◆ SerializeMetaData()

void FRawStaticIndexBuffer::SerializeMetaData ( FArchive Ar)

Serialize only meta data (e.g. number of indices) but not the actual index data

◆ SetIndex()

void FRawStaticIndexBuffer::SetIndex ( const uint32  At,
const uint32  NewIndexValue 
)
inline

Sets a single index value. Consider using SetIndices() instead if you're setting a lot of indices.

Parameters
AtThe index of the index to set
NewIndexValueThe index value

◆ SetIndices()

void FRawStaticIndexBuffer::SetIndices ( const TArray< uint32 > &  InIndices,
EIndexBufferStride::Type  DesiredStride 
)

Set the indices stored within this buffer.

Parameters
InIndicesThe new indices to copy in to the buffer.
DesiredStrideThe desired stride (16 or 32 bits).

◆ TrySetAllowCPUAccess()

bool FRawStaticIndexBuffer::TrySetAllowCPUAccess ( bool  bAllowCPUAccess)
inline

Copy everything, keeping reference to the same RHI resources. Returns true if input value for bAllowCPUAccess will be honored:

  • if bAllowCPUAccess is true then no indices have already been cached or IndexStorage is not empty
  • or if bAllowCPUAccess is false

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