Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a lint tool for OpenGL Shading Language?

I've started working with OpenGL and writing shaders. My app checks for errors after loading and compiling shader programs, and if there is a problem it prints out the info log. This is great for catching errors (and I'm a newbie so I'm making a lot), but what I'd really like is to catch these errors at build time.

If I had a lint tool that could simply check a vertex or fragment shader for syntax errors, I could add it to my build process and have it stop the build.

I haven't been able to find such a tool. I started to try to write one, but I'm working on OpenGL ES and had trouble trying to write a desktop program that links against the ES libraries.

Maybe I missed it somewhere. Does such a tool exist?

like image 707
benzado Avatar asked Oct 24 '10 19:10

benzado


People also ask

What shading language does OpenGL use?

The OpenGL Shading Language (GLSL) is the principal shading language for OpenGL. While, thanks to OpenGL Extensions, there are several shading languages available for use in OpenGL, GLSL (and SPIR-V) are supported directly by OpenGL without extensions. GLSL is a C-style language.

Can OpenGL use SPIR-V?

Support for SPIR-V shader binaries was added to OpenGL core with version 4.6, but is also available via the ARB_gl_spirv extension for earlier OpenGL versions. Currently, the Khronos Group provides a reference compiler for compiling GLSL to SPIR-V. It is available on GitHub at https://github.com/KhronosGroup/glslang.

Does OpenGL support HLSL?

The GLSL that is referred to herein is compatible with OpenGL ES 2.0; the HLSL is compatible with Direct3D 11.

Is GLSL the same as OpenGL?

The short version is: OpenGL is an API for rendering graphics, while GLSL (which stands for GL shading language) is a language that gives programmers the ability to modify pipeline shaders. To put it another way, GLSL is a (small) part of the overall OpenGL framework.


2 Answers

You can build shaders on the command line, the same way as you compile your c or c++ program or whatever you are using. If you are using Makefile, just add the compilation of the shaders.

You can use Cg compiler to compile both Cg and GLGL shaders. It should be available on all platforms.

like image 133
BЈовић Avatar answered Oct 23 '22 14:10

BЈовић


Also, there's the reference GLSL compiler (handles OpenGL and OpenGL ES)

http://www.khronos.org/opengles/sdk/tools/Reference-Compiler/

like image 29
Marcus O Platts Avatar answered Oct 23 '22 15:10

Marcus O Platts