Axmol Engine 2.4.0-258ceca
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, VertexLayoutType vlt=VertexLayoutType::Unspec, 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, VertexLayoutType vlt=VertexLayoutType::Unspec)
 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.
 
 AX_DEPRECATED (2.1) void removeProgram(Program *prog)
 Remove a program object from cache.
 
 AX_DEPRECATED (2.1) void removeUnusedProgram()
 Remove all unused program objects from cache.
 
 AX_DEPRECATED (2.1) void removeAllPrograms()
 Remove 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()

static void destroyInstance ( )
static

purges the cache.

It releases the retained instance.

◆ registerCustomProgram()

uint64_t registerCustomProgram ( std::string_view vsName,
std::string_view fsName,
VertexLayoutType vlt = VertexLayoutType::Unspec,
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,
VertexLayoutType vlt = VertexLayoutType::Unspec )

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
vltthe 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.

◆ AX_DEPRECATED()

AX_DEPRECATED ( 2. 1)
inline

Remove a program object from cache.

Parameters
programSpecifies the program object to move.

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