Commit graph

56 commits

Author SHA1 Message Date
Matthew Waters
ccbf43987f 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.
2017-12-09 19:32:18 +00:00
Matthew Waters
fdca1dec0d glshader: some compatibility changes for GL 1.4
GL 1.4 (with GL_ARB_shader_objects) doesn't have glIsProgram or glIsShader
equivalents.  As they are simply assertions, skip them when there isn't a
valid function pointer.
2017-12-09 19:32:17 +00:00
Matthew Waters
31b1094744 gl: misc docs fixes/additions 2017-12-09 19:32:17 +00:00
Alessandro Decina
bc8d272aad gstglshader: cache uniform locations
Avoid redundant calls to glGetUniformLocation. The results can be cached once
the shader has been linked.
2017-12-09 19:32:16 +00:00
Matthew Waters
148940c456 glshader: don't read invalid list pointers (use after free)
gst_gl_shader_detach_unlocked already removes the list entry so attempting to
use the element to iterate to the next stage could read invalid data.

Based on patch by Vineeth TM <vineeth.tm@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=758039
2017-12-09 19:32:11 +00:00
Matthew Waters
117fc0409a glshader: properly unref the stages on failure
When failing in the varargs functions, all the stage objects not handled need to
be unreffed to prevent a leak.
2017-12-09 19:32:11 +00:00
Tim-Philipp Müller
7a166e019b glshader, tsdemux: simplify code
Jus use _delete_link() instead of _remove_link() + _free1()
2017-12-09 19:32:10 +00:00
Matthew Waters
06de6998e5 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2017-12-09 19:32:09 +00:00
Matthew Waters
f688a8f0b2 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2017-12-09 19:32:09 +00:00
Julien Isorce
9b1eb32c49 gl: initialize output params to 0 before calling gl functions
The client side API of the Chromium's GPU Process has asserts
in debug mode that check that output params are initialized to 0.
2017-12-09 19:32:05 +00:00
Matthew Waters
675f789871 glshader: attempt to detect the gles2 inside opengl3 case
This is necessary to use gles2 shaders in a GL 3 core context on
OS X which fails without a proper #version being set on the shaders.
2017-12-09 19:32:01 +00:00
Matthew Waters
2b4ce9435d glshader: remove references to gl3 specific shaders
We rely specifically on gles2 shaders being supported by the GL
implementation with GL3 core profile.
2017-12-09 19:32:01 +00:00
Matthew Waters
15fd4e164a glshader: attribute locations are -1 on error 2017-12-09 19:31:57 +00:00
Neos3452
7d83351172 glshader: prevent from getting attributes without vertex shader
It doesn't make sense to query for vertex attributes without a vertex
shader. Moreover this is causing a crash on OSX.

https://bugzilla.gnome.org/show_bug.cgi?id=746168
2017-12-09 19:31:57 +00:00
Edward Hervey
f56c4c541a gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from
which object the debug statement is coming from

Define (and use) GST_CAT_DEFAULT where applicable

Use GST_PTR_FORMAT where applicable
2017-12-09 19:31:54 +00:00
Matthew Waters
dcd5fce8fb glshader add support for gl3 2017-12-09 19:31:50 +00:00
Matthew Waters
366eaea6d2 glshader: advertise the default vertex and fragment shaders on desktop GL 2017-12-09 19:31:49 +00:00
Lubosz Sarnecki
67b9f71619 glshader: expose opengl handle in getter
https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Matthew Waters
4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Matthew Waters
857200ff40 gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2017-12-09 19:31:39 +00:00
Julien Isorce
cebcc837de gl: add convenient functions to setup default vertex and fragment shaders
Most of our 2D filters use the same simple vertex shader.
Also define the default fragment shader as the identity.

Avoid duplicating the same vertex and fragment shader text.
2017-12-09 19:31:38 +00:00
Matthew Waters
e225af3e0d gl: silence all the compiler warnings 2017-12-09 19:31:34 +00:00
Matthew Waters
711ad485b2 [812/906] move the GL vtable from GstGLDisplay to GstGLContext
Conflicts:
	tests/check/libs/gstglcontext.c
