From 693f3c5d0e28ae5a5c6172b19f25891969db32fd Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Murcia Date: Mon, 4 Apr 2022 20:54:12 +0200 Subject: [PATCH] Added different PKGV versions to the list of supported packages, should fix #85 Added some extra logging to the shader compilation to have an easier debugging experience Signed-off-by: Alexis Maiquez Murcia --- src/WallpaperEngine/Assets/CPackage.cpp | 19 +++++++++++++------ .../Render/Objects/Effects/CPass.cpp | 5 +++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/WallpaperEngine/Assets/CPackage.cpp b/src/WallpaperEngine/Assets/CPackage.cpp index acc1763..e90b808 100644 --- a/src/WallpaperEngine/Assets/CPackage.cpp +++ b/src/WallpaperEngine/Assets/CPackage.cpp @@ -3,6 +3,7 @@ #include "CPackageLoadException.h" #include +#include using namespace WallpaperEngine::Assets; @@ -99,20 +100,26 @@ void CPackage::validateHeader (FILE* fp) char* pointer = this->readSizedString (fp); // finally validate the header version - if (strcmp ("PKGV0007", pointer) != 0 && + if (strcmp ("PKGV0001", pointer) != 0 && strcmp ("PKGV0002", pointer) != 0 && - strcmp ("PKGV0001", pointer) != 0 && - strcmp ("PKGV0008", pointer) != 0 && - strcmp ("PKGV0009", pointer) != 0 && + strcmp ("PKGV0003", pointer) != 0 && strcmp ("PKGV0004", pointer) != 0 && strcmp ("PKGV0005", pointer) != 0 && strcmp ("PKGV0006", pointer) != 0 && + strcmp ("PKGV0007", pointer) != 0 && + strcmp ("PKGV0008", pointer) != 0 && + strcmp ("PKGV0009", pointer) != 0 && + strcmp ("PKGV0010", pointer) != 0 && + strcmp ("PKGV0012", pointer) != 0 && strcmp ("PKGV0013", pointer) != 0 && strcmp ("PKGV0014", pointer) != 0 && - strcmp ("PKGV0015", pointer) != 0) + strcmp ("PKGV0015", pointer) != 0 && + strcmp ("PKGV0016", pointer) != 0) { + std::stringstream msg; + msg << "Unsupported package version: " << pointer; delete[] pointer; - throw std::runtime_error ("Unsupported package version"); + throw std::runtime_error (msg.str ()); } // free memory diff --git a/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp b/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp index f5a9c53..235b6da 100644 --- a/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp +++ b/src/WallpaperEngine/Render/Objects/Effects/CPass.cpp @@ -328,11 +328,12 @@ GLuint CPass::compileShader (Render::Shaders::Compiler* shader, GLuint type) // get information about the error glGetShaderInfoLog (shaderID, infoLogLength, nullptr, logBuffer); // throw an exception about the issue - std::string message = logBuffer; + std::stringstream buffer; + buffer << logBuffer << std::endl << "Compiled source code:" << std::endl << shader->getCompiled (); // free the buffer delete[] logBuffer; // throw an exception - throw std::runtime_error (message); + throw std::runtime_error (buffer.str()); } return shaderID;