AtomLinter / linter-glsl

Atom package that lints GLSL shaders on the fly.
https://atom.io/packages/linter-glsl
MIT License
15 stars 6 forks source link

"Unknown shader type" is output multiple times #27

Open karyon opened 8 years ago

karyon commented 8 years ago

I have a shader file with the file extension .glsl, because there are helper functions in there that we use in various places. There are two issues:

  1. glsl-linter (or the validator) doesn't validate it at all. I know it only validates known file extensions, but that seems quite inflexible.
  2. if i type in that file, i get the message "Unknown shader type" every two seconds, which is hugely annoying. i think once when opening the file would be enough :)
trusktr commented 8 years ago

I have the same problem. I'm using .glsl file extensions and linting doesn't work.

trusktr commented 8 years ago

What's ironic is that the image in the README is using also just the plain .glsl there, and not any of the more specific extensions listed in the table, but it is working!

trusktr commented 8 years ago

Oh, I see, _f.glsl means is can be anything_f.glsl (rather than ._f.glsl), so the table is confusing, because _f.glsl isn't specifically a "file extension" perse, it is the end of the file where the part before the extension ends in _f and then finally the .glsl extension.

trusktr commented 8 years ago

Are you using the specific cases of .glsl in order to highlight different things? Maybe you can also support files with any name, but using comments at the top for specifics.

// VERTEX_SHADER

void main(void) {
}
andystanton commented 8 years ago

Hi @trusktr

Thanks for your comments!

The linter is an interface to the official glslangValidator tool. glslangValidator only supports *.vert|frag|geom|comp|tese|tesc file extensions so it is not possible to support files not ending with these extensions. In order to lint the other formats (.f.glsl, _f.glsl, etc) I have to generate temporary files with the officially supported extension and pass these to glslangValidator.

As to the usage of comments to differentiate between linter types, it would certainly be possible to parse the contents of the shader first, but that would involve the linter package knowing anything about the contents of glsl files which is something I want to avoid. A better place to suggest this change might be in glslangValidator itself (link to GitHub repo).

The table in the readme appears under the header 'Supported Filename Formats' rather than 'Supported filename Extensions'. I disagree that it is confusing, but I wrote it, so perhaps you can suggest how it could be improved?

-Andy

andystanton commented 8 years ago

@karyon apologies for the slow response. I do agree that there is no point in the linter repeatedly telling you it can't do something, and it's on my todo list. Thank you for your patience!

agent-guardian commented 4 years ago

Bumping because this is still a problem.