gles2: Fixup cleanup of unused dmabuf-bindings

This commit is contained in:
Victor Brekenfeld 2021-06-18 23:32:23 +02:00 committed by Victor Berger
parent ce3b2d1eab
commit 268ad95767
1 changed files with 7 additions and 1 deletions

View File

@ -781,7 +781,12 @@ impl Bind<Dmabuf> for Gles2Renderer {
let mut i = 0; let mut i = 0;
while i != self.buffers.len() { while i != self.buffers.len() {
if self.buffers[i].dmabuf.upgrade().is_none() { if self.buffers[i].dmabuf.upgrade().is_none() {
self.buffers.remove(i); let weak = self.buffers.remove(i);
unsafe {
self.gl.DeleteFramebuffers(1, &weak.fbo as *const _);
self.gl.DeleteRenderbuffers(1, &weak.rbo as *const _);
ffi_egl::DestroyImageKHR(**self.egl.display.display, weak.image);
}
} else { } else {
i += 1; i += 1;
} }
@ -809,6 +814,7 @@ impl Bind<Dmabuf> for Gles2Renderer {
}) })
}) })
.unwrap_or_else(|| { .unwrap_or_else(|| {
trace!(self.logger, "Creating EGLImage for Dmabuf: {:?}", dmabuf);
let image = self let image = self
.egl .egl
.display .display