From bbaf061ae996e089f2364f74b213c67608b302d2 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 24 Apr 2015 08:38:04 +1000 Subject: [PATCH] Added printFileList to Shader, renamed old global function. --- src/graphics/shader.hpp | 20 ++++++++++++++++++++ src/graphics/shaders_util.hpp | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/graphics/shader.hpp b/src/graphics/shader.hpp index 466b242e5..4ba57160a 100644 --- a/src/graphics/shader.hpp +++ b/src/graphics/shader.hpp @@ -220,6 +220,26 @@ private: setUniformsImpl(arg...); } // setUniformsImpl + // ------------------------------------------------------------------------ + /** End recursion for variadic template. */ + template + void printFileList() + { + return; + } // printFileList + + // ------------------------------------------------------------------------ + /** Variadic template to print a list of file names. + * \param shader_type Ignored (used since the variadic calling function + * has this parameter). + * \param filepath Name of the file to print. + */ + template + void printFileList(GLint shader_type, const char *filepath, Types ... args) + { + Log::error("shader", filepath); + printFileList(args...); + } // printFileList public: diff --git a/src/graphics/shaders_util.hpp b/src/graphics/shaders_util.hpp index ab9862865..1a5638b9c 100644 --- a/src/graphics/shaders_util.hpp +++ b/src/graphics/shaders_util.hpp @@ -49,16 +49,16 @@ void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Type } template -void printFileList() +void oldPrintFileList() { return; } template -void printFileList(GLint ShaderType, const char *filepath, Types ... args) +void oldPrintFileList(GLint ShaderType, const char *filepath, Types ... args) { Log::error("GLWrapp", filepath); - printFileList(args...); + oldPrintFileList(args...); } enum AttributeType @@ -84,7 +84,7 @@ GLint LoadProgram(AttributeType Tp, Types ... args) glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result); if (Result == GL_FALSE) { Log::error("GLWrapp", "Error when linking these shaders :"); - printFileList(args...); + oldPrintFileList(args...); glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength); char *ErrorMessage = new char[InfoLogLength]; glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);