mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
hal/mtl: check for next_drawable() result
This commit is contained in:
1 parent
df3cc81f88
commit
4f677c8b67
1 file changed
+8
-4
@@ -265,10 +265,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(|| {
|
||||
let drawable = render_layer.next_drawable().unwrap();
|
||||
(drawable.to_owned(), drawable.texture().to_owned())
|
||||
});
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user