2017-12-09 19:31:31 +00:00
Sebastian Dröge
9d4f99b8bb [749/906] glshader: Add some more debug output 2017-12-09 19:31:29 +00:00
Julien Isorce
d17a4381b1 [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2017-12-09 19:31:29 +00:00
Sebastian Dröge
685d855ded [719/906] gl: Fix compilation with GLES2 2017-12-09 19:31:28 +00:00
Matthew Waters
5b13d0ebf4 [718/906] shader: make it possible to unref in the non-GL thread 2017-12-09 19:31:28 +00:00
Matthew Waters
d7f5cac7ce [713/906] shader: make it possible to create the object in a non-GL thread 2017-12-09 19:31:28 +00:00
Matthew Waters
761bc0156a [704/906] Use gst_object_[un]ref so we can get refcounts in the log 2017-12-09 19:31:28 +00:00
Matthew Waters
1a04002052 [681/906] win32: fix gl api calls on 32-bit
win has the bright idea of having 5 different calling conventions.
we should probably use the right one so we don't crash from stack
corruption.
2017-12-09 19:31:27 +00:00
Matthew Waters
63a5d9e981 [668/906] shader: fix gles2 segfault 2017-12-09 19:31:27 +00:00
Matthew Waters
6bee9b9c93 [647/906] remove dependecy on glew 2017-12-09 19:31:27 +00:00
Matthew Waters
e983f02e87 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2017-12-09 19:31:26 +00:00
Matthew Waters
6c0e32864a [627/906] shader: check for invalid objects 2017-12-09 19:31:26 +00:00
Matthew Waters
344253e860 [624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL
use GstGLAPI to determine which code paths to execute.
perform some cleanups
2017-12-09 19:31:26 +00:00
Matthew Waters
9dd6570ca9 [605/906] shader: move to gst debugging 2017-12-09 19:31:25 +00:00
Matthew Waters
4c35d682c9 [603/906] update FSF address 2017-12-09 19:31:25 +00:00
Julien Isorce
83b2f12c12 [495/906] glES2.0: properly use glDeleteShader 2017-12-09 19:31:23 +00:00
Julien Isorce
badaaaec34 [491/906] glES2.0: properly fails if driver/kernel inconsistency 2017-12-09 19:31:23 +00:00
Julien Isorce
07df6a220d [490/906] gldisplay: error out instead of g_assert 2017-12-09 19:31:23 +00:00
Julien Isorce
ccaa9e883f [477/906] OpenGL ES 2.0: fix build since glfiltershader changes 2017-12-09 19:31:23 +00:00
Luc Deschenaux
500210b354 [471/906] glshader: add dynamic fragment shader filter
Also add fragment shader parser
Fix bug #600195
2017-12-09 19:31:23 +00:00
Julien Isorce
f008fa71ab [467/906] tests: various build fixes
- cmake could not find glib
 - put gtk variables at the beginning to avoid GL conflicts
 - update examples to clutter-1.8
 - use const instead of deprecated G_CONST_RETURN
 - set max pending events to 0 to make cube example works again
2017-12-09 19:31:23 +00:00
Stefan Kost
df480f3530 [462/906] various: add missing G_PARAM_STATIC_STRINGS flags
Canonicalize property names as needed. Includes some gst-indent changes as well :/
2017-12-09 19:31:23 +00:00
Julien Isorce
b85ffef956 [387/906] glmixer: add a glmixer base element
glmixer can be seen as a glfilter except it handles N requested
sink pads.
Each sink pad and the src pad are video/x-raw-gl.
glmixer is responsible for managing different framerates from inputs.
It uses OpenGL context sharing. It means that each input is in its
own OpenGL context shared together and shared with the OpenGL context
of the ouput gl chain.
Also add a glmosaic which is an example of implementation of glmixer.
For now glmosaic is a cube but it will be fixed in the next commits.
For now the glmixer has some weird behaviours in some configurations
but it will be improved in the next commits.
The autotools builds is temporarly broken since those changes
have been made on win32.
2017-12-09 19:31:22 +00:00
Julien Isorce
61a8f34442 [321/906] add OpenGL ES 2.x support.
In OpenGL 2.x for Embedded System, a lot of basic scene/draw functions
have been removed. It means that everything is made using vertex and
fragment shaders.
I have also added a gstglwindow backend for winCE that uses EGL
(Native Platform Graphics Intercace) (which is a full part of
OpenGL ES specification). It remove the use of wgl/glx functions.
2017-12-09 19:31:21 +00:00
David Schleef
2e2213fbd7 [310/906] Global reindent
Indent parameters:
INDENT_PARAMETERS="--braces-on-if-line \
        --case-brace-indentation0 \
        --case-indentation2 \
        --braces-after-struct-decl-line \
        --line-length80 \
        --no-tabs \
        --cuddle-else \
        --dont-line-up-parentheses \
        --honour-newlines \
        --continuation-indentation4 \
        --tab-size8 \
        --indent-level2"
2017-12-09 19:31:21 +00:00
Julien Isorce
3b8429c2df [304/906] only load RGBA files.png 2017-12-09 19:31:21 +00:00
David Schleef
f0b62d760f [298/906] Revert "Fix indention"
This reverts commit 96e4ab18c2cf9876f6c031b9aba6282d0bd45a93.

You should have asked first.  And you would have been told "no",
because it causes people on development branches to do a huge
amount of extra work.
2017-12-09 19:31:21 +00:00
Sebastian Dröge
809c2ec04c [295/906] Fix indention 2017-12-09 19:31:21 +00:00