1
0
Fork 0
forked from wry/wry

metal: implement direct scanout

This commit is contained in:
Julian Orth 2024-02-18 20:29:23 +01:00
parent fed2ceb8b5
commit da84e9ec27
25 changed files with 682 additions and 148 deletions

View file

@ -186,6 +186,7 @@ impl GlRenderContext {
Ok(Rc::new(Texture {
ctx: self.clone(),
gl,
resv: Default::default(),
}))
}
}

View file

@ -28,6 +28,7 @@ impl Image {
Ok(Rc::new(Texture {
ctx: self.ctx.clone(),
gl: GlTexture::import_img(&self.ctx.ctx, &self.gl)?,
resv: Default::default(),
}))
}

View file

@ -1,7 +1,7 @@
use {
crate::{
format::Format,
gfx_api::{GfxError, GfxTexture},
gfx_api::{GfxError, GfxTexture, TextureReservations},
gfx_apis::gl::{gl::texture::GlTexture, renderer::context::GlRenderContext, RenderError},
video::dmabuf::DmaBuf,
},
@ -16,6 +16,7 @@ use {
pub struct Texture {
pub(in crate::gfx_apis::gl) ctx: Rc<GlRenderContext>,
pub(in crate::gfx_apis::gl) gl: GlTexture,
pub(in crate::gfx_apis::gl) resv: TextureReservations,
}
impl Debug for Texture {
@ -63,4 +64,8 @@ impl GfxTexture for Texture {
fn dmabuf(&self) -> Option<&DmaBuf> {
self.gl.img.as_ref().map(|i| &i.dmabuf)
}
fn reservations(&self) -> &TextureReservations {
&self.resv
}
}