diff --git a/wgpu/CHANGELOG.md b/wgpu/CHANGELOG.md index 0e2b840bfd..89060ad991 100644 --- a/wgpu/CHANGELOG.md +++ b/wgpu/CHANGELOG.md @@ -1,8 +1,13 @@ # Change Log -### unreleased -- introduce `ShaderModuleDescriptor` -- introduce `RenderEncoder` +### v0.7 (2021-01-31) +- See https://github.com/gfx-rs/wgpu/blob/v0.7/CHANGELOG.md#v07-2020-08-30 +- Features: + - (beta) WGSL support + - better error messages +- API changes: + - new `ShaderModuleDescriptor` + - new `RenderEncoder` ### v0.6.2 (2020-11-24) - don't panic in the staging belt if the channel is dropped diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 9d1c24922d..007063783f 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu" -version = "0.6.0" +version = "0.7.0" authors = ["wgpu developers"] edition = "2018" description = "Rusty WebGPU API wrapper" @@ -26,20 +26,20 @@ webgl = ["wgc"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "ac81f3e7562eff96ca854b462b0893c38ea98de2" +rev = "7c7501cab72fd01b14def06b9d9bc63a8dd44b45" features = ["raw-window-handle"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "ac81f3e7562eff96ca854b462b0893c38ea98de2" +rev = "7c7501cab72fd01b14def06b9d9bc63a8dd44b45" features = ["raw-window-handle"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "ac81f3e7562eff96ca854b462b0893c38ea98de2" +rev = "7c7501cab72fd01b14def06b9d9bc63a8dd44b45" [dependencies] arrayvec = "0.5" @@ -54,7 +54,7 @@ bytemuck = { version = "1.4", features = ["derive"] } cgmath = "0.18" ddsfile = "0.4" log = "0.4" -naga = { git = "https://github.com/gfx-rs/naga", tag = "gfx-8", features = ["wgsl-in"] } +naga = { git = "https://github.com/gfx-rs/naga", tag = "gfx-9", features = ["wgsl-in"] } noise = "0.7" png = "0.16" rand = { version = "0.7.2", features = ["wasm-bindgen"] } @@ -67,7 +67,7 @@ wgpu-subscriber = "0.1" [target.'cfg(target_arch = "wasm32")'.dependencies.naga] git = "https://github.com/gfx-rs/naga" -tag = "gfx-8" +tag = "gfx-9" features = ["wgsl-in", "spv-out"] [[example]] diff --git a/wgpu/README.md b/wgpu/README.md index cbf44ff1c3..ee7221b86a 100644 --- a/wgpu/README.md +++ b/wgpu/README.md @@ -100,7 +100,7 @@ tracing = { version = "0.1", features = ["log-always"] } If you need to test local fixes to gfx-rs or other dependencies, the simplest way is to add a Cargo patch. For example, when working on DX12 backend on Windows, you can check out the "hal-0.2" branch of gfx-rs repo and add this to the end of "Cargo.toml": ```toml -[patch.crates-io] +[patch."https://github.com/gfx-rs/gfx"] gfx-backend-dx12 = { path = "../gfx/src/backend/dx12" } gfx-hal = { path = "../gfx/src/hal" } ``` diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index f7587e39f6..7269577044 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -37,7 +37,7 @@ impl framework::Example for Example { // load and compile the shader let mut flags = wgpu::ShaderFlags::VALIDATION; match adapter.get_info().backend { - wgt::Backend::Vulkan => { + wgt::Backend::Vulkan | wgt::Backend::Metal => { flags |= wgpu::ShaderFlags::EXPERIMENTAL_TRANSLATION; } _ => {} //TODO diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index 9994cf4393..9a81e242d4 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -388,7 +388,7 @@ impl framework::Example for Example { }); // Timestamp queries use an device-specific timestamp unit. We need to figure out how many // nanoseconds go by for the timestamp to be incremented by one. The period is this value. - let timestamp_period = adapter.get_timestamp_period(); + let timestamp_period = queue.get_timestamp_period(); // We only need one pipeline statistics query per pass. let pipeline_statistics = device.create_query_set(&wgpu::QuerySetDescriptor { diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 7c5c24e54a..4c88eaeb59 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -741,19 +741,6 @@ impl crate::Context for Context { } } - fn adapter_get_timestamp_period(&self, adapter: &Self::AdapterId) -> f32 { - let global = &self.0; - let res = wgc::gfx_select!(adapter => global.adapter_get_timestamp_period( - *adapter - )); - match res { - Ok(v) => v, - Err(cause) => { - self.handle_error_fatal(cause, "Adapter::get_timestamp_period"); - } - } - } - fn adapter_get_info(&self, adapter: &wgc::id::AdapterId) -> AdapterInfo { let global = &self.0; match wgc::gfx_select!(*adapter => global.adapter_get_info(*adapter)) { @@ -1859,6 +1846,19 @@ impl crate::Context for Context { Err(err) => self.handle_error_fatal(err, "Queue::submit"), } } + + fn queue_get_timestamp_period(&self, queue: &Self::QueueId) -> f32 { + let global = &self.0; + let res = wgc::gfx_select!(queue => global.queue_get_timestamp_period( + *queue + )); + match res { + Ok(v) => v, + Err(cause) => { + self.handle_error_fatal(cause, "Queue::get_timestamp_period"); + } + } + } } #[derive(Debug)] diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 22502bdfa6..f5fb6716d0 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -946,10 +946,6 @@ impl crate::Context for Context { ) } - fn adapter_get_timestamp_period(&self, _adapter: &Self::AdapterId) -> f32 { - 1.0 //TODO - } - fn adapter_request_device( &self, adapter: &Self::AdapterId, @@ -1883,6 +1879,10 @@ impl crate::Context for Context { queue.0.submit(&temp_command_buffers); } + + fn queue_get_timestamp_period(&self, _queue: &Self::QueueId) -> f32 { + 1.0 //TODO + } } pub(crate) type SwapChainOutputDetail = (); diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index b69539462b..be5bd097cc 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -203,7 +203,6 @@ trait Context: Debug + Send + Sized + Sync { ) -> TextureFormat; fn adapter_features(&self, adapter: &Self::AdapterId) -> Features; fn adapter_limits(&self, adapter: &Self::AdapterId) -> Limits; - fn adapter_get_timestamp_period(&self, adapter: &Self::AdapterId) -> f32; fn adapter_get_info(&self, adapter: &Self::AdapterId) -> AdapterInfo; fn adapter_get_texture_format_features( &self, @@ -441,6 +440,7 @@ trait Context: Debug + Send + Sized + Sync { queue: &Self::QueueId, command_buffers: I, ); + fn queue_get_timestamp_period(&self, queue: &Self::QueueId) -> f32; } /// Context for all other wgpu objects. Instance of wgpu. @@ -1452,13 +1452,6 @@ impl Adapter { Context::adapter_limits(&*self.context, &self.id) } - /// Gets the amount of nanoseconds each tick of a timestamp query represents. - /// - /// Returns zero if timestamp queries are unsupported. - pub fn get_timestamp_period(&self) -> f32 { - Context::adapter_get_timestamp_period(&*self.context, &self.id) - } - /// Get info about the adapter itself. pub fn get_info(&self) -> AdapterInfo { Context::adapter_get_info(&*self.context, &self.id) @@ -2790,6 +2783,13 @@ impl Queue { .map(|mut comb| comb.id.take().unwrap()), ); } + + /// Gets the amount of nanoseconds each tick of a timestamp query represents. + /// + /// Returns zero if timestamp queries are unsupported. + pub fn get_timestamp_period(&self) -> f32 { + Context::queue_get_timestamp_period(&*self.context, &self.id) + } } impl Drop for SwapChainTexture {