Skip to content

Commit

Permalink
Merge branch 'trunk' into bind-tranform
Browse files Browse the repository at this point in the history
  • Loading branch information
Vecvec authored Jan 7, 2025
2 parents e6d519f + 0dab31a commit d6b4dc8
Show file tree
Hide file tree
Showing 77 changed files with 1,507 additions and 792 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ jobs:
target: x86_64-pc-windows-msvc
kind: native

# Windows
- name: Windows aarch64
os: windows-2022
target: aarch64-pc-windows-msvc
kind: native

# MacOS
- name: MacOS x86_64
os: macos-14
Expand Down Expand Up @@ -629,7 +635,7 @@ jobs:
run: taplo format --check --diff

- name: Check for typos
uses: crate-ci/typos@v1.28.4
uses: crate-ci/typos@v1.29.4

check-cts-runner:
# runtime is normally 2 minutes
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ There are some limitations to keep in mind with this new functionality:

By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148](https://github.com/gfx-rs/wgpu/pull/6148), [#6533](https://github.com/gfx-rs/wgpu/pull/6533), [#6353](https://github.com/gfx-rs/wgpu/pull/6353), [#6537](https://github.com/gfx-rs/wgpu/pull/6537).

#### `wgpu::Instance::new` now takes `InstanceDescriptor` by reference

Previously `wgpu::Instance::new` took `InstanceDescriptor` by value (which is overall fairly uncommon in wgpu).
Furthermore, `InstanceDescriptor` is now cloneable.

```diff
- let instance = wgpu::Instance::new(instance_desc);
+ let instance = wgpu::Instance::new(&instance_desc);
```

By @wumpf in [#6849](https://github.com/gfx-rs/wgpu/pull/6849).

#### New Features

##### Naga
Expand All @@ -149,6 +161,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
- Return submission index in `map_async` and `on_submitted_work_done` to track down completion of async callbacks. By @eliemichel in [#6360](https://github.com/gfx-rs/wgpu/pull/6360).
- Move raytracing alignments into HAL instead of in core. By @Vecvec in [#6563](https://github.com/gfx-rs/wgpu/pull/6563).
- Allow for statically linking DXC rather than including separate `.dll` files. By @DouglasDwyer in [#6574](https://github.com/gfx-rs/wgpu/pull/6574).
- `DeviceType` and `AdapterInfo` now impl `Hash` by @cwfitzgerald in [#6868](https://github.com/gfx-rs/wgpu/pull/6868)

#### Changes

Expand All @@ -157,6 +170,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
- Show types of LHS and RHS in binary operation type mismatch errors. By @ErichDonGubler in [#6450](https://github.com/gfx-rs/wgpu/pull/6450).
- The GLSL parser now uses less expressions for function calls. By @magcius in [#6604](https://github.com/gfx-rs/wgpu/pull/6604).
- Add a note to help with a common syntax error case for global diagnostic filter directives. By @e-hat in [#6718](https://github.com/gfx-rs/wgpu/pull/6718)
- Change arithmetic operations between two i32 variables to wrap on overflow to match WGSL spec. By @matthew-wong1 in [#6835](https://github.com/gfx-rs/wgpu/pull/6835).

##### General

Expand All @@ -170,6 +184,10 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]

- Avoid using FXC as fallback when the DXC container was passed at instance creation. Paths to `dxcompiler.dll` & `dxil.dll` are also now required. By @teoxoy in [#6643](https://github.com/gfx-rs/wgpu/pull/6643).

##### Vulkan

- Add a cache for samplers, deduplicating any samplers, allowing more programs to stay within the global sampler limit. By @cwfitzgerald in [#6847](https://github.com/gfx-rs/wgpu/pull/6847)

##### HAL

- Replace `usage: Range<T>`, for `BufferUses`, `TextureUses`, and `AccelerationStructureBarrier` with a new `StateTransition<T>`. By @atlv24 in [#6703](https://github.com/gfx-rs/wgpu/pull/6703)
Expand Down Expand Up @@ -202,9 +220,15 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
- Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486)
- Emit an error in constant evaluation, rather than crash, in certain cases where `vecN` constructors have less than N arguments. By @ErichDonGubler in [#6508](https://github.com/gfx-rs/wgpu/pull/6508).

#### Vulkan

- Allocate descriptors for acceleration structures. By @Vecvec in [#6861](https://github.com/gfx-rs/wgpu/pull/6861).
- `max_color_attachment_bytes_per_sample` is now correctly set to 128. By @cwfitzgerald in [#6866](https://github.com/gfx-rs/wgpu/pull/6866)

#### D3D12

- Fix no longer showing software rasterizer adapters. By @wumpf in [#6843](https://github.com/gfx-rs/wgpu/pull/6843).
- `max_color_attachment_bytes_per_sample` is now correctly set to 128. By @cwfitzgerald in [#6866](https://github.com/gfx-rs/wgpu/pull/6866)

### Examples

Expand Down
51 changes: 31 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ noise = { version = "0.8", git = "https://github.com/Razaekel/noise-rs.git", rev
nv-flip = "0.1"
obj = "0.10"
once_cell = "1.20.2"
# Firefox has 3.4.0 vendored, so we allow that version in our dependencies
ordered-float = ">=3,<=4.6"
parking_lot = "0.12.1"
pico-args = { version = "0.5.0", features = [
"eq-separator",
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl DeviceState {
wgpu::Backends::all()
};

let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends: wgpu::util::backend_bits_from_env().unwrap_or(base_backend),
flags: wgpu::InstanceFlags::empty(),
dx12_shader_compiler: wgpu::util::dx12_shader_compiler_from_env()
Expand Down
2 changes: 1 addition & 1 deletion deno_webgpu/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub fn op_webgpu_request_adapter(
} else {
state.put(std::sync::Arc::new(wgpu_core::global::Global::new(
"webgpu",
wgpu_types::InstanceDescriptor {
&wgpu_types::InstanceDescriptor {
backends,
flags: wgpu_types::InstanceFlags::from_build_config(),
dx12_shader_compiler: wgpu_types::Dx12Compiler::Fxc,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl ExampleContext {
async fn init_async<E: Example>(surface: &mut SurfaceWrapper, window: Arc<Window>) -> Self {
log::info!("Initializing wgpu...");

let instance = wgpu::Instance::new(wgpu::util::instance_descriptor_from_env());
let instance = wgpu::Instance::new(&wgpu::util::instance_descriptor_from_env());
surface.pre_adapter(&instance, window);

let adapter = get_adapter_with_capabilities_or_from_env(
Expand Down
2 changes: 1 addition & 1 deletion examples/src/hello_triangle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
size.width = size.width.max(1);
size.height = size.height.max(1);

let instance = wgpu::Instance::new(wgpu::util::instance_descriptor_from_env());
let instance = wgpu::Instance::new(&wgpu::util::instance_descriptor_from_env());

let surface = instance.create_surface(&window).unwrap();
let adapter = instance
Expand Down
2 changes: 1 addition & 1 deletion examples/src/timestamp_queries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Queries {
async fn run() {
// Instantiates instance of wgpu
let backends = wgpu::util::backend_bits_from_env().unwrap_or_default();
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends,
flags: wgpu::InstanceFlags::from_build_config().with_env(),
dx12_shader_compiler: wgpu::Dx12Compiler::default(),
Expand Down
1 change: 1 addition & 0 deletions naga/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ log = "0.4"
spirv = { version = "0.3", optional = true }
thiserror.workspace = true
serde = { version = "1.0.217", features = ["derive"], optional = true }
# Hold on updating to 0.7 until https://github.com/petgraph/petgraph/pull/714 is on crates.io
petgraph = { version = "0.6", optional = true }
pp-rs = { version = "0.2.1", optional = true }
hexf-parse = { version = "0.2.1", optional = true }
Expand Down
7 changes: 6 additions & 1 deletion naga/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ authors = ["Automatically generated"]
publish = false
edition = "2018"
license = "MIT OR Apache-2.0"
build = "build.rs"

[package.metadata]
cargo-fuzz = true

[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies]
arbitrary = { version = "1.4.1", features = ["derive"] }
libfuzzer-sys = "0.4"
# See https://github.com/rust-fuzz/libfuzzer/issues/126
libfuzzer-sys = ">0.4.0,<=0.4.7"

[target.'cfg(not(any(target_arch = "wasm32", target_os = "ios")))'.dependencies.naga]
path = ".."
version = "23.0.0"
features = ["arbitrary", "spv-in", "wgsl-in", "glsl-in"]

[build-dependencies]
cfg_aliases.workspace = true

[[bin]]
name = "spv_parser"
path = "fuzz_targets/spv_parser.rs"
Expand Down
5 changes: 5 additions & 0 deletions naga/fuzz/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
cfg_aliases::cfg_aliases! {
enable_fuzzing: { not(any(target_arch = "wasm32", target_os = "ios", all(windows, target_arch = "aarch64"))) },
}
}
8 changes: 6 additions & 2 deletions naga/fuzz/fuzz_targets/glsl_parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
#![cfg_attr(enable_fuzzing, no_main)]

#[cfg(enable_fuzzing)]
mod fuzz {
use arbitrary::Arbitrary;
use libfuzzer_sys::fuzz_target;
Expand Down Expand Up @@ -47,3 +48,6 @@ mod fuzz {
let _result = parser.parse(&options.into(), &source);
});
}

#[cfg(not(enable_fuzzing))]
fn main() {}
8 changes: 6 additions & 2 deletions naga/fuzz/fuzz_targets/ir.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
#![cfg_attr(enable_fuzzing, no_main)]

#[cfg(enable_fuzzing)]
mod fuzz {
use libfuzzer_sys::fuzz_target;

Expand All @@ -12,3 +13,6 @@ mod fuzz {
let _result = validator.validate(&module);
});
}

#[cfg(not(enable_fuzzing))]
fn main() {}
8 changes: 6 additions & 2 deletions naga/fuzz/fuzz_targets/spv_parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
#![cfg_attr(enable_fuzzing, no_main)]

#[cfg(enable_fuzzing)]
mod fuzz {
use libfuzzer_sys::fuzz_target;
use naga::front::spv::{Frontend, Options};
Expand All @@ -10,3 +11,6 @@ mod fuzz {
let _result = Frontend::new(data.into_iter(), &options).parse();
});
}

#[cfg(not(enable_fuzzing))]
fn main() {}
8 changes: 6 additions & 2 deletions naga/fuzz/fuzz_targets/wgsl_parser.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_main]
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
#![cfg_attr(enable_fuzzing, no_main)]

#[cfg(enable_fuzzing)]
mod fuzz {
use libfuzzer_sys::fuzz_target;
use naga::front::wgsl::Frontend;
Expand All @@ -9,3 +10,6 @@ mod fuzz {
let _result = Frontend::new().parse(&data);
});
}

#[cfg(not(enable_fuzzing))]
fn main() {}
Loading

0 comments on commit d6b4dc8

Please sign in to comment.