This commit is contained in:
xacrimon authored and Dzmitry Malyshau committed 2021-09-12 11:03:05 -04:00
1 parent abe41ccf9c
commit fc1cb5eb20
1 file changed
+8 -9
+8 -9
View File
@@ -267,15 +267,14 @@ impl crate::Surface<super::Api> for super::Surface {
_timeout_ms: u32, //TODO
) -> Result<Option<crate::AcquiredSurfaceTexture<super::Api>>, crate::SurfaceError> {
let render_layer = self.render_layer.lock();
let (drawable, texture) = autoreleasepool(|| {
if let Some(drawable) = render_layer.next_drawable() {
Ok((drawable.to_owned(), drawable.texture().to_owned()))
} else {
Err(crate::SurfaceError::Other(
"failed to allocate drawable due to metal resource exhaustion",
))
}
})?;
let (drawable, texture) = match autoreleasepool(|| {
render_layer
.next_drawable()
.map(|drawable| (drawable.to_owned(), drawable.texture().to_owned()))
}) {
Some(pair) => pair,
None => return Ok(None),
};
let suf_texture = super::SurfaceTexture {
texture: super::Texture {