Commit graph

43 commits

Author SHA1 Message Date
Matthew Waters
675415bf2e gl: try to use highp precision where supported
The use of mediump as a specifier in GLSL shaders will have limited
resolution and when used as texture coordinates may become inaccurate
over texture sizes of 1024.
2019-02-28 17:26:32 +11:00
Sebastian Dröge
acc098a736 gl: Only unbind buffers/vertex attrib arrays if we can't directly bind the vertex array to 0
Binding the vertex array to 0 will unbind everything else already.

In the previous order older versions of the Intel GL driver caused
errors to be printed for every single call when disabling the vertex
attrib arrays after binding the vertex array to 0.
2019-01-16 14:09:18 +02:00
Andoni Morales Alastruey
a52ad2078a gl: fix build with more recent versions of MinGW 2019-01-07 10:17:25 +00:00
Matthew Waters
a164d86804 Revert "Revert "gl: use correct blend functions for unpremultiplied alpha""
This reverts commit 452d90a88c.

This was actually correct. sorry for the noise!
2018-10-05 01:21:01 +10:00
Matthew Waters
452d90a88c Revert "gl: use correct blend functions for unpremultiplied alpha"
This reverts commit 779d028f27.
2018-10-05 00:03:09 +10:00
Matthew Waters
779d028f27 gl: use correct blend functions for unpremultiplied alpha
Fallback to the closest but incorrect values we had before if we can't
do this correctly.
2018-10-04 23:43:19 +10:00
Jan Schmidt
76bf415a96 glfilter: Remove hard-coded pad templates
Add a function to install the default RGBA pad templates,
but don't make them required so that there can be
GstGLFilter sub-classes with different input/output
caps if they want. Remove the hard-coded RGBA restriction in
the set_caps_features call, as it will be taken care
of by intersecting with the pad templates.

Update all the sub-classes to match
2017-12-09 19:32:29 +00:00
Thibault Saunier
95ac4d5175 docs: Port all docstring to gtk-doc markdown 2017-12-09 19:32:27 +00:00
Matthew Waters
61ee2685c0 gl: GL_ARRAY_BUFFER is not a part of VAO state
As a result we need to bind it on every draw in order to have the
correct state in the GL state machine.
2017-12-09 19:32:27 +00:00
Matthew Waters
66468b4245 gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
2017-12-09 19:32:27 +00:00
Matthew Waters
8a1d31f6ab gl/utils: move gen_shader() to the plugin and remove del_shader()
gst_gl_context_del_shader() can be replaced by a g_object_unref().
gst_gl_context_gen_shader() should be replaced by using GstGLSLStage.
2017-12-09 19:32:24 +00:00
Matthew Waters
181dacc77e glfilter: remove display_init/reset
They are mirrors of GstGLBaseFilter's gl_start() and gl_stop() virtual methods
so use them instead.
2017-12-09 19:32:23 +00:00
Nirbheek Chauhan
0d37cc3b11 ext/gl: Don't define boolean on Windows with MSVC
The headers we include already define boolean on Windows with MSVC, and
it leads to a typedef redefinition error with jpeglib.h which tries to
redefine it in jmorecfg.h
2017-12-09 19:32:23 +00:00
Matthew Waters
b3d8e09839 glfilter: rewrite subclasses for filter_texture() occuring on GL thread
There's no need for the jump to an extra thread in most cases, especially
when relying solely on a shader to render.  We can use the provided
render_to_target() functions to simplify filter writing.
2017-12-09 19:32:21 +00:00
Matthew Waters
7f10822de4 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2017-12-09 19:32:21 +00:00
Matthew Waters
1153684a94 glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2017-12-09 19:32:21 +00:00
Alessandro Decina
28dbe4fffc glmemory: add gst_gl_memory_allocator_get_default
Add gst_gl_memory_allocator_get_default to get the default allocator based on
the opengl version. Allows us to stop hardcoding the PBO allocator which isn't
supported on gles2.

