platform agnostic GLSL code validation

Hi everyone,

I often get bitten by the NVidia drivers GLSL permissivity : I often make small mistakes, such as implicit types conversions, like ‘pow(color.rgb, 2.0)’ which is non conform, and thus should not compile - NVidia compiler tend to let these ‘errors’ pass.

It brings me problems when switching my platform, and compiling GLSL code on AMD, which is not so tolerant.

I was wondering how you did handle your GLSL code validation ? Is there a tool out there that could ‘objectively’ validate GLSL syntax ?

I’m aware of 3DLabs “GLSL Validate”, but I believe it’s not maintained any more. MESA could be a candidate, but I don’t think there’s a standalone executable that compiles GLSL.

Cheers,
Nicolas.

MESA could be a candidate, but I don’t think there’s a standalone executable that compiles GLSL.

go to “Stand-alone GLSL Compiler” here :
http://www.mesa3d.org/shading.html

(I did not test it)

Thanks for the tip ! looks promising ! anyone has some experience to share about this compiler ?

Personally I find that where NV has deviated a bit from the letter of the spec a welcome addition was realized. The implicit casting/coercion stuff as you may recall was mightily stringent at one point and eventually relaxed to the benefit of us “all”.

Sometimes the boat has to rocked a little to make progress, IMHO. Sometimes you just gotta shake things up a bit.

I find that where NV has deviated a bit from the letter of the spec a welcome addition was realized.

Embrace, extend, extinguish.

Being lax about a specification encourages NVIDIA to turn OpenGL into NVIDIA_GL. This is good for noone save NVIDIA.

I think there comes a time when you have to take your case to the people. A dark, smoky conference room is perhaps no place to decide the fate of an API. If you can’t realize your vision through regular channels I see nothing wrong with making a case to a public that, for the most part, has been only too willing to embrace the changes and additions put forward, bemoaning mostly if not exclusively the lack of widespread availability or the untimeliness of core adoption.

Bring on the good ideas. Don’t care where they come from.

I cannot say I fully fathom how willing you seem to be to deliver OpenGL fully into NVIDIAs control.

Ideas are one thing. A path that leads to OpenGL being a platform for NVIDIAs API is quite another. The bindless API NVIDIA invented is another step towards this. This is Microsoft’s playbook, and it is incumbent upon us as OpenGL users not to submit to it.

It’s not as though bindless graphics is an evil plot to destroy the world, like Hulu is. Hulu must be stopped.

The NVidia deviation from the strict spec may be a good extension. But, in my case, I have clients and shipping products, and not everyone is having an NVidia board in their machine.

The only way I currently have, to check GLSL shader compliance, is to switch video cards or machine.

IMHO such a tool would be a welcome addition to the ‘official’ OpenGL SDK.

Wait, doesn’t Cgc already do that - with the “-strict” cmdline parameter?

Try the NVEmulate tool from the Nvidia site. There is an option in there called “Generate Shader Portability Errors” which checks strict GLSL compliance and disallows the implicit Nvidia extensions.

This is probably the same thing that Ilian suggests, but without directly using cgc.

On that thread, with the NVidia drivers, if you put a “#version 110”, “#version 120”, etc. (presumably anything >= 110) at the top of your GLSL source, NVidia marks things previously treated as just portability warnings as hard errors. Google NVidia GLSL release notes for details. You get this even without NVEmulate.