graphitemaster / glsl-parser

A GLSL parser
MIT License
257 stars 30 forks source link

Built-in gl variables appear as not declared #12

Closed ralucado closed 4 years ago

ralucado commented 5 years ago

When using a built-in variable like gl_Position a "not declared in this scope" error appears. This should not happen since all these variables are automatically defined in the shaders in openGL.

baryluk commented 4 years ago

That really depends on many factors. Like version of OpenGL / WebGL and GLSL used. It might even depend on which shader type it is, or what options are used. Also GLSL shaders can even be used in Vulkan, and again these variables often are different, named differently, and might have slightly different semantic.

Probably best option is for you to prepend these implicit variables before parsing, or setup the state in parser so they do exist.