jshrake / jshrake/glsl-include
#version directive in included files is problematic
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Consider
// A.glsl
#version 410
// main.glsl
#version 410
#include <A.glsl>
void main() {}
will generate
// main.glsl
#version 410
#version 410
void main() {}
This is problematic, since the #version directive should only appear once. Furthermore, from https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Version:
The #version directive must appear before anything else in a shader, save for whitespace and comments. If a #version directive does not appear at the top, then it assumes 1.10, which is almost certainly not what you want.
Contributor guide
No contributing guide indexed for this repository
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
Use the A.glsl and main.glsl reproduction as the starting case, then locate the library entry point that expands #include directives. Add a regression test covering both files and verify that the generated shader contains only one #version directive while preserving the included content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100