KhronosGroup / KhronosGroup/GLSL
Possible ambiguity with continuations and #version
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 458
- Forks
- 114
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
In the GLSL 4.60 spec it states:
Lines separated by the line-continuation character preceding a new-line are concatenated
together before either comment processing or preprocessing.
The #version is processed as part of the preprocessing stage, which means I should be able to do:
#ver\
sion 460
This leads to the issue that continuations were not available before 4.20, so, we don't know we should process the continuation until we've parsed the version, but we can't parse the version until we've satisfied the continuation.
For context, GLSLang errors given the shader:
#ver\
sion 420
int main() {}
with:
ERROR: #version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above
ERROR: #version: statement must appear first in es-profile shader; before comments or newlines
ERROR: out/ver.comp.glsl:2: '#version' : must occur first in shader
ERROR: out/ver.comp.glsl:2: '#version' : bad profile name; use es, core, or compatibility
ERROR: out/ver.comp.glsl:2: '#version' : bad tokens following profile -- expected newline
ERROR: 4 compilation errors. No code generated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the cited GLSL 4.60 specification text and the reproduced shader using a split #version directive. Determine how continuation processing and version detection are intended to interact, then document an unambiguous specification outcome that resolves the reported contradiction and matches the observed diagnostics.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100