gfx: add GfxStagingBuffer
This commit is contained in:
parent
1462933ef4
commit
3619a51fbd
11 changed files with 215 additions and 43 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
gfx_api::{AsyncShmGfxTextureCallback, GfxError, PendingShmUpload},
|
||||
gfx_api::{AsyncShmGfxTextureCallback, GfxError, PendingShmUpload, STAGING_UPLOAD},
|
||||
ifs::{
|
||||
wl_buffer::WlBufferStorage,
|
||||
wl_surface::{PendingState, WlSurface, WlSurfaceError},
|
||||
|
|
@ -459,8 +459,28 @@ fn schedule_async_upload(
|
|||
back_tex
|
||||
}
|
||||
};
|
||||
let mut staging_opt = surface.shm_staging.get();
|
||||
if let Some(staging) = &staging_opt {
|
||||
if staging.size() != back_tex.staging_size() {
|
||||
staging_opt = None;
|
||||
}
|
||||
}
|
||||
let staging = match staging_opt {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
let s = surface
|
||||
.client
|
||||
.state
|
||||
.render_ctx
|
||||
.get()
|
||||
.ok_or(WlSurfaceError::NoRenderContext)?
|
||||
.create_staging_buffer(back_tex.staging_size(), STAGING_UPLOAD);
|
||||
surface.shm_staging.set(Some(s.clone()));
|
||||
s
|
||||
}
|
||||
};
|
||||
back_tex
|
||||
.async_upload(node_ref.clone(), mem.clone(), back.damage.get())
|
||||
.async_upload(&staging, node_ref.clone(), mem.clone(), back.damage.get())
|
||||
.map_err(WlSurfaceError::PrepareAsyncUpload)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue