UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
D3D11UniformBuffer.cpp File Reference

Classes

struct  FPooledUniformBuffer
 

Functions

uint32 GetPoolBucketSize (uint32 NumBytes)
 
uint32 GetPoolBucketIndex (uint32 NumBytes)
 
void UniformBufferBeginFrame ()
 
void UpdateUniformBufferContents (FD3D11Device *Direct3DDevice, FD3D11DeviceContext *Context, FD3D11UniformBuffer *UniformBuffer, const void *Contents, uint32 ConstantBufferSize)
 

Variables

const int32 NumPoolBuckets = 17
 
const int32 NumSafeFrames = 3
 
TArray< FPooledUniformBufferUniformBufferPool [NumPoolBuckets]
 
TArray< FPooledUniformBufferSafeUniformBufferPools [NumSafeFrames][NumPoolBuckets]
 

Function Documentation

◆ GetPoolBucketIndex()

uint32 GetPoolBucketIndex ( uint32  NumBytes)

Returns the index of the bucket that the given size fits into.

◆ GetPoolBucketSize()

uint32 GetPoolBucketSize ( uint32  NumBytes)

Returns the size in bytes of the bucket that the given size fits into.

◆ UniformBufferBeginFrame()

void UniformBufferBeginFrame ( )

Does per-frame global updating for the uniform buffer pool.

◆ UpdateUniformBufferContents()

void UpdateUniformBufferContents ( FD3D11Device Direct3DDevice,
FD3D11DeviceContext Context,
FD3D11UniformBuffer UniformBuffer,
const void Contents,
uint32  ConstantBufferSize 
)

Variable Documentation

◆ NumPoolBuckets

const int32 NumPoolBuckets = 17

Number of size buckets to use for the uniform buffer free pool. This needs to be enough to cover the valid uniform buffer size range combined with the heuristic used to map sizes to buckets.

◆ NumSafeFrames

const int32 NumSafeFrames = 3

Number of frames that a uniform buffer will not be re-used for, after being freed. This is done as a workaround for what appears to be an AMD driver bug with 11.10 drivers and a 6970 HD, Where reusing a constant buffer with D3D11_MAP_WRITE_DISCARD still in use by the GPU will result in incorrect contents randomly.

◆ SafeUniformBufferPools

Uniform buffers that have been freed more recently than NumSafeFrames ago.

◆ UniformBufferPool

Pool of free uniform buffers, indexed by bucket for constant size search time.