[624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL

use GstGLAPI to determine which code paths to execute.
perform some cleanups
This commit is contained in:
Matthew Waters 2012-12-06 18:40:26 +11:00 committed by Tim-Philipp Müller
parent ee992ec531
commit 344253e860
13 changed files with 1810 additions and 1097 deletions

View file

@ -55,7 +55,8 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
gstglshadervariables.h \
gstglshader.h \
gstgldownload.h \
gstglupload.h
gstglupload.h \
gstglapi.h
libgstgl_@GST_API_VERSION@_la_CFLAGS = \
$(GL_CFLAGS) \

File diff suppressed because it is too large Load diff

View file

@ -25,8 +25,11 @@
#include <gst/video/video.h>
typedef struct _GstGLUpload GstGLUpload;
typedef struct _GstGLDownload GstGLDownload;
typedef struct _GstGLShader GstGLShader;
#include "gstglwindow.h"
#include "gstglrenderer.h"
#include "gstglshader.h"
#include "gstglupload.h"
#include "gstgldownload.h"
@ -34,18 +37,19 @@
G_BEGIN_DECLS
GType gst_gl_display_get_type (void);
#define GST_TYPE_GL_DISPLAY (gst_gl_display_get_type())
#define GST_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY,GstGLDisplay))
#define GST_GL_TYPE_DISPLAY (gst_gl_display_get_type())
#define GST_GL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_GL_TYPE_DISPLAY,GstGLDisplay))
#define GST_GL_DISPLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GL_DISPLAY,GstGLDisplayClass))
(G_TYPE_CHECK_CLASS_CAST((klass),GST_GL_TYPE_DISPLAY,GstGLDisplayClass))
#define GST_IS_GL_DISPLAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY))
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_GL_TYPE_DISPLAY))
#define GST_IS_GL_DISPLAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GL_DISPLAY))
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_GL_TYPE_DISPLAY))
#define GST_GL_DISPLAY_CAST(obj) ((GstGLDisplay*)(obj))
typedef struct _GstGLDisplay GstGLDisplay;
typedef struct _GstGLDisplayClass GstGLDisplayClass;
typedef struct _GstGLDisplayPrivate GstGLDisplayPrivate;
/**
* GstGLDisplayConversion:
@ -139,6 +143,9 @@ struct _GstGLDisplay
GstGLWindow *gl_window;
gboolean isAlive;
/* gl API we are using */
GstGLAPI gl_api;
/* conditions */
GCond *cond_create_context;
GCond *cond_destroy_context;
@ -152,10 +159,10 @@ struct _GstGLDisplay
GLuint redisplay_texture_width;
GLuint redisplay_texture_height;
gboolean keep_aspect_ratio;
#ifdef OPENGL_ES2
#if HAVE_GLES2
GstGLShader *redisplay_shader;
gchar *redisplay_vertex_shader_str;
gchar *redisplay_fragment_shader_str;
gchar *redisplay_vertex_shader_str_gles2;
gchar *redisplay_fragment_shader_str_gles2;
GLint redisplay_attr_position_loc;
GLint redisplay_attr_texture_loc;
#endif
@ -214,6 +221,8 @@ struct _GstGLDisplay
GstGLShader *del_shader;
gchar *error_message;
GstGLDisplayPrivate *priv;
};
@ -277,6 +286,8 @@ void gst_gl_display_check_framebuffer_status (void);
void gst_gl_display_lock (GstGLDisplay * display);
void gst_gl_display_unlock (GstGLDisplay * display);
GstGLAPI gst_gl_display_get_gl_api (GstGLDisplay * display);
GstGLAPI gst_gl_display_get_gl_api_unlocked (GstGLDisplay * display);
G_END_DECLS

File diff suppressed because it is too large Load diff

View file

