Commit graph

1598 commits

Author SHA1 Message Date
Matthew Waters
6141d3fc7e glcolorconvert: add support for converting texture targets
Solved with a simple shader templating mechanism and string replacements
of the necessary sampler types/texture accesses and texture coordinate
mangling for rectangular and external-oes textures.
2017-12-09 19:32:10 +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
aa32408926 glcolorconvert: order the caps template so that RGBA is first
glcolorconvert ! glcolorconvert would sometimes negotiated RGB
(the first list entry) otherwise.
2017-12-09 19:32:10 +00:00
Matthew Waters
33f73b400d glbufferpool: move typedef's into the forward decleration file
Otherwise, for example, clang will warn about typedef redefinitions
being a C11 feature.
2017-12-09 19:32:10 +00:00
Julien Isorce
6bb560a4eb glslstage: 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:10 +00:00
Matthew Waters
68215b0a47 opengl: build/provide glstereomix/split on gles only systems 2017-12-09 19:32:10 +00:00
Matthew Waters
ad49a39e5b glcolorconvert: allow outputting multiple textures for gles3 contexts
the USING_GLES2 includes all GLES3 contexts as well which does support
drawing to multiple buffers.  Instead make or decision solely based on
whether glDrawBuffers is available or not.
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
89122224eb glshaderelement: free the vertex and fragment strings on finalize
Fixes a memory leak when using the vertex/fragment properties.
2017-12-09 19:32:09 +00:00
Matthew Waters
3f8edbee03 glshaderelement: remove unneeded reference to <gst/gl/gstglshadervariables.h> 2017-12-09 19:32:09 +00:00
Matthew Waters
764c4a33bc gl: fix usage of string.h and stdio.h functions without including the headers
e.g:
gstglcontext_egl.c:613:7: error: implicit declaration of function 'strcmp'
[-Werror=implicit-function-declaration]
   if (strcmp (G_MODULE_SUFFIX, "so") == 0)
2017-12-09 19:32:09 +00:00
Matthew Waters
c3b69f3478 glimagesink: create a context in NULL_READY
So that it's possible for decoders et al. to request the OpenGL context
in their READY_PAUSED transition with decodebin/playbin.
2017-12-09 19:32:09 +00:00
Matthew Waters
4d46edfd50 gl: remove unneeded shader variable parsing code 2017-12-09 19:32:09 +00:00
Matthew Waters
c766ca0381 glshaderelement: implement setting arbitrary uniforms
Currently float and int are supported by default. vec2, vec3, vec4
and mat4 are supported if graphene is used.  Of course if one wants
to set custom uniforms they can also be set using the create-shader
signal.
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
Matthew Waters
3a8fc708ee glshaderelement: implement on-demand create-shader signalling
One may not have an GstGLContext available or current in the thread where one
would need to update the shader.  Support this by signalling create-shader
whenever the one-shot 'update-shader' is set to TRUE.
2017-12-09 19:32:09 +00:00
Matthew Waters
9650e92bea gl/calayer: don't leak a gl shader object
We will always overwrite the ca_sink->redisplay_shader without freeing the
object.
2017-12-09 19:32:09 +00:00
Matthew Waters
463e23bb47 glslstage: add brackets around pointer dereference referencing an array
While technically, i is always 0 and *vertex_sources[i++] is equivalant
to (*vertex_sources)[i++].  Be future-proof in the case of code
moves/changes/etc.

CID 1327406
2017-12-09 19:32:09 +00:00
Matthew Waters
2b3a224dc0 gl/caopengllayersink: port to new GstGLShader API
fixes build error:
"undefined symbols for architecture:
gst_gl_shader_compile_with_default_vf_and_check"
2017-12-09 19:32:09 +00:00
Matthew Waters
28d6a3edec gl/tests: port glcontext test to opengl
Now uses vao's and vbo's when possible like the rest of the gstgl library.
2017-12-09 19:32:09 +00:00
Matthew Waters
ad4109dbec glshader: port element to GstGLSLStage
- Provide a shader property to set the full shader pipeline
- Provide vertex and fragment properties for just providing simple
  shader sources.
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
Matthew Waters
8c922ca96b glsl: add a shader stage object GstGLSLStage
Represents a stage (vertex, geometry, fragment, etc) in the shader
pipeline.
2017-12-09 19:32:09 +00:00
Matthew Waters
18e205dcbb gl/shader/variables: include generic gl.h header
Otherwise we may miss some forward declarations

Fixes build error: undefined reference to GstGLSLStage
2017-12-09 19:32:09 +00:00
Matthew Waters
332543f3cf gl: add some GLSL utility functions
Specifically parsing/setting GLSL versions and the shader related
function table.
2017-12-09 19:32:09 +00:00
Guillaume Desmottes
01e1046dbc gl: fix leak in gst_gl_insert_debug_marker()
The string allocated by g_vasprintf() was leaked.

