BabylonJS / BabylonJS/BabylonNative
Shader compile errors carry no message: WEBMIN strips glslang's diagnostics
- Dominant language
- C++
- Stars
- 919
- Forks
- 162
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 19
Description
## Problem
Every failing shader compile reports only:
```
ERROR: 3 compilation errors. No code generated.
```
No file, line, or reason. The failing construct can only be found by bisecting the shader source.
## Cause
`Dependencies/CMakeLists.txt` sets `ENABLE_GLSLANG_WEBMIN ON` (and `ENABLE_GLSLANG_WEBMIN_DEVEL OFF`). `ENABLE_GLSLANG_WEBMIN` defines `GLSLANG_WEB` on the glslang targets (`glslang/CMakeLists.txt:279-283`), and `ParseHelper.h:107` guards the diagnostic emitters on it:
```cpp
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
virtual void C_DECL error(const TSourceLoc&, const char* szReason, ...);
virtual void C_DECL warn(...);
virtual void C_DECL ppError(...);
virtual void C_DECL ppWarn(...);
#endif
```
The error *count* still increments, so failures are detected — only the text is discarded.
## Impact
Shader authors and anyone debugging the ShaderCompiler get no actionable output. This cost real time while investigating #1818, where the failing constructs were identifiable only by bisection.
Same shape as the `SPIRV_CROSS_WEBMIN` opcode stripping already noted in #1808: a size-optimised dependency silently discarding diagnostics.
## Options
- Turn on `GLSLANG_WEB_DEVEL` — restores the text, costs binary size.
- Restore just the message text in the `BabylonJS/glslang` fork without the rest of the DEVEL surface.
- Enable diagnostics only in `Debug`/`RelWithDebInfo`, keeping `Release` minimal.
Worth deciding against measured size numbers rather than assumption; the same question applies to the spirv-cross fork.
---
[Filed by Copilot on behalf of @bghgary]
Contributor guide
Research direction
Read Dependencies/CMakeLists.txt, glslang/CMakeLists.txt around lines 279-283, and ParseHelper.h around line 107 to confirm how WEBMIN removes diagnostic emitters. Compare the listed options using measured binary-size impact; done means shader failures report actionable file, line, and reason information without an unacceptable size increase.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100