@ -24,8 +24,8 @@
#include <gst/video/video.h>
#include <gst/gstmemory.h>
#include "gstglshader.h"
#include "gstgldisplay.h"
#include "gstglshader.h"
G_BEGIN_DECLS
@ -43,6 +43,7 @@ GType gst_gl_download_get_type (void);
typedef struct _GstGLDownload GstGLDownload;
typedef struct _GstGLDownloadClass GstGLDownloadClass;
typedef struct _GstGLDownloadPrivate GstGLDownloadPrivate;
/**
* GstGLDownload
@ -74,10 +75,10 @@ struct _GstGLDownload
GLuint in_texture;
GLuint out_texture[GST_VIDEO_MAX_PLANES];
GstGLShader *shader;
#ifdef OPENGL_ES2
GLint shader_attr_position_loc;
GLint shader_attr_texture_loc;
#endif
GstGLDownloadPrivate *priv;
gpointer _reserved[GST_PADDING];
};
@ -97,12 +98,12 @@ struct _GstGLDownloadClass
*
* The currently supported formats that can be downloaded
*/
#ifndef OPENGL_ES2
#if !HAVE_GLES2
# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \
"xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }"
#else /* OPENGL_ES2 */
#else /* HAVE_GLES2 */
# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }"
#endif /* !OPENGL_ES2 */
#endif /* !HAVE_GLES2 */
/**
* GST_GL_DOWNLOAD_VIDEO_CAPS:

View file

@ -1075,7 +1075,7 @@ gst_gl_filter_render_to_target (GstGLFilter * filter, gboolean resize,
in_width, 0, in_height, GST_GL_DISPLAY_PROJECTION_ORTHO2D, data);
}
#ifndef OPENGL_ES2
#if HAVE_OPENGL
static void
_draw_with_shader_cb (gint width, gint height, guint texture, gpointer stuff)
{
@ -1116,6 +1116,9 @@ void
gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter,
gboolean resize, GLuint input, GLuint target, GstGLShader * shader)
{
g_return_if_fail (gst_gl_display_get_gl_api (filter->display) &
GST_GL_API_OPENGL);
filter->default_shader = shader;
gst_gl_filter_render_to_target (filter, resize, input, target,
_draw_with_shader_cb, filter);
@ -1153,4 +1156,4 @@ gst_gl_filter_draw_texture (GstGLFilter * filter, GLuint texture,
glEnd ();
}
#endif
#endif /* HAVE_OPENGL */

View file

@ -124,12 +124,12 @@ gboolean gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
void gst_gl_filter_render_to_target (GstGLFilter *filter, gboolean resize, GLuint input,
GLuint target, GLCB func, gpointer data);
#ifndef OPENGL_ES2
#if HAVE_OPENGL
void gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter, gboolean resize,
GLuint input, GLuint target, GstGLShader *shader);
void gst_gl_filter_draw_texture (GstGLFilter *filter, GLuint texture, guint width, guint height);
#endif /* !OPENGL_ES2 */
#endif /* HAVE_OPENGL */
G_END_DECLS

View file

