mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
gstqsg6material: create OESExternal RhiTexture if necessary
The RhiTexture must be created with the OESExternal flag, if the gl_mem is a OESExternal buffer. Otherwise, Qt will create a Texture 2D texture and ignore the previously negotiated texture target. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7319>
This commit is contained in:
parent
c91e002b5e
commit
429042fb70
1 changed files with 7 additions and 2 deletions
|
@ -561,6 +561,7 @@ GstQSGMaterial::bind(GstQSGMaterialShader *shader, QRhi * rhi, QRhiResourceUpdat
|
|||
GstQSGTexture *ret;
|
||||
QRhiTexture *rhi_tex;
|
||||
QSize tex_size;
|
||||
QRhiTexture::Flags flags = {};
|
||||
|
||||
qt_context = GST_GL_CONTEXT (g_weak_ref_get (&this->qt_context_ref_));
|
||||
if (!qt_context)
|
||||
|
@ -585,7 +586,10 @@ GstQSGMaterial::bind(GstQSGMaterialShader *shader, QRhi * rhi, QRhiResourceUpdat
|
|||
|
||||
tex_size = QSize(gst_gl_memory_get_texture_width(gl_mem), gst_gl_memory_get_texture_height (gl_mem));
|
||||
|
||||
rhi_tex = rhi->newTexture (video_format_to_rhi_format (v_format, plane), tex_size, 1, {});
|
||||
if (gl_mem->tex_target == GST_GL_TEXTURE_TARGET_EXTERNAL_OES)
|
||||
flags |= QRhiTexture::ExternalOES;
|
||||
|
||||
rhi_tex = rhi->newTexture (video_format_to_rhi_format (v_format, plane), tex_size, 1, flags);
|
||||
rhi_tex->createFrom({(guint64) tex_id, 0});
|
||||
|
||||
sync_meta = gst_buffer_get_gl_sync_meta (this->sync_buffer_);
|
||||
|
@ -596,7 +600,8 @@ GstQSGMaterial::bind(GstQSGMaterialShader *shader, QRhi * rhi, QRhiResourceUpdat
|
|||
|
||||
gst_gl_sync_meta_wait (sync_meta, qt_context);
|
||||
|
||||
GST_LOG ("%p binding GL texture %u for plane %d", this, tex_id, plane);
|
||||
GST_LOG ("%p binding GL texture %u (%s) for plane %d",
|
||||
this, tex_id, gst_gl_texture_target_to_string(gl_mem->tex_target), plane);
|
||||
|
||||
out:
|
||||
if (G_UNLIKELY (use_dummy_tex)) {
|
||||
|
|
Loading…
Reference in a new issue