⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.

Axmol Engine 3.0.0-dff292a
Loading...
Searching...
No Matches
ProgramManager Class Reference

Cache and reuse program object. More...

#include <ProgramManager.h>

Public Member Functions

ProgramgetBuiltinProgram (uint32_t type)
 get built-in program
uint64_t registerCustomProgram (std::string_view vsName, std::string_view fsName, VertexLayoutKind vlk=VertexLayoutKind::Invalid, bool force=false)
 register a custom program
ProgramloadProgram (uint64_t progId)
 load a builtin/or custom program:
ProgramloadProgram (std::string_view vsName, std::string_view fsName, VertexLayoutKind vlk=VertexLayoutKind::Invalid)
 Load a program with vsName, fsName as CUSTOM immediately without register.
void unloadProgram (Program *program)
 Unload a program object from cache.
void unloadUnusedPrograms ()
 Unload all unused program objects from cache.
void unloadAllPrograms ()
 Unload all program objects from cache.

Static Public Member Functions

static ProgramManagergetInstance ()
 returns the shared instance
static void destroyInstance ()
 purges the cache.

Detailed Description

Cache and reuse program object.

Member Function Documentation

◆ destroyInstance()

void destroyInstance ( )
static

purges the cache.

It releases the retained instance.

◆ registerCustomProgram()

uint64_t registerCustomProgram ( std::string_view vsName,
std::string_view fsName,
VertexLayoutKind vlk = VertexLayoutKind::Invalid,
bool force = false )

register a custom program

Returns
the id of custom program, 0: fail, the id can use by loadProgram

◆ loadProgram() [1/2]

Program * loadProgram ( uint64_t progId)

load a builtin/or custom program:

Parameters
idthe id of program to load, the id value returned by registerCustomProgram or builtin programType, whe the id < ProgramType:BUILTIN_COUNT, this function is identical to 'getBuiltinProgram'

◆ loadProgram() [2/2]

Program * loadProgram ( std::string_view vsName,
std::string_view fsName,
VertexLayoutKind vlk = VertexLayoutKind::Invalid )

Load a program with vsName, fsName as CUSTOM immediately without register.

Parameters
vsNamethe vertex shader name: custom/xxx_vs
fsNamethe fragment shader name: custom/xxx_vs
vlkthe builtin vertex layout type used for loading program
Returns
Program* (nullable)
Remarks
the returend program type always ProgramType::CUSTOM_PROGRAM

◆ unloadProgram()

void unloadProgram ( Program * program)

Unload a program object from cache.

Parameters
programSpecifies the program object to move.

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