aboutsummaryrefslogtreecommitdiff
path: root/src/platform/opengl/shader.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
committerhachem <im@hachem.wtf>2026-09-22 06:57:16 +0200
commitd7c1ced08d5d78fcb239550404db4e67d4357a19 (patch)
tree9c0e218b096d138075cbf6a48e2562d33a8f94ed /src/platform/opengl/shader.cpp
parent270eda6f558c972ec86ad0580f1d3d18afc83a94 (diff)
fix: windows supportHEADmain
Diffstat (limited to 'src/platform/opengl/shader.cpp')
-rw-r--r--src/platform/opengl/shader.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/platform/opengl/shader.cpp b/src/platform/opengl/shader.cpp
index ca63c14..7319f8b 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
{
@@ -93,6 +95,13 @@ namespace Donut
in.read(&result[0], size);
}
}
+ else
+ {
+ std::error_code ec; // u8string: msvc's string() throws on a cwd outside the ANSI code page
+ 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;
}
@@ -140,7 +149,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()); // [0] on an empty vector trips msvc's debug STL
glDeleteShader(shader);
for (auto id : glShaderIDs)
glDeleteShader(id);
@@ -167,7 +176,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);