Skip to content

Commit

Permalink
Added different PKGV versions to the list of supported packages, should
Browse files Browse the repository at this point in the history
fix #85

Added some extra logging to the shader compilation to have an easier debugging experience

Signed-off-by: Alexis Maiquez Murcia <[email protected]>
  • Loading branch information
Almamu committed Apr 4, 2022
1 parent aa3db15 commit 693f3c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
19 changes: 13 additions & 6 deletions src/WallpaperEngine/Assets/CPackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "CPackageLoadException.h"

#include <utility>
#include <sstream>

using namespace WallpaperEngine::Assets;

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/WallpaperEngine/Render/Objects/Effects/CPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 693f3c5

Please sign in to comment.