Commit graph

25 commits

Author SHA1 Message Date
Matthew Waters 4bbda2b626 glframebuffer: rewrite for a more consistent API
Facilities are given to create fbo's and attach GL memory (renderbuffers
or textures).  It also keeps track of the renderable size for use with
effective use with glViewport().
2017-12-09 19:32:21 +00:00
Matthew Waters ba00657e9d glviewconvert: fix transformation matrix usage
Calling glUniformMatrix before the shader is bound is invalid and
would result in errors like:

GL_INVALID_OPERATION in glUniformMatrix(program not linked)

Move glUniformMatrix() to after the gst_gl_shader_use() call.
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
Matthew Waters dfd6565b4b glsl: fixup external-oes shaders by mangling the required extension
Newer devices require using a different GLSL extension for accessing
external-oes textures in a shader using the texture() functions.

While the GL_OES_EGL_image_external_essl3 should supposedly be supported
on a any GLES3 android device, the extension was defined after a lot of the
older drivers were built so they will not know about it.  Thus there are two
possible interpretations of which of texture[2D]() should be supported for
external-oes textures.  Strict adherence to the GL_OES_EGL_image_external
extension spec which uses texture2D() or following GLES3's pattern, also
allowing texture() as a function for accessing external-oes textures

This adds another mangling pass to convert
 #extension GL_OES_EGL_image_external : ...
into
 #extension GL_OES_EGL_image_external_essl3 : ...
on GLES3 and when the GL_OES_EGL_image_external_essl3 extension is supported.

Only uses texture() when the GLES3 and the GL_OES_EGL_image_external_essl3
extension is supported for external-oes textures.
Uses GLES2 + texture2D() + GL_OES_EGL_image_external in all other external-oes
cases.

https://bugzilla.gnome.org/show_bug.cgi?id=766993
2017-12-09 19:32:20 +00:00
Matthew Waters 2d62b2910c gl: take the affine transformation in NDC
Provide a function to get the affine matrix in the meta in terms of NDC
coordinates and use as a standard opengl matrix.

Also advertise support for the affine transformation meta in the allocation
query.
2017-12-09 19:32:19 +00:00
Matthew Waters 2753b4243e glmemory: add wrapped data pointers to setup_buffer
Allows creating wrapped memories with GstGLAllocationParams.

The wrapped pointers will be set in the parameters before being passed
to the memory allocation function.
2017-12-09 19:32:19 +00:00
Sebastian Dröge 1066b2a860 glviewconvert: Port more things to GLES/GL 3 compatibility
And move the shader mangling code into a single place instead of having a copy
in glcolorconvert and glviewconvert.

https://bugzilla.gnome.org/show_bug.cgi?id=765266
2017-12-09 19:32:19 +00:00
Matthew Waters cbf3a986ca glviewconvert: support outputting to multiple draw buffers on GLES3
A similar change that was done to glcolorconvert adding the necessary shader
mangling.
2017-12-09 19:32:18 +00:00
Matthew Waters 31b1094744 gl: misc docs fixes/additions 2017-12-09 19:32:17 +00:00
Sebastian Dröge 745071b5bf gl: Remove leftover g_prints
One was commented out, but we also don't use // comments :)
2017-12-09 19:32:16 +00:00
Jan Schmidt d7f508acbb glviewconvert: Fix stereoscopic handling w/ texture-target
The addition of texture-target negotiation broke stereoscopic
handling when not in passthrough mode, so fix that.
2017-12-09 19:32:14 +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
Luis de Bethencourt 648c2e20dc glviewconvert: check pointer before dereferencing
priv->primary_out could be NULL, check before dereferencing it in
GST_BUFFER_FLAG_SET ()

CID 1308945
2017-12-09 19:32:12 +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
Sebastian Dröge e7b63b1397 glviewconvert: String literals are const
gstglviewconvert.c: In function '_mangle_extensions':
gstglviewconvert.c:1511:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     ext_str = "#extension GL_OES_EGL_image_external : require\n";
             ^
2017-12-09 19:32:11 +00:00
Matthew Waters 975e96db44 glviewconvert: add support rectangle/external-oes textures
https://bugzilla.gnome.org/show_bug.cgi?id=757285
2017-12-09 19:32:11 +00:00
Matthew Waters b8c1ecf268 glviewconvert: remove set_format
We need the caps to be able to
1. check the caps features
2. get the requested texture-target on input/output
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
Matthew Waters cfb0d7e9f3 glviewconvert: expose the element on gles2 platforms
We can do everything with gles3 however gles2 restricts us not allowing
separated or frame-by-frame multiview modes due to multiple draw buffers.
2017-12-09 19:32:09 +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
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
Nicolas Dufresne 2c1d4f4074 glviewconvert: Fix GLES2 compatibility 2017-12-09 19:32:04 +00:00
Nicolas Dufresne 7605b39eea glviewconvert: Fix broken validity check 2017-12-09 19:32:04 +00:00
Jan Schmidt 7b583526e9 gl libs: Add glviewconvert helper object
Add API for a helper object that can convert between different
stereoscopic video representations, and later do filtering
of multiple view streams.

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2017-12-09 19:32:04 +00:00