Always add the #version pragma to shaders

Desktop / GNOME / COGL - Neil Roberts [linux.intel.com] - 2 September 2013 09:40 UTC

Previously we would only add the #version pragma to shaders when point sprite texture coordinates are enabled for a layer so that we can access the gl_PointCoord builtin. However I don't think there's any good reason not to just always request GLSL version 1.2 if it's available. That way applications can always use gl_PointCoord without having to enable point sprite texture coordinates.

This adds a glsl_version_to_use member to CoglContext which is used to generate the #version pragma as part of the shader boilerplate. On desktop GL this is set to 120 if version 1.2 is available, otherwise it is left at 110. On GLES it is always left as 100.

e4dfe8b Always add the #version pragma to shaders
cogl/cogl-context-private.h | 8 ++++++++
cogl/cogl-glsl-shader-private.h | 1 -
cogl/cogl-glsl-shader.c | 13 +++++++------
cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 18 ++----------------
cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 1 -
cogl/driver/gl/gl/cogl-driver-gl.c | 7 +++++++
cogl/driver/gl/gles/cogl-driver-gles.c | 1 +
7 files changed, 25 insertions(+), 24 deletions(-)

Upstream: developer.gnome.org


  • Share