Skip to content

Commit

Permalink
fix a race in metal engine's surface allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
samizdatco committed Oct 24, 2024
1 parent 1e7be5e commit 9319b5a
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/gpu/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,25 @@ impl MetalEngine {
}

pub fn surface(image_info: &ImageInfo) -> Option<Surface> {
MTL_CONTEXT.with_borrow(|local_ctx| {
match local_ctx.is_some() || MetalEngine::supported(){
true => surfaces::render_target(
&mut local_ctx.as_ref()?.context.clone(),
Budgeted::Yes,
image_info,
Some(4),
SurfaceOrigin::BottomLeft,
None,
true,
None
),
false => None
}
})
if MetalEngine::supported() {
MTL_CONTEXT.with_borrow(|local_ctx| {
match local_ctx.is_some(){
true => surfaces::render_target(
&mut local_ctx.as_ref()?.context.clone(),
Budgeted::Yes,
image_info,
Some(4),
SurfaceOrigin::BottomLeft,
None,
true,
None
),
false => None
}
})
}else{
None
}
}

pub fn set_status(msg: Value) {
Expand Down

0 comments on commit 9319b5a

Please sign in to comment.