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 <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez Murcia 2022-04-04 20:54:12 +02:00
parent aa3db15ec6
commit 693f3c5d0e
2 changed files with 16 additions and 8 deletions

View File

@ -3,6 +3,7 @@
#include "CPackageLoadException.h"
#include <utility>
#include <sstream>
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

View File

@ -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;