1
0
Fork 0
forked from wry/wry

gfx-api: add support for syncobj synchronization

This commit is contained in:
Julian Orth 2026-03-01 20:29:53 +01:00
parent 80a69ba7ef
commit 7e6facf4e3
20 changed files with 323 additions and 159 deletions

View file

@ -6,9 +6,9 @@ use {
},
format::Format,
gfx_api::{
AcquireSync, AsyncShmGfxTextureCallback, GfxApiOpt, GfxBlendBuffer, GfxError,
AcquireSync, AsyncShmGfxTextureCallback, FdSync, GfxApiOpt, GfxBlendBuffer, GfxError,
GfxFramebuffer, GfxInternalFramebuffer, GfxStagingBuffer, PendingShmTransfer,
ReleaseSync, ShmMemory, SyncFile,
ReleaseSync, ShmMemory,
},
gfx_apis::gl::{
RenderError,
@ -74,7 +74,7 @@ impl Framebuffer {
acquire_sync: AcquireSync,
ops: &[GfxApiOpt],
clear: Option<&Color>,
) -> Result<Option<SyncFile>, RenderError> {
) -> Result<Option<FdSync>, RenderError> {
let gles = self.ctx.ctx.dpy.gles;
self.ctx.ctx.with_current(|| {
handle_explicit_sync(&self.ctx, self.gl.rb._img.as_ref(), &acquire_sync);
@ -88,13 +88,13 @@ impl Framebuffer {
}
(gles.glBlendFunc)(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
let fd = run_ops(self, ops);
if fd.is_none() {
let sync = run_ops(self, ops);
if sync.is_none() {
unsafe {
(gles.glFinish)();
}
}
Ok(fd)
Ok(sync)
})
}
}
@ -115,7 +115,7 @@ impl GfxFramebuffer for Framebuffer {
_region: &Region,
_blend_buffer: Option<&Rc<dyn GfxBlendBuffer>>,
_blend_cd: &Rc<ColorDescription>,
) -> Result<Option<SyncFile>, GfxError> {
) -> Result<Option<FdSync>, GfxError> {
(*self)
.render(acquire_sync, ops, clear)
.map_err(|e| e.into())