diff --git a/Cargo.lock b/Cargo.lock index 90c4ab184..0ec1b37c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -475,8 +475,8 @@ dependencies = [ [[package]] name = "gfx-auxil" -version = "0.5.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.8.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "fxhash", "gfx-hal", @@ -485,8 +485,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx11" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "arrayvec", "bitflags", @@ -506,8 +506,8 @@ dependencies = [ [[package]] name = "gfx-backend-dx12" -version = "0.6.2" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "arrayvec", "bit-set", @@ -526,8 +526,8 @@ dependencies = [ [[package]] name = "gfx-backend-empty" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "gfx-hal", "log", @@ -536,8 +536,8 @@ dependencies = [ [[package]] name = "gfx-backend-gl" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "arrayvec", "bitflags", @@ -558,8 +558,8 @@ dependencies = [ [[package]] name = "gfx-backend-metal" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "arrayvec", "bitflags", @@ -582,8 +582,8 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" -version = "0.6.5" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "arrayvec", "ash", @@ -602,8 +602,8 @@ dependencies = [ [[package]] name = "gfx-hal" -version = "0.6.0" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.7.0" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" dependencies = [ "bitflags", "naga", @@ -878,8 +878,8 @@ dependencies = [ [[package]] name = "metal" -version = "0.20.1" -source = "git+https://github.com/gfx-rs/metal-rs?rev=9a12f4e7e7030f41675d1b438c88f9dd75a994cd#9a12f4e7e7030f41675d1b438c88f9dd75a994cd" +version = "0.21.0" +source = "git+https://github.com/gfx-rs/metal-rs?rev=439c986eb7a9b91e88b61def2daa66e4043fcbef#439c986eb7a9b91e88b61def2daa66e4043fcbef" dependencies = [ "bitflags", "block", @@ -934,8 +934,8 @@ dependencies = [ [[package]] name = "naga" -version = "0.2.0" -source = "git+https://github.com/gfx-rs/naga?tag=gfx-8#4a13ce022b666a4896ba1dbcbd82121e8b06ad3e" +version = "0.3.1" +source = "git+https://github.com/gfx-rs/naga?tag=gfx-9#c12003f5648fcade5f20c01debc4cb12bd47073e" dependencies = [ "bit-set", "bitflags", @@ -1200,8 +1200,8 @@ dependencies = [ [[package]] name = "range-alloc" -version = "0.1.1" -source = "git+https://github.com/gfx-rs/gfx?rev=2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8#2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" +version = "0.1.2" +source = "git+https://github.com/gfx-rs/gfx?rev=d54cdcfac68711a91b55682c56da09f8e5b6f4e7#d54cdcfac68711a91b55682c56da09f8e5b6f4e7" [[package]] name = "raw-window-handle" @@ -1788,7 +1788,7 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.6.0" +version = "0.7.0" dependencies = [ "arrayvec", "bitflags", @@ -1830,7 +1830,7 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.6.0" +version = "0.7.0" dependencies = [ "bitflags", "serde", diff --git a/README.md b/README.md index 15f05f9a2..2fc94d389 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This is the core logic of an experimental [WebGPU](https://www.w3.org/community/ The implementation consists of the following parts: - [![Crates.io](https://img.shields.io/crates/v/wgpu-core.svg?label=wgpu-core)](https://crates.io/crates/wgpu-core) [![docs.rs](https://docs.rs/wgpu-core/badge.svg)](https://docs.rs/wgpu-core/) - internal Rust API for WebGPU implementations to use - - [![Crates.io](https://img.shields.io/crates/v/wgpu-types.svg?label=wgpu-types)](https://crates.io/crates/wgpu-types) [![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/) - Rust types shared between `wgpu-core`, `wgpu-native`, and `wgpu-rs` + - [![Crates.io](https://img.shields.io/crates/v/wgpu-types.svg?label=wgpu-types)](https://crates.io/crates/wgpu-types) [![docs.rs](https://docs.rs/wgpu-types/badge.svg)](https://docs.rs/wgpu-types/) - Rust types shared between `wgpu-core` and `wgpu-rs` - `player` - standalone application for replaying the API traces, uses `winit` This repository contains the core of `wgpu`, and is not usable directly by applications. @@ -23,10 +23,10 @@ If you are looking for the native implementation or bindings to the API in other API | Windows 7/10 | Linux & Android | macOS & iOS | ----- | ------------------ | ------------------ | ------------------ | - DX11 | :white_check_mark: | | | - DX12 | :heavy_check_mark: | | | - Vulkan | :heavy_check_mark: | :heavy_check_mark: | | - Metal | | | :heavy_check_mark: | - OpenGL | | :construction: | :construction: | + DX11 | :ok: | | | + DX12 | :white_check_mark: | | | + Vulkan | :white_check_mark: | :white_check_mark: | | + Metal | | | :white_check_mark: | + GL ES3 | | :construction: | | -:heavy_check_mark: = Primary support — :white_check_mark: = Secondary support — :construction: = Unsupported, but support in progress +:white_check_mark: = Primary support — :ok: = Secondary support — :construction: = Unsupported, but support in progress diff --git a/dummy/Cargo.toml b/dummy/Cargo.toml index 3d253f05e..37de0d180 100644 --- a/dummy/Cargo.toml +++ b/dummy/Cargo.toml @@ -12,5 +12,4 @@ publish = false [dependencies.wgc] path = "../wgpu-core" package = "wgpu-core" -version = "0.6" features = ["serial-pass", "trace"] diff --git a/player/Cargo.toml b/player/Cargo.toml index 2ecdd631c..64604b4e0 100644 --- a/player/Cargo.toml +++ b/player/Cargo.toml @@ -25,13 +25,11 @@ winit = { version = "0.24", optional = true } [dependencies.wgt] path = "../wgpu-types" package = "wgpu-types" -version = "0.6" features = ["replay"] [dependencies.wgc] path = "../wgpu-core" package = "wgpu-core" -version = "0.6" features = ["replay", "raw-window-handle"] #[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies.gfx-backend-metal] diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 453d779c6..26c987f99 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-core" -version = "0.6.0" +version = "0.7.0" authors = ["wgpu developers"] edition = "2018" description = "WebGPU core logic on gfx-hal" @@ -36,34 +36,34 @@ thiserror = "1" gpu-alloc = { version = "0.3", features = ["tracing"] } gpu-descriptor = { version = "0.1", features = ["tracing"] } -hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" } -gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" } +hal = { package = "gfx-hal", git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } +gfx-backend-empty = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } [target.'cfg(all(not(target_arch = "wasm32"), all(unix, not(target_os = "ios"), not(target_os = "macos"))))'.dependencies] -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", features = ["naga"] } -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", features = ["naga"] } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } [target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies] -gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", features = ["naga"] } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", optional = true } +gfx-backend-metal = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", optional = true } [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] -gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" } -gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8" } -gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", features = ["naga"] } +gfx-backend-dx12 = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } +gfx-backend-dx11 = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7" } +gfx-backend-vulkan = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "2fd74dbe1562a3eef05b11dcd300c1c9c9bc12a8", features = ["naga"] } +gfx-backend-gl = { git = "https://github.com/gfx-rs/gfx", rev = "d54cdcfac68711a91b55682c56da09f8e5b6f4e7", features = ["naga"] } [dependencies.naga] git = "https://github.com/gfx-rs/naga" -tag = "gfx-8" +tag = "gfx-9" features = ["spv-in", "spv-out", "wgsl-in"] [dependencies.wgt] path = "../wgpu-types" package = "wgpu-types" -version = "0.6" +version = "0.7" [dev-dependencies] loom = "0.3" diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index f30fe89b6..e54911c3a 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -28,7 +28,7 @@ const CLEANUP_WAIT_MS: u64 = 5000; /// A struct that keeps lists of resources that are no longer needed by the user. #[derive(Debug, Default)] -pub struct SuspectedResources { +pub(super) struct SuspectedResources { pub(crate) buffers: Vec>, pub(crate) textures: Vec>, pub(crate) texture_views: Vec>, @@ -43,7 +43,7 @@ pub struct SuspectedResources { } impl SuspectedResources { - pub(crate) fn clear(&mut self) { + pub(super) fn clear(&mut self) { self.buffers.clear(); self.textures.clear(); self.texture_views.clear(); @@ -57,7 +57,7 @@ impl SuspectedResources { self.query_sets.clear(); } - pub(crate) fn extend(&mut self, other: &Self) { + pub(super) fn extend(&mut self, other: &Self) { self.buffers.extend_from_slice(&other.buffers); self.textures.extend_from_slice(&other.textures); self.texture_views.extend_from_slice(&other.texture_views); @@ -75,7 +75,7 @@ impl SuspectedResources { self.query_sets.extend_from_slice(&other.query_sets); } - pub(crate) fn add_trackers(&mut self, trackers: &TrackerSet) { + pub(super) fn add_trackers(&mut self, trackers: &TrackerSet) { self.buffers.extend(trackers.buffers.used()); self.textures.extend(trackers.textures.used()); self.texture_views.extend(trackers.views.used()); @@ -216,7 +216,7 @@ pub enum WaitIdleError { /// 3. When `ActiveSubmission` is retired, the mapped buffers associated with it are moved to `ready_to_map` vector. /// 4. Finally, `handle_mapping` issues all the callbacks. #[derive(Debug)] -pub(crate) struct LifetimeTracker { +pub(super) struct LifetimeTracker { /// Resources that the user has requested be mapped, but are still in use. mapped: Vec>, /// Buffers can be used in a submission that is yet to be made, by the @@ -375,7 +375,7 @@ impl LifetimeTracker { } impl LifetimeTracker { - pub(crate) fn triage_suspected( + pub(super) fn triage_suspected( &mut self, hub: &Hub, trackers: &Mutex, @@ -636,7 +636,7 @@ impl LifetimeTracker { } } - pub(crate) fn triage_mapped( + pub(super) fn triage_mapped( &mut self, hub: &Hub, token: &mut Token>, @@ -666,7 +666,7 @@ impl LifetimeTracker { } } - pub(crate) fn handle_mapping( + pub(super) fn handle_mapping( &mut self, hub: &Hub, raw: &B::Device, diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 0cc5f46de..1b322db41 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -44,7 +44,7 @@ use std::{ pub mod alloc; pub mod descriptor; mod life; -mod queue; +pub mod queue; #[cfg(any(feature = "trace", feature = "replay"))] pub mod trace; @@ -379,7 +379,7 @@ impl Device { tracker.lock() } - pub(crate) fn lock_life<'this, 'token: 'this>( + fn lock_life<'this, 'token: 'this>( &'this self, //TODO: fix this - the token has to be borrowed for the lock token: &mut Token<'token, Self>, diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index ebbec17a0..e39bb9534 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -18,7 +18,7 @@ use crate::{ span, FastHashMap, FastHashSet, }; -use hal::{command::CommandBuffer as _, device::Device as _, queue::CommandQueue as _}; +use hal::{command::CommandBuffer as _, device::Device as _, queue::Queue as _}; use smallvec::SmallVec; use std::{iter, ops::Range, ptr}; use thiserror::Error; @@ -148,6 +148,10 @@ impl super::Device { } } +#[error("queue is invalid")] +#[derive(Clone, Debug, Error)] +pub struct InvalidQueue; + #[derive(Clone, Debug, Error)] pub enum QueueWriteError { #[error(transparent)] @@ -809,6 +813,21 @@ impl Global { Ok(()) } + + pub fn queue_get_timestamp_period( + &self, + queue_id: id::QueueId, + ) -> Result { + span!(_guard, INFO, "Queue::get_timestamp_period"); + + let hub = B::hub(self); + let mut token = Token::root(); + let (device_guard, _) = hub.devices.read(&mut token); + match device_guard.get(queue_id) { + Ok(device) => Ok(device.queue_group.queues[0].timestamp_period()), + Err(_) => Err(InvalidQueue), + } + } } fn get_lowest_common_denom(a: u32, b: u32) -> u32 { diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index d346c3e15..f31e43d3e 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -208,7 +208,6 @@ impl Adapter { .format_properties(Some(hal::format::Format::D24UnormS8Uint)) .optimal_tiling .contains(hal::format::ImageFeature::DEPTH_STENCIL_ATTACHMENT), - timestamp_period: adapter_limits.timestamp_period, }; let default_limits = wgt::Limits::default(); @@ -877,22 +876,6 @@ impl Global { .map_err(|_| InvalidAdapter) } - pub fn adapter_get_timestamp_period( - &self, - adapter_id: AdapterId, - ) -> Result { - span!(_guard, INFO, "Adapter::get_timestamp_period"); - - let hub = B::hub(self); - let mut token = Token::root(); - let (adapter_guard, _) = hub.adapters.read(&mut token); - - adapter_guard - .get(adapter_id) - .map(|adapter| adapter.private_features.timestamp_period) - .map_err(|_| InvalidAdapter) - } - pub fn adapter_drop(&self, adapter_id: AdapterId) { span!(_guard, INFO, "Adapter::drop"); diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 6b102ce3e..4fb7843c9 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -223,7 +223,6 @@ struct PrivateFeatures { anisotropic_filtering: bool, texture_d24: bool, texture_d24_s8: bool, - timestamp_period: f32, } #[macro_export] diff --git a/wgpu-core/src/swap_chain.rs b/wgpu-core/src/swap_chain.rs index 262cb3321..14bbcd392 100644 --- a/wgpu-core/src/swap_chain.rs +++ b/wgpu-core/src/swap_chain.rs @@ -44,7 +44,7 @@ use crate::{ LifeGuard, PrivateFeatures, Stored, SubmissionIndex, }; -use hal::{queue::CommandQueue as _, window::PresentationSurface as _}; +use hal::{queue::Queue as _, window::PresentationSurface as _}; use thiserror::Error; use wgt::{SwapChainDescriptor, SwapChainStatus}; diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index bc23adb40..5821f2ddb 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-types" -version = "0.6.0" +version = "0.7.0" authors = ["wgpu developers"] edition = "2018" description = "WebGPU types"