Make sure no duplicated shader is added somewhere else
This commit is contained in:
parent
2a9656bfdc
commit
7ea4f30824
@ -356,12 +356,12 @@ public:
|
||||
glGetProgramiv(m_program, GL_LINK_STATUS, &Result);
|
||||
if (Result == GL_FALSE) {
|
||||
int info_length;
|
||||
Log::error("GLWrapp", "Error when linking these shaders :");
|
||||
Log::error("Shader", "Error when linking these shaders :");
|
||||
printFileList(args...);
|
||||
glGetProgramiv(m_program, GL_INFO_LOG_LENGTH, &info_length);
|
||||
char *error_message = new char[info_length];
|
||||
glGetProgramInfoLog(m_program, info_length, NULL, error_message);
|
||||
Log::error("GLWrapp", error_message);
|
||||
Log::error("Shader", error_message);
|
||||
delete[] error_message;
|
||||
}
|
||||
} // loadProgram
|
||||
|
@ -59,6 +59,13 @@ const std::string& ShaderFilesManager::getHeader()
|
||||
GLuint ShaderFilesManager::addShaderFile(const std::string &file,
|
||||
unsigned type)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Make sure no duplicated shader is added somewhere else
|
||||
std::unordered_map<std::string, GLuint>::const_iterator i =
|
||||
m_shader_files_loaded.find(file);
|
||||
assert(i == m_shader_files_loaded.end());
|
||||
#endif
|
||||
|
||||
GLuint id = glCreateShader(type);
|
||||
|
||||
std::ostringstream code;
|
||||
@ -214,7 +221,7 @@ GLuint ShaderFilesManager::addShaderFile(const std::string &file,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
GLuint ShaderFilesManager::getShaderFile(const std::string &file,
|
||||
unsigned type)
|
||||
unsigned type)
|
||||
{
|
||||
std::unordered_map<std::string, GLuint>::const_iterator i =
|
||||
m_shader_files_loaded.find(file);
|
||||
|
Loading…
Reference in New Issue
Block a user