mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[metal] remove extraneous main thread check (#7692)
This commit is contained in:
parent
1268219ba3
commit
921c6ab597
@ -80,6 +80,10 @@ Naga now infers the correct binding layout when a resource appears only in an as
|
||||
|
||||
- Get `vertex_index` & `instance_index` builtins working for indirect draws. By @teoxoy in [#7535](https://github.com/gfx-rs/wgpu/pull/7535)
|
||||
|
||||
#### Metal
|
||||
|
||||
- Remove extraneous main thread warning in `fn surface_capabilities()`. By @jamesordner in [#7692](https://github.com/gfx-rs/wgpu/pull/7692)
|
||||
|
||||
### Changes
|
||||
|
||||
- Loosen Viewport validation requirements to match the [new specs](https://github.com/gpuweb/gpuweb/pull/5025). By @ebbdrop in [#7564](https://github.com/gfx-rs/wgpu/pull/7564)
|
||||
|
||||
@ -7,7 +7,6 @@ use parking_lot::Mutex;
|
||||
use wgt::{AstcBlock, AstcChannel};
|
||||
|
||||
use alloc::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
use super::TimestampQuerySupport;
|
||||
|
||||
@ -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,
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
@ -109,6 +107,13 @@ impl super::Surface {
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the current dimensions of the `Surface`.
|
||||
///
|
||||
/// This function is safe to call off of the main thread. However, note that
|
||||
/// `bounds` and `contentsScale` may be modified by the main thread while
|
||||
/// this function is running, possibly resulting in the two values being out
|
||||
/// of sync. This is sound, as these properties are accessed atomically.
|
||||
/// See: <https://github.com/gfx-rs/wgpu/pull/7692>
|
||||
pub(super) fn dimensions(&self) -> wgt::Extent3d {
|
||||
let (size, scale): (CGSize, CGFloat) = unsafe {
|
||||
let render_layer_borrow = self.render_layer.lock();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user