Handling GLContext in GstAggregator Element (Rust)
Daniel Pendse
daniel.pendse at spiideo.com
Thu Nov 24 10:24:23 UTC 2022
Hi!
Working on a project to perform GL rendering based on multiple inputs in GLMemory using the gstreamer rust bindings.
From previous suggestions we decided to use the GstAggregator as a base class for our element. (Rust impl exists)
(See prev thread for more context: https://lists.freedesktop.org/archives/gstreamer-devel/2022-November/080619.html <https://lists.freedesktop.org/archives/gstreamer-devel/2022-November/080619.html>)
I have stumbled upon some issues with handling the GLContext when creating custom shaders. When I try to create a GLSL Stage I fail with:
* (gst-launch-1.0:93053): GStreamer-GL-CRITICAL **: 10:10:35.633: gst_gl_context_thread_add: assertion 'GST_IS_GL_CONTEXT (context)’ failed
It might seem that I fail to crate the context somehow or I don’t set it properly. How should the GLContext be handled using the aggregator as a base class?
I simply create the GLContext in the start method for my element and intent to pass the context trough to the methods where I intend to use GL calls.
// fn start
let gl_display = GLDisplay::new();
let gl_context = GLContext::new(&gl_display);
gl_context.activate(true).unwrap();
let shader_program = GLShader::new(gl_context);
let vertex_shader = GLSLStage::new_default_vertex(gl_context); // Crash
And also can I expect to input GLMemory and output GLMemory using this baseclass by using glupload/gldownload?
I am guessing that there might be a performance hit if I don’t input/output GLMemory, and instead handle that in the element..
I have previous successfully managed to get gl textures passing through the element like so feels like I am not handling the context correct.
(gst-launch-1.0 videotestsrc ! ... ! glupload ! <ELEMENT> ! gldownload ! ... ! autovideosink
Any tips and help is greatly appreciated!
Daniel Pendse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20221124/f4cd508d/attachment-0001.htm>
More information about the gstreamer-devel
mailing list