Reproduced using the
validate.file.compositor.simple.play_15s.synchronized validate scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=756492
2017-12-09 19:32:09 +00:00
Nirbheek Chauhan
5890c51bd3 glvideomixer: Proxy the ignore-eos videoaggregator property as well
Identical to how the z-order property is proxied
2017-12-09 19:32:09 +00:00
Vineeth TM
def421acf6 gstreamer: bad: Fix memory leaks when context parse fails
When g_option_context_parse fails, context and error variables are not getting free'd
which results in memory leaks. Free'ing the same.

And replacing g_error_free with g_clear_error, which checks if the error being passed
is not NULL and sets the variable to NULL on free'ing.

https://bugzilla.gnome.org/show_bug.cgi?id=753854
2017-12-09 19:32:09 +00:00
Matthew Waters
16ee1636dc gl: move debugging related functions to their own file 2017-12-09 19:32:09 +00:00
Matthew Waters
e01fc68c02 glcolorscale: use glbasefilter vfuncs
Uses less code \o/
Fixes legacy opengl rendering \o/
2017-12-09 19:32:09 +00:00
Antoine Jacoutot
9117b50cfb gl: Pass GL_CFLAGS to g-ir-scanner
This unbreaks building when some headers are under a non-standard path.
e.g. /usr/X11R6/include as on OpenBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=755850
2017-12-09 19:32:09 +00:00
Matthew Waters
37047a1050 glcontext: fixup strstr lengths so we don't overrun 2017-12-09 19:32:09 +00:00
Matthew Waters
73bad9e856 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2017-12-09 19:32:09 +00:00
Matthew Waters
0580536fa1 glutils: use gst_element_set_context for setting display/other_context
1. So we get tracking inside GstElement properly when e.g. adding to a bin
2. Removes redundant code.  Now only one place where
   GstContext->GstGLDisplay/GstGLContext transformation occurs
3. Fixes a memory leak in the process
4. Make the retrieval of debug categories thread safe
2017-12-09 19:32:09 +00:00
Matthew Waters
977c335460 gl/eagl: use the default GL context debug category 2017-12-09 19:32:09 +00:00
Matthew Waters
dc469454d7 gl: set the context on the element on a context query
Otherwise it's possible to lose the context information if the
context is only propagated through queries.
2017-12-09 19:32:09 +00:00
Matthew Waters
8187171908 gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2017-12-09 19:32:08 +00:00
Matthew Waters
bf98930546 gl: sprinkle some debug markers to ease debugging 2017-12-09 19:32:08 +00:00
Matthew Waters
c486b1b3b0 gl/utils: add a function to insert a debug marker
These markers are visible in tools that record the GL function calls
such as apitrace, et al.

Makes it easier to match up GL draw commands with specific elements.
2017-12-09 19:32:08 +00:00
Matthew Waters
ec99383a21 gl: add some debugging prototypes 2017-12-09 19:32:08 +00:00
Matthew Waters
e9864e2e3e glwindow: remove unused draw_unlocked function
The functionality is provided by draw anyway and is leftover from
X11's specific threading requirements that no longer apply.
2017-12-09 19:32:08 +00:00
Julien Isorce
231e91c883 glfilter: use GL_ELEMENT_ARRAY_BUFFER for vbo indices
Fixes this error with chromium gpu process:
GL_INVALID_OPERATION, glBindBuffer: buffer bound to more than 1 target

https://bugzilla.gnome.org/show_bug.cgi?id=755618
2017-12-09 19:32:08 +00:00
Julien Isorce
d0bc54956d glmemory: fix texture leak in _gl_mem_copy
https://bugzilla.gnome.org/show_bug.cgi?id=755456
2017-12-09 19:32:08 +00:00
Matthew Waters
6de7db9a4e gl/dispmanx: fix rendering with recent resize state tracking
557ca6fda5 didn't change to the
necessary gst_gl_window_resize() call for the dispmanx backend.
2017-12-09 19:32:08 +00:00
Jan Schmidt
7f20eedcae Don't throw compiler warnings with G_DISABLE_ASSERT
Disable code that warns about unused variables when G_DISABLE_ASSERT
is defined, as it is in tarballs and pre-releases.
2017-12-09 19:32:08 +00:00
Matthew Waters
718318ce19 gl/caopengllayer: fix non-existent selector warning
557ca6fda5 introduced the queueResize
call without implementing the selector
2017-12-09 19:32:08 +00:00
Jan Schmidt
6b67fdf2ef glwindow: Fix g_return_val_if_fail in a void function 2017-12-09 19:32:08 +00:00
Matthew Waters
25c109f850 glimagesink: request a resize on caps/3d mode changes
Fixes incorrect aspect ratio on OSX when changing caps or the 3d
output mode.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters
63bbe9406a glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio
  changes resulting from either caps changes or 3d output mode changes.
- Performing a glViewport outside the GstGLWindow::resize callback
  will not have the winsys' stack of viewports required to correctly
  place the output frame.

Provide a function to request a resize on the next draw event from the
winsys.

Also track size changes inside the base GstGLWindow class rather
than in each subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters
817f05cd70 gl/uploadelement: fail earlier if we could not upload the buffer 2017-12-09 19:32:08 +00:00