Skip to content

Commit 7305bc7

Browse files
ids1024Drakulix
authored andcommitted
gles: Factor out an export_sync_point() method
1 parent a92540d commit 7305bc7

File tree

1 file changed

+14
-7
lines changed
  • src/backend/renderer/gles

1 file changed

+14
-7
lines changed

src/backend/renderer/gles/mod.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,18 @@ impl GlesRenderer {
797797
pub fn capabilities(&self) -> &[Capability] {
798798
&self.capabilities
799799
}
800+
801+
fn export_sync_point(&self) -> Option<SyncPoint> {
802+
if self.capabilities.contains(&Capability::ExportFence) {
803+
if let Ok(fence) = EGLFence::create(self.egl.display()) {
804+
unsafe {
805+
self.gl.Flush();
806+
}
807+
return Some(SyncPoint::from(fence));
808+
}
809+
}
810+
None
811+
}
800812
}
801813

802814
#[cfg(feature = "wayland_frontend")]
@@ -2368,13 +2380,8 @@ impl GlesFrame<'_, '_> {
23682380
self.renderer.cleanup();
23692381

23702382
// if we support egl fences we should use it
2371-
if self.renderer.capabilities.contains(&Capability::ExportFence) {
2372-
if let Ok(fence) = EGLFence::create(self.renderer.egl.display()) {
2373-
unsafe {
2374-
self.renderer.gl.Flush();
2375-
}
2376-
return Ok(SyncPoint::from(fence));
2377-
}
2383+
if let Some(sync_point) = self.renderer.export_sync_point() {
2384+
return Ok(sync_point);
23782385
}
23792386

23802387
// as a last option we force finish, this is unlikely to happen

0 commit comments

Comments
 (0)