fix: GLSL version directive never being applied#1221
Open
cedrik-fuoco-adsk wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Open
fix: GLSL version directive never being applied#1221cedrik-fuoco-adsk wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
cedrik-fuoco-adsk wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Conversation
2709d87 to
0919c18
Compare
…0 was placed inside #if __VERSION__ >= 150, but __VERSION__\ndefaults to 110 before any #version is processed, so the condition was\nalways false and shaders compiled as GLSL 110 on all contexts.\n\nInject #version 150 from C++ via glShaderSource string array so it\nbecomes the true first token as the spec requires. The existing\n#if __VERSION__ >= 150 guards in the shaders still handle GL2/GL3\nfeature selection correctly at runtime. Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
0919c18 to
67c2055
Compare
eloisebrosseau
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GLSL version directive never being applied
Linked issues
n/a
Summarize your change.
Remove
#version 150from inside#if __VERSION__ >= 150blocks in all TwkGLF shaders, and inject it from C++ viaglShaderSourceso it is the true first token in the concatenated shader source.BasicGLProgram.cpp: addedbasicGLVersionHeader()helper thatreturns
"#version 150\n"for GL3+ or""for GL2, and passes it asthe first element of a 2-string array to
glShaderSourcefor bothvertex and fragment shaders.
.glslfiles underTwkGLF/glsl/: removed the now-redundant#version 150line from inside the#if __VERSION__ >= 150block.The guards themselves are kept for GL2/GL3 feature selection.
Describe the reason for the change.
#versionmust be the first token in GLSL source per spec.The previous code placed
#version 150inside a#if __VERSION__ >= 150guardDescribe what you have tested and on which operating system.
Windows with AMD GPU.
Add a list of changes, and note any that might need special attention during the review.
If possible, provide screenshots.
N/A