-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Controlling the extension with comments #15
Comments
Nice idea! If I understand correctly the include case is special, because here I would have to replace everything inside the quotation marks with the code behind the "//!", but otherwise it should be a removal of "//!" and what remains should be valid code. Do I understand this correctly? |
Yes, you got that right. And btw: I really like that you chose to create a proper GL Context to check errors. Atom's glsl-linter only uses the reference compiler, which leaves no hope for many things. |
Thanks! I'm still thinking about the |
Yes, I think your idea will suffice. And it is certainly easier to implement. |
Ok. I think I have a working implementation. I will push it after updating the readme. Are you ok if I take some of your explanation text from above for an updated readme? |
Yes, that's okay |
When developing shaders, it is common to split one shader into multiple files, reuse files, and generally generate some parts of Code in the application in order to make things easier.
Unfortunately, this does not go well with extensions like this that compile these files without any knowledge about what happens on the side of the application. Thus, I propose to add functionality to accomodate these issues. Ultimately, this will be comments that are transformed into Code before compiling.
Shader includes
When using shader includes (either using the GLSL extension or by manually processing shaders), things can get wrong. Especially when using the GLSL extension, the path inside the Shader may not actually map to the filesystem on disk:
I thus propose to be able to add the real location to that file in a comment, like so:
Instead of a
!
, any kind of identifier could be used.Using this, you could load the referenced include when compiling, which will then not produce errors.
Missing version, work group size, defines...
Sometimes, we may only add
#version
, compute work group sizes or some defines used in a shader from the application, without writing it in the actual source. It would be nice if we could specify these inside of comments, such that this extension can use these and compile without errors, e.g.:A note on
!
It would probably be a good idea to have two different identifiers, e.g.
!
and?
.!
would always be expanded to code, while?
would only be expanded if the file being compiled has not been included, e.g.:File A.glsl
File B.glsl
The text was updated successfully, but these errors were encountered: