Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
Program Class Reference

A program. More...

#include <Program.h>

Inherits Object.

Inherited by ProgramImpl, ProgramImpl, ProgramImpl, ProgramImpl, and ProgramImpl.

Public Types

using VertexInputMap = tlx::hash_map<VertexSemantic, VertexInputDesc>
 Get active vertex attributes.

Public Member Functions

UniformLocation getUniformLocation (std::string_view name) const
 Get uniform location by name.
UniformLocation getUniformLocation (rhi::Uniform kind) const
 Get uniform location by engine built-in uniform enum name.
void getUniformLocations (std::string_view name, UniformLocationVector &out) const
 Retrieves all uniform locations associated with the given uniform name.
size_t getUniformBufferSize () const
 Get uniform buffer size in bytes that can hold all the uniforms.
uint32_t getProgramType () const
 Get engine built-in program type.
uint64_t getProgramId () const
 Get program id.
const UniformMap & getActiveUniformInfos () const
 Get all uniformInfos.
Public Member Functions inherited from Object
void retain ()
 Retains the ownership.
void release ()
 Releases the ownership immediately.
Object * autorelease ()
 Releases the ownership sometime soon automatically.
unsigned int getReferenceCount () const
 Returns the Object's current reference count.
uint64_t getObjectID () const noexcept
 Returns the process-local diagnostic identifier assigned at construction.
virtual ~Object ()
 Destructor.

Detailed Description

A program.

Member Typedef Documentation

◆ VertexInputMap

using VertexInputMap = tlx::hash_map<VertexSemantic, VertexInputDesc>

Get active vertex attributes.

Returns
Active vertex attributes. key is active attribute name, Value is corresponding attribute info.

Member Function Documentation

◆ getUniformLocation() [1/2]

UniformLocation getUniformLocation ( std::string_view name) const

Get uniform location by name.

Parameters
uniformSpecifies the uniform name.
Returns
The uniform location.

◆ getUniformLocation() [2/2]

UniformLocation getUniformLocation ( rhi::Uniform kind) const

Get uniform location by engine built-in uniform enum name.

Parameters
nameSpecifies the engine built-in uniform enum name.
Returns
The uniform location.

◆ getUniformLocations()

void getUniformLocations ( std::string_view name,
UniformLocationVector & out ) const

Retrieves all uniform locations associated with the given uniform name.

This function resolves the uniform name to all reflected uniform entries across all shader stages (e.g., vertex, fragment). A uniform name may map to multiple locations when:

  • the same uniform appears in multiple stages,
  • the uniform is an array,
  • the uniform expands to multiple backend binding slots (e.g., samplers).

The resolved locations are appended to the user‑provided out vector. No memory is allocated internally; callers may reuse the same vector to minimize allocations and improve cache locality.

Parameters
nameThe short uniform name (e.g., "u_color").
outThe output vector to which all matching uniform locations will be appended.
Note
This API complements the legacy getUniformLocation() method, which returns only the first matching location for backward compatibility.

◆ getUniformBufferSize()

size_t getUniformBufferSize ( ) const

Get uniform buffer size in bytes that can hold all the uniforms.

Parameters
stageSpecifies the shader stage. The symbolic constant can be either VERTEX or FRAGMENT.
Returns
The uniform buffer size in bytes.

◆ getProgramType()

uint32_t getProgramType ( ) const
inline

Get engine built-in program type.

Returns
The built-in program type.

◆ getProgramId()

uint64_t getProgramId ( ) const
inline

Get program id.

Returns
The program id.

◆ getActiveUniformInfos()

const UniformMap & getActiveUniformInfos ( ) const
inline

Get all uniformInfos.

Returns
The uniformInfos.

The documentation for this class was generated from the following file:
  • Program.h