@ -40,6 +40,12 @@
* Data is uploaded or downloaded from the GPU as is necessary.
*/
#define USING_OPENGL(display) (display->gl_api & GST_GL_API_OPENGL)
#define USING_OPENGL3(display) (display->gl_api & GST_GL_API_OPENGL3)
#define USING_GLES(display) (display->gl_api & GST_GL_API_GLES)
#define USING_GLES2(display) (display->gl_api & GST_GL_API_GLES2)
#define USING_GLES3(display) (display->gl_api & GST_GL_API_GLES3)
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
#define GST_CAT_DEFUALT GST_CAT_GL_MEMORY
@ -220,22 +226,29 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data)
glGenRenderbuffersEXT (1, &rboId);
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, rboId);
#ifndef OPENGL_ES2
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width,
height);
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT,
width, height);
#else
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
width, height);
#if HAVE_OPENGL
if (USING_OPENGL (display)) {
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width,
height);
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT,
width, height);
}
#endif
#if HAVE_GLES2
if (USING_GLES2 (display)) {
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
width, height);
}
#endif
/* attach the renderbuffer to depth attachment point */
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rboId);
#ifndef OPENGL_ES2
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId);
#if HAVE_OPENGL
if (USING_OPENGL (display)) {
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId);
}
#endif
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
@ -264,7 +277,7 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data)
GST_CAT_ERROR (GST_CAT_GL_MEMORY,
"GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
break;
#ifndef OPENGL_ES2
#if HAVE_OPENGL
case GL_FRAMEBUFFER_UNDEFINED:
GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GL_FRAMEBUFFER_UNDEFINED");
break;

View file

@ -27,6 +27,12 @@
#define GST_GL_SHADER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_SHADER, GstGLShaderPrivate))
#define USING_OPENGL(display) (gst_gl_display_get_gl_api_unlocked (display) & GST_GL_API_OPENGL)
#define USING_OPENGL3(display) (gst_gl_display_get_gl_api_unlocked (display) & GST_GL_API_OPENGL3)
#define USING_GLES(display) (gst_gl_display_get_gl_api_unlocked (display) & GST_GL_API_GLES)
#define USING_GLES2(display) (gst_gl_display_get_gl_api_unlocked (display) & GST_GL_API_GLES2)
#define USING_GLES3(display) (gst_gl_display_get_gl_api_unlocked (display) & GST_GL_API_GLES3)
enum
{
PROP_0,
@ -251,9 +257,13 @@ gst_gl_shader_init (GstGLShader * self)
}
GstGLShader *
gst_gl_shader_new (void)
gst_gl_shader_new (GstGLDisplay * display)
{
return g_object_new (GST_GL_TYPE_SHADER, NULL);
GstGLShader *shader = g_object_new (GST_GL_TYPE_SHADER, NULL);
shader->display = display;
return shader;
}
gboolean
@ -270,7 +280,7 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
GstGLShaderPrivate *priv;
gchar info_buffer[2048];
GLsizei len = 0;
gint len = 0;
GLint status = GL_FALSE;
g_return_val_if_fail (GST_GL_IS_SHADER (shader), FALSE);
@ -293,12 +303,15 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
glGetObjectParameterivARB (priv->vertex_handle,
GL_OBJECT_COMPILE_STATUS_ARB, &status);
#ifndef OPENGL_ES2
glGetInfoLogARB (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#else
glGetShaderInfoLog (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#if HAVE_OPENGL
if (USING_OPENGL (shader->display))
glGetInfoLogARB (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
#if HAVE_GLES2
if (USING_GLES2 (shader->display))
glGetShaderInfoLog (priv->vertex_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
info_buffer[len] = '\0';
@ -329,12 +342,15 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
glGetObjectParameterivARB (priv->fragment_handle,
GL_OBJECT_COMPILE_STATUS_ARB, &status);
#ifndef OPENGL_ES2
glGetInfoLogARB (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#else
glGetShaderInfoLog (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#if HAVE_OPENGL
if (USING_OPENGL (shader->display))
glGetInfoLogARB (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
#if HAVE_GLES2
if (USING_GLES2 (shader->display))
glGetShaderInfoLog (priv->fragment_handle,
sizeof (info_buffer) - 1, &len, info_buffer);
#endif
info_buffer[len] = '\0';
if (status != GL_TRUE) {
@ -356,10 +372,13 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
/* if nothing failed link shaders */
glLinkProgramARB (priv->program_handle);
#ifndef OPENGL_ES2
glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status);
#else
glGetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
#if HAVE_OPENGL
if (USING_OPENGL (shader->display))
glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status);
#endif
#if HAVE_GLES2
if (USING_GLES2 (shader->display))
glGetProgramiv (priv->program_handle, GL_LINK_STATUS, &status);
#endif
glGetInfoLogARB (priv->program_handle,
@ -400,10 +419,13 @@ gst_gl_shader_release (GstGLShader * shader)
if (priv->vertex_handle) { /* not needed but nvidia doesn't care to respect the spec */
GST_TRACE ("finalizing vertex shader %u", priv->vertex_handle);
#ifndef OPENGL_ES2
glDeleteObjectARB (priv->vertex_handle);
#else
glDeleteShader (priv->vertex_handle);
#if HAVE_OPENGL
if (USING_OPENGL (shader->display))
glDeleteObjectARB (priv->vertex_handle);
#endif
#if HAVE_GLES2
if (USING_GLES2 (shader->display))
glDeleteShader (priv->vertex_handle);
#endif
/* err = glGetError (); */
@ -415,10 +437,14 @@ gst_gl_shader_release (GstGLShader * shader)
if (priv->fragment_handle) {
GST_TRACE ("finalizing fragment shader %u", priv->fragment_handle);
#ifndef OPENGL_ES2
glDeleteObjectARB (priv->fragment_handle);
#else
glDeleteShader (priv->fragment_handle);
#if HAVE_OPENGL
if (USING_OPENGL (shader->display))
glDeleteObjectARB (priv->fragment_handle);
#endif
#if HAVE_GLES2
if (USING_GLES2 (shader->display))
glDeleteShader (priv->fragment_handle);
#endif
/* err = glGetError (); */
@ -748,7 +774,7 @@ gst_gl_shader_set_uniform_4iv (GstGLShader * shader, const gchar * name,
void
gst_gl_shader_set_uniform_matrix_2fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat * value)
gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -762,11 +788,42 @@ gst_gl_shader_set_uniform_matrix_2fv (GstGLShader * shader, const gchar * name,
glUniformMatrix2fvARB (location, count, transpose, value);
}
#ifndef OPENGL_ES2
void
gst_gl_shader_set_uniform_matrix_3fv (GstGLShader * shader, const gchar * name,
gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
priv = shader->priv;
g_return_if_fail (priv->program_handle != 0);
location = glGetUniformLocationARB (priv->program_handle, name);
glUniformMatrix3fvARB (location, count, transpose, value);
}
void
gst_gl_shader_set_uniform_matrix_4fv (GstGLShader * shader, const gchar * name,
gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
priv = shader->priv;
g_return_if_fail (priv->program_handle != 0);
location = glGetUniformLocationARB (priv->program_handle, name);
glUniformMatrix4fvARB (location, count, transpose, value);
}
#if HAVE_OPENGL
void
gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -782,8 +839,7 @@ gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader * shader,
void
gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -796,29 +852,10 @@ gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader * shader,
glUniformMatrix2x4fv (location, count, transpose, value);
}
#endif
void
gst_gl_shader_set_uniform_matrix_3fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
priv = shader->priv;
g_return_if_fail (priv->program_handle != 0);
location = glGetUniformLocationARB (priv->program_handle, name);
glUniformMatrix3fvARB (location, count, transpose, value);
}
#ifndef OPENGL_ES2
void
gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -834,8 +871,7 @@ gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader * shader,
void
gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -848,29 +884,10 @@ gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader * shader,
glUniformMatrix3x4fv (location, count, transpose, value);
}
#endif
void
gst_gl_shader_set_uniform_matrix_4fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
priv = shader->priv;
g_return_if_fail (priv->program_handle != 0);
location = glGetUniformLocationARB (priv->program_handle, name);
glUniformMatrix4fvARB (location, count, transpose, value);
}
#ifndef OPENGL_ES2
void
gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -886,8 +903,7 @@ gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader * shader,
void
gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader * shader,
const gchar * name, GLsizei count, GLboolean transpose,
const GLfloat * value)
const gchar * name, gint count, gboolean transpose, const gfloat * value)
{
GstGLShaderPrivate *priv;
GLint location = -1;
@ -900,7 +916,7 @@ gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader * shader,
glUniformMatrix4x3fv (location, count, transpose, value);
}
#endif
#endif /* HAVE_OPENGL */
GLint
gst_gl_shader_get_attribute_location (GstGLShader * shader, const gchar * name)

View file

@ -21,18 +21,17 @@
#ifndef __GST_GL_SHADER_H__
#define __GST_GL_SHADER_H__
/* OpenGL 2.0 for Embedded Systems */
#ifdef OPENGL_ES2
#include <GLES2/gl2.h>
#include "gstgles2.h"
/* OpenGL for usual systems */
#else
#include <GL/glew.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstgldisplay.h"
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _GstGLDisplay GstGLDisplay;
#define GST_GL_TYPE_SHADER (gst_gl_shader_get_type())
#define GST_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_SHADER, GstGLShader))
#define GST_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_SHADER, GstGLShaderClass))
@ -60,6 +59,9 @@ typedef struct _GstGLShaderClass GstGLShaderClass;
struct _GstGLShader {
/*< private >*/
GObject parent;
GstGLDisplay *display;
GstGLShaderPrivate *priv;
};
@ -73,68 +75,51 @@ struct _GstGLShaderClass {
GQuark gst_gl_shader_error_quark (void);
GType gst_gl_shader_get_type (void);
GstGLShader * gst_gl_shader_new (void);
GstGLShader * gst_gl_shader_new (GstGLDisplay *display);
void gst_gl_shader_set_vertex_source (GstGLShader *shader,
const gchar *src);
void gst_gl_shader_set_fragment_source (GstGLShader *shader,
const gchar *src);
const gchar * gst_gl_shader_get_vertex_source (GstGLShader *shader);
void gst_gl_shader_set_vertex_source (GstGLShader *shader, const gchar *src);
void gst_gl_shader_set_fragment_source (GstGLShader *shader, const gchar *src);
const gchar * gst_gl_shader_get_vertex_source (GstGLShader *shader);
const gchar * gst_gl_shader_get_fragment_source (GstGLShader *shader);
void gst_gl_shader_set_active (GstGLShader *shader,
gboolean active);
gboolean gst_gl_shader_is_compiled (GstGLShader *shader);
gboolean gst_gl_shader_compile (GstGLShader *shader, GError **error);
void gst_gl_shader_set_active (GstGLShader *shader, gboolean active);
gboolean gst_gl_shader_is_compiled (GstGLShader *shader);
gboolean gst_gl_shader_compile (GstGLShader *shader, GError **error);
gboolean gst_gl_shader_compile_and_check (GstGLShader *shader, const gchar *source, GstGLShaderSourceType type);
void gst_gl_shader_release (GstGLShader *shader);
void gst_gl_shader_use (GstGLShader *shader);
void gst_gl_shader_use (GstGLShader *shader);
void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, gfloat * value);
void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, gfloat * value);
void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, gfloat * value);
void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, gfloat * value);
void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
#ifndef OPENGL_ES2
void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
#endif
void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
#ifndef OPENGL_ES2
void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
#endif
void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
#ifndef OPENGL_ES2
void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader * shader, const gchar * name,
GLsizei count, GLboolean transpose, const GLfloat* value);
void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, gint * value);
void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, gint *value);
void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, gfloat *value);
void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
#if HAVE_OPENGL
void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
#endif
GLint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name);
void gst_gl_shader_bind_attribute_location (GstGLShader * shader, GLuint index, const gchar * name);
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);
G_END_DECLS

