Re: Cross platform GLSL (ES)?
Posted by io7m on Dec 13, 2013; 6:56pm
URL: https://forum.jogamp.org/Cross-platform-GLSL-ES-tp4030871p4030889.html
Additionally, ES2 (GLSL ES 1.0) has restrictions on the types that can be used as attributes. Specifically:
"The attribute qualifier can be used only with the data types float, vec2, vec3, vec4, mat2, mat3, and
mat4. Attribute variables cannot be declared as arrays or structures."
From the GLSL ES 1.0 spec, section 4.3.3.
Also, GLSL ES 1.0 doesn't allow for multiple fragment shader outputs (specifically, it restricts the number of
possible framebuffer color attachments to 1), so any shaders that use multiple outputs
there have to be rewritten. In GLSL <= 1.20, writing to multiple fragment shader outputs meant writing
to gl_FragData[0 .. n]. This will still work in GLSL ES 1.0, but the gl_FragData array will consist of only one
element. In 1.30, outputs have to be declared as "out" parameters and then associated with
a specific "location" with glBindFragDataLocation. In GLSL 1.40 and above, "out" parameters can be assigned
specific locations with the location directive. For example: "layout(location = 0) out vec4 output". In ES3,
the situation is the same as GLSL 1.40 and above.