aboutsummaryrefslogtreecommitdiff
path: root/src/platform/opengl/shader.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-24 18:28:39 +0200
committerhachem <im@hachem.wtf>2026-08-24 18:28:39 +0200
commita34c49f103c8950a57687ea3d866c244d95b4414 (patch)
treeff268f4a7f52769a252443d6f2822c9814e3bb1c /src/platform/opengl/shader.cpp
parent06398a7a176e123506de6e8851866a8bec0b3427 (diff)
[docs]: added a few comments cause i wont be able to read this in a week's time
Diffstat (limited to 'src/platform/opengl/shader.cpp')
-rw-r--r--src/platform/opengl/shader.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/platform/opengl/shader.cpp b/src/platform/opengl/shader.cpp
index 80015e6..757382b 100644
--- a/src/platform/opengl/shader.cpp
+++ b/src/platform/opengl/shader.cpp
@@ -19,8 +19,8 @@ namespace Donut
return 0;
}
- // Shaders are authored in Slang and compiled to assets/shaders/generated/
- // <name>.glsl by tools/compile-shaders.sh. Given a legacy ".../<name>.glsl"
+ // shaders are authored in Slang and compiled to assets/shaders/generated/
+ // <name>.glsl by tools/compile-shaders.sh. given a legacy ".../<name>.glsl"
// path, prefer that generated file when present; otherwise fall back to the
// hand-written GLSL (e.g. shaders not yet ported to Slang).
static std::string ResolveShaderPath(const std::string& filepath)
@@ -145,9 +145,9 @@ namespace Donut
glDeleteShader(id);
glDeleteProgram(program);
m_renderer_id = 0;
- // info_log.data() is null when the driver returns an empty log
- // (e.g. macOS rejecting a compute shader); streaming a null
- // char* into std::cout calls strlen(NULL) and crashes.
+ // info_log.data() is null when the driver hands back an empty log
+ // (e.g. macOS rejecting a compute shader). streaming a null char*
+ // into std::cout does strlen(NULL) and just explodes. cool cool cool.
const char* log = info_log.empty() ? "" : info_log.data();
std::cout << "Shader compilation failure!" << std::endl << log << std::endl;
return;
@@ -278,9 +278,9 @@ namespace Donut
auto Shader::dispatch(uint32_t x, uint32_t y, uint32_t z) -> void
{
- // Compute shaders require OpenGL 4.3+. On drivers that cap out earlier
- // (e.g. macOS, which is frozen at 4.1) glDispatchCompute is never
- // loaded and the pointer is null. Guard so we no-op instead of crash.
+ // compute shaders want OpenGL 4.3+ and macOS is frozen at 4.1, so
+ // glDispatchCompute never even loads and the pointer is null. guard it
+ // and quietly no-op instead of face-planting.
if (m_renderer_id == 0 || glDispatchCompute == nullptr)
return;
glDispatchCompute(x, y, z);