glsl: Enable GLSL 1.30 if we have OpenGL 3.0/3.1
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 13 Apr 2022 18:54:40 +0000 (14:54 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 2 May 2022 19:10:43 +0000 (19:10 +0000)
As implemented, we only support OpenGL 3 API from version 3.2. Though, there
is no issue enabling GLSL 1.30 even if we are going to restrict our API usage
to 2. This allows using texelFetch() on OpenGL 3.0 and 3.1 drivers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2190>

subprojects/gst-plugins-base/gst-libs/gst/gl/gstglsl.c

index ce01a6c..63dbcb7 100644 (file)
@@ -897,7 +897,12 @@ _mangle_version_profile_from_gl_api (GstGLContext * context,
       *profile = GST_GLSL_PROFILE_ES;
     }
   } else if (gl_api & GST_GL_API_OPENGL) {
-    *version = GST_GLSL_VERSION_110;
+    /* We only use GST_GL_API_OPENGL3 from 3.1, but nothing prevents us from
+     * using 3.0/1.30 GLSSL with GL2 API */
+    if (gl_major >= 3)
+      *version = GST_GLSL_VERSION_130;
+    else
+      *version = GST_GLSL_VERSION_110;
     *profile = GST_GLSL_PROFILE_COMPATIBILITY;
   }
 }