mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
glmemory: Only use glDrawBuffer if available
Otherwise fall back to glDrawBuffers. Also check if glReadBuffer exists before using it. glDrawBuffer does not exist for GLES, only glDrawBuffers does. https://bugzilla.gnome.org/show_bug.cgi?id=782376
This commit is contained in:
parent
ea6e58d27f
commit
0730a55af3
1 changed files with 15 additions and 2 deletions
|
@ -672,7 +672,8 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
||||||
"texture %i", src, src_tex_id, tex_id);
|
"texture %i", src, src_tex_id, tex_id);
|
||||||
|
|
||||||
/* FIXME: try and avoid creating and destroying fbo's every copy... */
|
/* FIXME: try and avoid creating and destroying fbo's every copy... */
|
||||||
if (!gl->BlitFramebuffer) {
|
if (!gl->BlitFramebuffer || (!gl->DrawBuffer && !gl->DrawBuffers)
|
||||||
|
|| !gl->ReadBuffer) {
|
||||||
/* create a framebuffer object */
|
/* create a framebuffer object */
|
||||||
n_fbos = 1;
|
n_fbos = 1;
|
||||||
gl->GenFramebuffers (n_fbos, &fbo[0]);
|
gl->GenFramebuffers (n_fbos, &fbo[0]);
|
||||||
|
@ -696,6 +697,12 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
||||||
|
|
||||||
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
|
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
|
||||||
} else {
|
} else {
|
||||||
|
GLenum multipleRT[] = {
|
||||||
|
GL_COLOR_ATTACHMENT0,
|
||||||
|
GL_COLOR_ATTACHMENT1,
|
||||||
|
GL_COLOR_ATTACHMENT2
|
||||||
|
};
|
||||||
|
|
||||||
/* create a framebuffer object */
|
/* create a framebuffer object */
|
||||||
n_fbos = 2;
|
n_fbos = 2;
|
||||||
gl->GenFramebuffers (n_fbos, &fbo[0]);
|
gl->GenFramebuffers (n_fbos, &fbo[0]);
|
||||||
|
@ -719,7 +726,10 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
||||||
gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
|
gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
|
||||||
GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "BlitFramebuffer took");
|
GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "BlitFramebuffer took");
|
||||||
gl->ReadBuffer (GL_COLOR_ATTACHMENT0);
|
gl->ReadBuffer (GL_COLOR_ATTACHMENT0);
|
||||||
gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
|
if (gl->DrawBuffers)
|
||||||
|
gl->DrawBuffers (1, multipleRT);
|
||||||
|
else
|
||||||
|
gl->DrawBuffer (GL_COLOR_ATTACHMENT0);
|
||||||
gl->BlitFramebuffer (0, 0, out_width, out_height,
|
gl->BlitFramebuffer (0, 0, out_width, out_height,
|
||||||
0, 0, out_width, out_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
0, 0, out_width, out_height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||||
gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
|
gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
|
||||||
|
@ -729,6 +739,9 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
||||||
gl->BindFramebuffer (GL_READ_FRAMEBUFFER, 0);
|
gl->BindFramebuffer (GL_READ_FRAMEBUFFER, 0);
|
||||||
|
|
||||||
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
|
gl->DeleteFramebuffers (n_fbos, &fbo[0]);
|
||||||
|
|
||||||
|
if (gl->DrawBuffer)
|
||||||
|
gl->DrawBuffer (GL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
|
gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
|
||||||
|
|
Loading…
Reference in a new issue