ensemble de shader programs compiles. singleton.
More...
#include <program.h>
|
| PipelineProgram * | find (const char *filename, const char *definitions="") |
| | renvoie un shader program compile. et l'ajoute dans le cache, si necessaire...
|
| PipelineProgram * | find (const GLuint program, const char *filename, const char *definitions="") |
| | renvoie un shader program compile. et l'ajoute dans le cache, si necessaire...
|
| PipelineProgram * | reload (const GLuint program, const char *definitions="") |
| | recharge et recompile un programme du cache.
|
| void | reload () |
| | recompile tous les shaders. du cache.
|
| void | dump () |
|
| | PipelineCache () |
| | constructeur prive.
|
| PipelineProgram * | insert (const char *filename, const char *definitions="") |
| | compile un shader et l'ajoute au cache.
|
| PipelineProgram * | insert (const GLuint program, const char *filename, const char *definitions="") |
| | ajoute un shader dans le cache.
|
ensemble de shader programs compiles. singleton.
Definition at line 59 of file program.h.
◆ ~PipelineCache()
| PipelineCache::~PipelineCache |
( |
| ) |
|
|
inline |
Definition at line 62 of file program.h.
63 {
64 printf(
"[pipeline cache] %d programs.\n",
int(m_programs.size()));
65
66
67
68
69 for(auto& cache : m_programs)
70 delete cache;
71 }
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().
◆ PipelineCache()
| PipelineCache::PipelineCache |
( |
| ) |
|
|
inlineprotected |
constructeur prive.
Definition at line 155 of file program.h.
◆ find() [1/2]
| PipelineProgram * PipelineCache::find |
( |
const char * | filename, |
|
|
const char * | definitions = "" ) |
|
inline |
renvoie un shader program compile. et l'ajoute dans le cache, si necessaire...
Definition at line 74 of file program.h.
75 {
76
77 for(auto cache : m_programs)
78 {
79 if(cache->filename == filename && cache->definitions == definitions)
80 return cache;
81 }
82
83 return insert(filename, definitions);
84 }
PipelineProgram * insert(const char *filename, const char *definitions="")
compile un shader et l'ajoute au cache.
◆ find() [2/2]
| PipelineProgram * PipelineCache::find |
( |
const GLuint | program, |
|
|
const char * | filename, |
|
|
const char * | definitions = "" ) |
|
inline |
renvoie un shader program compile. et l'ajoute dans le cache, si necessaire...
Definition at line 87 of file program.h.
88 {
89 for(auto cache : m_programs)
90 {
91 if(cache->program == program && cache->filename == filename && cache->definitions == definitions)
92 return cache;
93 }
94
95 return insert(program, filename, definitions);
96 }
◆ reload() [1/2]
| PipelineProgram * PipelineCache::reload |
( |
const GLuint | program, |
|
|
const char * | definitions = "" ) |
|
inline |
recharge et recompile un programme du cache.
Definition at line 99 of file program.h.
100 {
101 int update_program( const GLuint program, const char *filename, const char *definitions );
102
103 for(auto cache : m_programs)
104 {
105 if(cache->program == program)
106 {
107 if(definitions && definitions[0])
108
109 cache->definitions= definitions;
110
111
112 update_program(program, cache->filename.c_str(), cache->definitions.c_str());
114 return cache;
115 }
116 }
117
118
119 return nullptr;
120 }
int program_print_errors(const GLuint program, const char *filename="")
affiche les erreurs de compilation.
◆ reload() [2/2]
| void PipelineCache::reload |
( |
| ) |
|
|
inline |
recompile tous les shaders. du cache.
Definition at line 123 of file program.h.
124 {
125 int update_program( const GLuint program, const char *filename, const char *definitions );
126
127 for(auto cache : m_programs)
128 {
129 update_program(cache->program, cache->filename.c_str(), cache->definitions.c_str());
131 }
132 }
◆ dump()
| void PipelineCache::dump |
( |
| ) |
|
|
inline |
Definition at line 135 of file program.h.
136 {
137 for(unsigned i= 0; i < m_programs.size(); i++)
138 {
139 PipelineProgram *cache= m_programs[i];
140 printf(
"[%d] '%s'\n", i, cache->filename.c_str());
141 if(!cache->definitions.empty())
142 printf(
" %s\n", cache->definitions.c_str());
143 }
144 }
◆ manager()
acces au singleton.
Definition at line 147 of file program.h.
148 {
150 return cache;
151 }
PipelineCache()
constructeur prive.
◆ insert() [1/2]
| PipelineProgram * PipelineCache::insert |
( |
const char * | filename, |
|
|
const char * | definitions = "" ) |
|
inlineprotected |
compile un shader et l'ajoute au cache.
Definition at line 158 of file program.h.
159 {
160 int update_program( const GLuint program, const char *filename, const char *definitions );
161
162
163 GLuint program= glCreateProgram();
164 update_program(program, filename, definitions);
166
167 return insert(program, filename, definitions);
168 }
◆ insert() [2/2]
| PipelineProgram * PipelineCache::insert |
( |
const GLuint | program, |
|
|
const char * | filename, |
|
|
const char * | definitions = "" ) |
|
inlineprotected |
ajoute un shader dans le cache.
Definition at line 171 of file program.h.
172 {
173 PipelineProgram *cache= new PipelineProgram { filename, definitions, program };
174 m_programs.push_back(cache);
175
176 return cache;
177 }
◆ m_programs
The documentation for this class was generated from the following file: