render: add abstraction for async-upload storage
This commit is contained in:
parent
d99444bd3c
commit
ca134e683b
8 changed files with 149 additions and 93 deletions
|
|
@ -1,10 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
clientmem::ClientMemOffset,
|
||||
format::Format,
|
||||
gfx_api::{
|
||||
AsyncShmGfxTexture, AsyncShmGfxTextureCallback, GfxError, GfxTexture, PendingShmUpload,
|
||||
ShmGfxTexture,
|
||||
ShmGfxTexture, ShmMemory,
|
||||
},
|
||||
gfx_apis::gl::{
|
||||
gl::texture::GlTexture,
|
||||
|
|
@ -102,12 +101,15 @@ impl AsyncShmGfxTexture for Texture {
|
|||
fn async_upload(
|
||||
self: Rc<Self>,
|
||||
_callback: Rc<dyn AsyncShmGfxTextureCallback>,
|
||||
mem: &Rc<ClientMemOffset>,
|
||||
damage: Region,
|
||||
mem: Rc<dyn ShmMemory>,
|
||||
_damage: Region,
|
||||
) -> Result<Option<PendingShmUpload>, GfxError> {
|
||||
mem.access(|data| self.clone().sync_upload(data, damage))
|
||||
.map_err(RenderError::AccessFailed)??;
|
||||
Ok(None)
|
||||
let mut res = Ok(());
|
||||
mem.access(&mut |data| {
|
||||
res = self.clone().sync_upload(data, Region::default());
|
||||
})
|
||||
.map_err(RenderError::AccessFailed)?;
|
||||
res.map(|_| None)
|
||||
}
|
||||
|
||||
fn sync_upload(self: Rc<Self>, data: &[Cell<u8>], _damage: Region) -> Result<(), GfxError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue