Skip to content

[metal] remove extraneous main thread check #7692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use parking_lot::Mutex;
use wgt::{AstcBlock, AstcChannel};

use alloc::sync::Arc;
use std::thread;

use super::TimestampQuerySupport;

Expand Down Expand Up @@ -342,13 +341,6 @@ impl crate::Adapter for super::Adapter {
&self,
surface: &super::Surface,
) -> Option<crate::SurfaceCapabilities> {
let current_extent = if surface.main_thread_id == thread::current().id() {
Some(surface.dimensions())
} else {
log::warn!("Unable to get the current view dimensions on a non-main thread");
None
};

let mut formats = vec![
wgt::TextureFormat::Bgra8Unorm,
wgt::TextureFormat::Bgra8UnormSrgb,
Expand Down Expand Up @@ -380,7 +372,7 @@ impl crate::Adapter for super::Adapter {
wgt::CompositeAlphaMode::PostMultiplied,
],

current_extent,
current_extent: Some(surface.dimensions()),
usage: wgt::TextureUses::COLOR_TARGET
| wgt::TextureUses::COPY_SRC
| wgt::TextureUses::COPY_DST
Expand Down
2 changes: 0 additions & 2 deletions wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ mod time;

use alloc::{borrow::ToOwned as _, string::String, sync::Arc, vec::Vec};
use core::{fmt, iter, ops, ptr::NonNull, sync::atomic};
use std::thread;

use arrayvec::ArrayVec;
use bitflags::bitflags;
Expand Down Expand Up @@ -376,7 +375,6 @@ pub struct Surface {
render_layer: Mutex<metal::MetalLayer>,
swapchain_format: RwLock<Option<wgt::TextureFormat>>,
extent: RwLock<wgt::Extent3d>,
main_thread_id: thread::ThreadId,
// Useful for UI-intensive applications that are sensitive to
// window resizing.
pub present_with_transaction: bool,
Expand Down
2 changes: 0 additions & 2 deletions wgpu-hal/src/metal/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use alloc::borrow::ToOwned as _;
use core::mem::ManuallyDrop;
use core::ptr::NonNull;
use std::thread;

use core_graphics_types::{
base::CGFloat,
Expand All @@ -29,7 +28,6 @@ impl super::Surface {
render_layer: Mutex::new(layer),
swapchain_format: RwLock::new(None),
extent: RwLock::new(wgt::Extent3d::default()),
main_thread_id: thread::current().id(),
present_with_transaction: false,
}
}
Expand Down