Fixes GL upload on iOS9 among other things.
2017-12-09 19:32:13 +00:00
Matthew Waters
1673a6192f glmemorypbo: remove our own alloc()/wrapped()/etc functions
replaced by equivalent functionality within gst_gl_base_memory_alloc()
2017-12-09 19:32:13 +00:00
Matthew Waters
76a38dd66a glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2017-12-09 19:32:12 +00:00
Reynaldo H. Verdejo Pinochet
68e668168d Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2017-12-09 19:32:11 +00:00
Matthew Waters
681cb5b16d glmemory: add support for rectangle textures
Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.
2017-12-09 19:32:10 +00:00
Xavier Claessens
0280be02ca gloverlay: fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens
01177670ea gloverlay: properly handle errors while loading file
Post an error on the bus if anything bad happens while reading
and parsing the image file.

https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Xavier Claessens
80914d1731 gloverlay: remove unused type_file field
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Matthew Waters
72993f54fa gl: remove useless gl{En,Dis}able (GL_TEXTURE_*) calls
We are using shaders everywhere and so they are not needed
2017-12-09 19:32:01 +00:00
Matthew Waters
65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Sebastian Dröge
ee6bfe0127 glfilter: De-camelcase onInitFBO() vfunc 2017-12-09 19:31:59 +00:00
Sebastian Dröge
3613ecfd0a glfilter: Remove onStart/onStop vfuncs, and unused onReset()
onStart/onStop are just duplicates of the basetransform ones, onReset
was never called but was used everywhere when stop should've been used.
2017-12-09 19:31:59 +00:00
Matthew Waters
92f0aa9bd8 gl: get the context from basemixer/basefilter 2017-12-09 19:31:57 +00:00
Nicolas Dufresne
2729949b39 gloverlay: Fix upside down and miss-aligned JPEG
LibJPEG uses macroblock of 8x8 sample. In this element we use RGB and
Y444, two 24bit formats that are stored in 32bit pixels. This mean we
have 32x32 bytes macroblocks. For this reason, we need to allocate
our buffer slightly larger. We also need to pass the line pointer in
the right order, otherwise the image endup upside-down.

https://bugzilla.gnome.org/show_bug.cgi?id=745109
2017-12-09 19:31:56 +00:00
Nicolas Dufresne
de79830b05 glmemory: Add GstAllocationParams and alignment support
This implements support for GstAllocationParams and memory alignments.
The parameters where simply ignored which could lead to crash on
certain platform when used with libav and no luck.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne
a1e02726ee gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2017-12-09 19:31:52 +00:00
Matthew Waters
ba3a3cd783 gl: fixup vao and vbo usage for legacy GL 2017-12-09 19:31:52 +00:00
Matthew Waters
4bd62ebb03 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters
eff381b93d gloverlay: support gl3 2017-12-09 19:31:51 +00:00
Vivia Nikolaidou
4fa5392e14 gloverlay: And fix another unused variable compiler warning 2017-12-09 19:31:48 +00:00
Vivia Nikolaidou
53213d924e gloverlay: Fix unused variable compiler warning when compiling without desktop GL 2017-12-09 19:31:48 +00:00
Matthew Waters
7d99c66ca5 gloverlay: fix zero output frames with YUY2/UYVY
also, be nice and disable blending for other elements
2017-12-09 19:31:47 +00:00
Matthew Waters
0e89ab4c91 gloverlay: protect desktop gl specific tokens with #if 2017-12-09 19:31:47 +00:00
Matthew Waters
f4afec4657 gloverlay: free the image memory every time the location changes
fixes a memory leak
2017-12-09 19:31:47 +00:00
Matthew Waters
96208c1694 gloverlay: reimplement everything
- update for shaders
 - add alpha property
 - image placement properties shamelessly borrowed from gdkpixbufoverlay
 - image placement properties are GstController able
 - use GstGLMemory for the overlay image data
 - add support for gles2
2017-12-09 19:31:46 +00:00
Tim-Philipp Müller
6bbcefe029 opengl: update element docs for 1.x 2017-12-09 19:31:45 +00:00
Matthew Waters
a884d6feee move gl elements to ext subdirectory 2017-12-09 19:31:34 +00:00