ImFusion SDK 4.3
GlProgramIncludeManager Class Reference

#include <ImFusion/GL/GlProgramIncludeManager.h>

Helper class to manage instances of the same base shader with different abstract includes and/or defines. More...

+ Inheritance diagram for GlProgramIncludeManager:

Detailed Description

Helper class to manage instances of the same base shader with different abstract includes and/or defines.

This class is a specialization of GL::ProgramCache adding a convenience overload getProgram(const SharedImage& si, const std::string& additionalDefines).

Public Member Functions

 GlProgramIncludeManager (std::unique_ptr< GL::Program > referenceProgram, std::size_t cacheSize=10)
 Instantiates a GlProgramIncludeManager based on the given reference shader.
 
GL::ProgramgetProgram (const GL::AbstractInclude *include1=nullptr, const GL::AbstractInclude *include2=nullptr, const std::string &additionalDefines="")
 Retrieves the correct shader version w.r.t the given abstract includes.
 
GL::ProgramgetProgram (const SharedImage &si, const std::string &additionalDefines="")
 Convenience overload that retrieves the correct shader version w.r.t.
 
GL::ProgramgetProgram (const std::vector< const GL::AbstractInclude * > &includes, const std::string &additionalDefines="")
 Retrieves the correct shader version w.r.t the given abstract includes.
 
GL::ProgramgetProgram (const std::string &additionalDefines)
 Convenience overload that retrieves the shader with the given additional defines but without any additional includes.
 

Constructor & Destructor Documentation

◆ GlProgramIncludeManager()

GlProgramIncludeManager ( std::unique_ptr< GL::Program > referenceProgram,
std::size_t cacheSize = 10 )

Instantiates a GlProgramIncludeManager based on the given reference shader.

Note
This constructor will throw if the reference shader invalid (null).
Parameters
referenceProgramReference shader, must not be null.
cacheSizeNumber of instances that can be cached. Must be greater than 0.

Member Function Documentation

◆ getProgram() [1/4]

GL::Program & getProgram ( const GL::AbstractInclude * include1 = nullptr,
const GL::AbstractInclude * include2 = nullptr,
const std::string & additionalDefines = "" )

Retrieves the correct shader version w.r.t the given abstract includes.

Note
Internally, this function may instantiate a new GL::Program. Therefore, it may throw if it can not instantiate a shader for the given combination.
Parameters
include1First optional abstract include to expand into the reference shader.
include2Second optional abstract include to expand into the reference shader.
additionalDefinesSet of defines inserted into the shader header.

◆ getProgram() [2/4]

GL::Program & getProgram ( const SharedImage & si,
const std::string & additionalDefines = "" )

Convenience overload that retrieves the correct shader version w.r.t.

the mask and deformation of the given image.

Note
Internally, this function may instantiate a new GL::Program. Therefore, it may throw if it can not instantiate a shader for the given combination.
Parameters
siReference image defining the mask and deformation abstract include to use.
additionalDefinesSet of defines inserted into the shader header.

◆ getProgram() [3/4]

GL::Program & getProgram ( const std::vector< const GL::AbstractInclude * > & includes,
const std::string & additionalDefines = "" )

Retrieves the correct shader version w.r.t the given abstract includes.

Parameters
includesVector of abstract includes
additionalDefinesSet of defines inserted into the shader header.
Exceptions
std::runtime_errorif GL::Program instantiation for the requested combination of abstract includes and defines has failed.

◆ getProgram() [4/4]

GL::Program & getProgram ( const std::string & additionalDefines)

Convenience overload that retrieves the shader with the given additional defines but without any additional includes.

Parameters
additionalDefinesSet of defines inserted into the shader header.
Exceptions
std::runtime_errorif GL::Program instantiation for the requested combination of abstract includes and defines has failed.

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close