gKit2 light
Loading...
Searching...
No Matches
PipelineCache Class Reference

ensemble de shader programs compiles. singleton. More...

#include <draw.h>

Public Member Functions

PipelineProgramfind (const char *filename, const char *definitions="")
 renvoie un shader program compile.

Static Public Member Functions

static PipelineCachemanager ()
 access au singleton.

Protected Member Functions

 PipelineCache ()
 constructeur prive.

Protected Attributes

std::vector< PipelineProgram * > m_programs

Detailed Description

ensemble de shader programs compiles. singleton.

Definition at line 158 of file draw.h.

Constructor & Destructor Documentation

◆ ~PipelineCache()

PipelineCache::~PipelineCache ( )
inline

Definition at line 161 of file draw.h.

162 {
163 printf("[pipeline cache] %d programs.\n", int(m_programs.size()));
164 // le contexte est deja detruit lorsque ce destructeur est appelle...
165 // trop tard pour detruire les programs et les shaders...
166 }
void printf(Text &text, const int px, const int py, const char *format,...)
affiche un texte a la position x, y. meme utilisation que printf().
Definition text.cpp:140

◆ PipelineCache()

PipelineCache::PipelineCache ( )
inlineprotected

constructeur prive.

Definition at line 196 of file draw.h.

196: m_programs() {}

Member Function Documentation

◆ find()

PipelineProgram * PipelineCache::find ( const char * filename,
const char * definitions = "" )
inline

renvoie un shader program compile.

Definition at line 169 of file draw.h.

170 {
171 // todo peut etre remplacer par une unordered_map ? mais il y a peu de shaders utilise normalement...
172 for(auto program : m_programs)
173 {
174 if(program->filename == filename && program->definitions == definitions)
175 return program;
176 }
177
178 // cree le programme s'il n'existe pas deja...
179 GLuint p= read_program(filename, definitions);
181
182 PipelineProgram *program= new PipelineProgram {filename, definitions, p};
183 m_programs.push_back(program);
184 return program;
185 }
GLuint read_program(const char *filename, const char *definitions)
Definition program.cpp:218
int program_print_errors(const GLuint program)
affiche les erreurs de compilation.
Definition program.cpp:446

◆ manager()

PipelineCache & PipelineCache::manager ( )
inlinestatic

access au singleton.

Definition at line 188 of file draw.h.

189 {
190 static PipelineCache cache;
191 return cache;
192 }
PipelineCache()
constructeur prive.
Definition draw.h:196

Member Data Documentation

◆ m_programs

std::vector<PipelineProgram *> PipelineCache::m_programs
protected

Definition at line 198 of file draw.h.


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