Skip to content

Commit

Permalink
[rs] Merge gfx-rs#738
Browse files Browse the repository at this point in the history
738: Update version and dependencies to gfx-9 r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <[email protected]>
  • Loading branch information
bors[bot] and kvark authored Feb 1, 2021
2 parents 1e3eac2 + 9755a46 commit 75cbc46
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 37 deletions.
11 changes: 8 additions & 3 deletions wgpu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions wgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand All @@ -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"] }
Expand All @@ -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]]
Expand Down
2 changes: 1 addition & 1 deletion wgpu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
```
Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/boids/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wgpu/examples/mipmap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
26 changes: 13 additions & 13 deletions wgpu/src/backend/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)]
Expand Down
8 changes: 4 additions & 4 deletions wgpu/src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = ();
Expand Down
16 changes: 8 additions & 8 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 75cbc46

Please sign in to comment.