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

#include <OpenGLShaderResources.h>

Public Member Functions

 FOpenGLShaderParameterCache ()
 
 ~FOpenGLShaderParameterCache ()
 
void InitializeResources (int32 UniformArraySize)
 
void MarkAllDirty ()
 
void Set (uint32 BufferIndex, uint32 ByteOffset, uint32 NumBytes, const void *NewValues)
 
void CommitPackedGlobals (const FOpenGLLinkedProgram *LinkedProgram, CrossCompiler::EShaderStage Stage)
 
void CommitPackedUniformBuffers (FOpenGLLinkedProgram *LinkedProgram, CrossCompiler::EShaderStage Stage, FRHIUniformBuffer **UniformBuffers, const TArray< CrossCompiler::FUniformBufferCopyInfo > &UniformBuffersCopyInfo)
 

Detailed Description

Caching of OpenGL uniform parameters.

Constructor & Destructor Documentation

◆ FOpenGLShaderParameterCache()

FOpenGLShaderParameterCache::FOpenGLShaderParameterCache ( )

Constructor.

◆ ~FOpenGLShaderParameterCache()

FOpenGLShaderParameterCache::~FOpenGLShaderParameterCache ( )

Destructor.

Member Function Documentation

◆ CommitPackedGlobals()

void FOpenGLShaderParameterCache::CommitPackedGlobals ( const FOpenGLLinkedProgram LinkedProgram,
CrossCompiler::EShaderStage  Stage 
)

Commit shader parameters to the currently bound program.

Parameters
ParameterTable- Information on the bound uniform arrays for the program.

Note that this always uploads the entire uniform array when it is dirty. The arrays are marked dirty either when the bound shader state changes or a value in the array is modified. OpenGL actually caches uniforms per- program. If we shadowed those per-program uniforms we could avoid calling glUniform4?v for values that have not changed since the last invocation of the program.

It's unclear whether the driver does the same thing and whether there is a performance benefit. Even if there is, this type of caching makes any multithreading vastly more difficult, so for now uniforms are not cached per-program.

◆ CommitPackedUniformBuffers()

void FOpenGLShaderParameterCache::CommitPackedUniformBuffers ( FOpenGLLinkedProgram LinkedProgram,
CrossCompiler::EShaderStage  Stage,
FRHIUniformBuffer **  UniformBuffers,
const TArray< CrossCompiler::FUniformBufferCopyInfo > &  UniformBuffersCopyInfo 
)

◆ InitializeResources()

void FOpenGLShaderParameterCache::InitializeResources ( int32  UniformArraySize)

◆ MarkAllDirty()

void FOpenGLShaderParameterCache::MarkAllDirty ( )

Marks all uniform arrays as dirty.

◆ Set()

void FOpenGLShaderParameterCache::Set ( uint32  BufferIndexName,
uint32  ByteOffset,
uint32  NumBytes,
const void NewValues 
)

Sets values directly into the packed uniform array

Set parameter values.


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