Nux

Code review comment for lp:~linaro-graphics-wg/nux/nux-1.0-gles2

Revision history for this message
Jay Taoko (jaytaoko) wrote :

> I removed the #version lines because GLES GLSL uses different versions than GL
> GLSL even if they support the same features. I also removed them from unity so
> there should be no problems caused by that. The only solution that would allow
> keeping the #version lines is to #ifdef them in C++ so the correct version is
> generated depending on what you are compiling for but it didn't seem
> worthwhile.
>
> There is no specific GLSL compiler for intel so I assume you mean mesa here.
> Mesa's GLSL compiler certainly supports #ifdef and I've been using the mesa GL
> and GLES stacks with an intel GPU while testing.
>
> These are only invalidated in the GLES codepath, do you mean I should remove
> them in a different way?

It is just from a brief experience that I am talking about with macros in GLSL shaders with the open source driver. Lets assume for now that all is fine.
Since #version must appear before anything else in the shader code (except for comment and white space, we can't do something like this:

#ifndef GL_ES
    #version 110
#else
    precision mediump float;
#endif

The solution, as you said, is to use C++ pre-processors to select the proper code in the shader string. Unless the body of the shaders in OpenGL and OpenGL ES start to diverge, we don't need to create a special text strings for GL ES shaders.

« Back to merge proposal