[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    gst-plugins-bad: glshader: add glBindFragDataLocation
From:       ystreet () kemper ! freedesktop ! org (Matthew Waters)
Date:       2016-03-31 10:17:06
Message-ID: 20160331101706.F0359761E0 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: master
Commit: d38587c142e8fec0671c5aed32097d7ce5abfd71
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=d38587c142e8fec0671c5aed32097d7ce5abfd71


Author: Matthew Waters <matthew@centricular.com>
Date:   Thu Mar 31 19:25:32 2016 +1100

glshader: add glBindFragDataLocation

There are some cases where it's needed for binding in/out variables in shaders.
e.g. glsl 150 (gl 3.2) doesn't support the 'layout (location = ?)' specifiers in
the shader source so we have to bind them ourselves.

---

 gst-libs/gst/gl/glprototypes/shaders.h | 10 ++++++++++
 gst-libs/gst/gl/gstglshader.c          | 20 ++++++++++++++++++++
 gst-libs/gst/gl/gstglshader.h          |  1 +
 3 files changed, 31 insertions(+)

diff --git a/gst-libs/gst/gl/glprototypes/shaders.h \
b/gst-libs/gst/gl/glprototypes/shaders.h index 817e479..6d828db 100644
--- a/gst-libs/gst/gl/glprototypes/shaders.h
+++ b/gst-libs/gst/gl/glprototypes/shaders.h
@@ -362,3 +362,13 @@ GST_GL_EXT_FUNCTION (void, UniformMatrix3x4fv,
 GST_GL_EXT_FUNCTION (void, UniformMatrix4x3fv,
                      (GLint location, GLsizei count, GLboolean transpose, const \
GLfloat *value))  GST_GL_EXT_END ()
+
+GST_GL_EXT_BEGIN (bind_frag_data,
+                  GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
+                  3, 0,
+                  255, 255,
+                  "\0",
+                  "\0")
+GST_GL_EXT_FUNCTION (void, BindFragDataLocation,
+                     (GLuint program, GLuint index, const GLchar * name))
+GST_GL_EXT_END ()
diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c
index 9d96784..9f09236 100644
--- a/gst-libs/gst/gl/gstglshader.c
+++ b/gst-libs/gst/gl/gstglshader.c
@@ -1306,3 +1306,23 @@ gst_gl_shader_bind_attribute_location (GstGLShader * shader, \
GLuint index,  
   gl->BindAttribLocation (priv->program_handle, index, name);
 }
+
+void
+gst_gl_shader_bind_frag_data_location (GstGLShader * shader,
+    guint index, const gchar * name)
+{
+  GstGLShaderPrivate *priv;
+  GstGLFuncs *gl;
+
+  g_return_if_fail (shader != NULL);
+  if (!_ensure_program (shader))
+    g_return_if_fail (shader->priv->program_handle);
+  priv = shader->priv;
+  gl = shader->context->gl_vtable;
+  g_return_if_fail (gl->BindFragDataLocation);
+
+  GST_TRACE_OBJECT (shader, "binding program %i frag data \'%s\' location %i",
+      (int) priv->program_handle, name, index);
+
+  gl->BindFragDataLocation (priv->program_handle, index, name);
+}
diff --git a/gst-libs/gst/gl/gstglshader.h b/gst-libs/gst/gl/gstglshader.h
index 21410e2..2200b89 100644
--- a/gst-libs/gst/gl/gstglshader.h
+++ b/gst-libs/gst/gl/gstglshader.h
@@ -104,6 +104,7 @@ void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, \
const gchar *n  
 gint gst_gl_shader_get_attribute_location  (GstGLShader *shader, const gchar *name);
 void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const \
gchar * name); +void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, \
guint index, const gchar * name);  
 G_END_DECLS
 

_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic