diff options
| author | hachem <im@hachem.wtf> | 2026-09-22 06:45:33 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-22 06:45:33 +0200 |
| commit | 32ee3d9f57b37723ee97c3b798be6968f98df1b1 (patch) | |
| tree | 10838a06f522a48f64645e2d31c3d72eb1a58643 /src/platform/opengl/shader.cpp | |
| parent | e321beb543311dcb591942ec42464e38cbeae0f0 (diff) | |
fix: windows support
Diffstat (limited to 'src/platform/opengl/shader.cpp')
| -rw-r--r-- | src/platform/opengl/shader.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/platform/opengl/shader.cpp b/src/platform/opengl/shader.cpp index b815021..21335dd 100644 --- a/src/platform/opengl/shader.cpp +++ b/src/platform/opengl/shader.cpp @@ -6,6 +6,8 @@ #include <fstream> #include <iostream> #include <vector> +#include <filesystem> +#include "core/log.h" namespace Donut { @@ -89,6 +91,13 @@ namespace Donut in.read(&result[0], size); } } + else + { + std::error_code ec; + const auto cwd = std::filesystem::current_path(ec).u8string(); + DONUT_ERROR("shader file not found: {} (cwd {}; generated shaders live in assets/shaders/generated)", + filepath, std::string(cwd.begin(), cwd.end())); + } return result; } @@ -136,7 +145,7 @@ namespace Donut int max_length = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &max_length); std::vector<char> info_log(max_length); - glGetShaderInfoLog(shader, max_length, &max_length, &info_log[0]); + if (max_length > 0) glGetShaderInfoLog(shader, max_length, &max_length, info_log.data()); glDeleteShader(shader); for (auto id : glShaderIDs) glDeleteShader(id); @@ -160,7 +169,7 @@ namespace Donut int max_length = 0; glGetProgramiv(m_renderer_id, GL_INFO_LOG_LENGTH, &max_length); std::vector<char> info_log(max_length); - glGetProgramInfoLog(m_renderer_id, max_length, &max_length, &info_log[0]); + if (max_length > 0) glGetProgramInfoLog(m_renderer_id, max_length, &max_length, info_log.data()); glDeleteProgram(m_renderer_id); for (auto id : glShaderIDs) glDeleteShader(id); |
