Skip to content

GLSL: Fix the documentation again

By passing the version and profile down the newly introduced new_default_*_with_vp functions proper default stages can be created to accompany custom (usually fragment) shaders on a different version.

In addition attribute and varying are replaced with in/out when the version allows it (GLSL >= 1.3 except GL ES 3.x).

Note that existing functionality of new_default_* should not be affected; a version of None generates no #version string. Prior users of gst_gl_shader_string_fragment_get_default will have a hard time if they are prepending this already, but they probably wondered in the first place why a version and profile had to be passed down without seeing a resulting #version.

Note2: GLSL 1.00 needs a precision annotation too, which is a pretty ugly change (last commit). Otherwise I've been able to compile+link a vertex and fragment shader on all versions.

I'm not satisfied with the naming yet. Suggestions to replace _with_vp (but isn't massively longer) are welcome. _new_default_*_version_profile?

These changes were initially written to create a default vertex shader accompanying a fragment shader using >= 4.3 functionality, without copying it to my own program with #version annotation in spite of getting error: all shaders must use same shading language version. Joke's on me, I can't reproduce this anymore and an unversioned or randomly versioned vertex shader with 4.3 fragment shader links fine. I still hope anyone finds this useful or is able to point out my oversight.

Edited by Marijn Suijten

Merge request reports

Loading