View file

@ -554,7 +554,19 @@ gst_gl_shadervariable_set (GstGLShader * shader,
(float *) ret->value);
break;
#ifndef OPENGL_ES2
case _mat3:
case _mat3x3:
gst_gl_shader_set_uniform_matrix_3fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
break;
case _mat4:
case _mat4x4:
gst_gl_shader_set_uniform_matrix_4fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
break;
#if HAVE_OPENGL
case _mat2x3:
gst_gl_shader_set_uniform_matrix_2x3fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
@ -574,13 +586,7 @@ gst_gl_shadervariable_set (GstGLShader * shader,
gst_gl_shader_set_uniform_matrix_4x2fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
break;
#endif
case _mat3:
case _mat3x3:
gst_gl_shader_set_uniform_matrix_3fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
break;
#ifndef OPENGL_ES2
case _mat3x4:
gst_gl_shader_set_uniform_matrix_3x4fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
@ -591,11 +597,6 @@ gst_gl_shadervariable_set (GstGLShader * shader,
(float *) ret->value);
break;
#endif
case _mat4:
case _mat4x4:
gst_gl_shader_set_uniform_matrix_4fv (shader, ret->name, ret->count, 0,
(float *) ret->value);
break;
default:
return -1;

File diff suppressed because it is too large Load diff

View file

@ -43,6 +43,7 @@ GType gst_gl_upload_get_type (void);
typedef struct _GstGLUpload GstGLUpload;
typedef struct _GstGLUploadClass GstGLUploadClass;
typedef struct _GstGLUploadPrivate GstGLUploadPrivate;
/**
* GstGLUpload
@ -76,12 +77,12 @@ struct _GstGLUpload
guint in_width;
guint in_height;
GstGLShader *shader;
#ifdef OPENGL_ES2
GLint shader_attr_position_loc;
GLint shader_attr_texture_loc;
#endif
/* <private> */
GstGLUploadPrivate *priv;
gpointer _reserved[GST_PADDING];
};
@ -100,12 +101,12 @@ struct _GstGLUploadClass
*
* The currently supported formats that can be uploaded
*/
#ifndef OPENGL_ES2
# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \
#if !HAVE_GLES2
#define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \
"xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }"
#else /* OPENGL_ES2 */
#else /* HAVE_GLES2 */
# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }"
#endif
#endif /* !HAVE_GLES2 */
/**
* GST_GL_UPLOAD_VIDEO_CAPS: