render: don't require framebuffer to perform shm screencopies
This commit is contained in:
parent
69d63b7e83
commit
9de63bddf3
12 changed files with 65 additions and 76 deletions
|
|
@ -6,7 +6,7 @@ use {
|
|||
ResetStatus,
|
||||
},
|
||||
gfx_apis::gl::{
|
||||
egl::{context::EglContext, display::EglDisplay},
|
||||
egl::{context::EglContext, display::EglDisplay, image::EglImage},
|
||||
ext::GL_OES_EGL_IMAGE_EXTERNAL,
|
||||
gl::{
|
||||
program::GlProgram, render_buffer::GlRenderBuffer, sys::GLint, texture::GlTexture,
|
||||
|
|
@ -190,6 +190,20 @@ impl GlRenderContext {
|
|||
format,
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn image_to_fb(
|
||||
self: &Rc<Self>,
|
||||
img: &Rc<EglImage>,
|
||||
) -> Result<Rc<Framebuffer>, RenderError> {
|
||||
self.ctx.with_current(|| unsafe {
|
||||
let rb = GlRenderBuffer::from_image(img, &self.ctx)?;
|
||||
let fb = rb.create_framebuffer()?;
|
||||
Ok(Rc::new(Framebuffer {
|
||||
ctx: self.clone(),
|
||||
gl: fb,
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl GfxContext for GlRenderContext {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue