Skip to content

Commit 9611583

Browse files
TODO: check override-resolved dimensions for maxWorkGroupSize* and maxInvocationsPerWorkgroup limits
CTS test that's breaking: `webgpu:api,validation,compute_pipeline:overrides,workgroup_size,limits:*` From [Andy's comment]: > The issue with the invocation size limits is that they need to be > validated _after_ overrides have been resolved. We resolve overrides > within the hal `create_compute_pipeline` function, but we validate the > size in core's `create_compute_pipeline` function before calling hal. > > Besides the order that things happen, we also need to be careful that > we validate against the final, override-resolved version of the entry > point, rather than using `shader_module.interface.entry_points` if that > can be stale. [Andy's comment]: gfx-rs#8946 (comment)
3 parents 98211b4 + 2c13b85 + 04a62fe commit 9611583

138 files changed

Lines changed: 1623 additions & 753 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,25 @@ Bottom level categories:
5151
- Fix missing dependency feature activations when building wgpu-hal with gles/dx12 in isolation. By @wumpf in [#9325](https://github.com/gfx-rs/wgpu/pull/9325)
5252
- Make `wgpu_types::texture::format::TextureChannel` accessible as `wgpu::TextureChannel`. By @TornaxO7 in [#9394](https://github.com/gfx-rs/wgpu/pull/9349).
5353
- Add support for `per_vertex` in Metal and DX12, as well as some validation for `per_vertex`, and a new enable extension, `wgpu_per_vertex`. By @inner-daemons in [#9219](https://github.com/gfx-rs/wgpu/pull/9219).
54+
- Add `ComputePass` version of `CommandEncoder::transition_resources` that allows intra-pass transitions. By @wingertge in [#9371](https://github.com/gfx-rs/wgpu/pull/9371).
5455

5556
#### Metal
5657

5758
- Unconditionally enable `Features::CLIP_DISTANCES`. By @ErichDonGubler in [#9270](https://github.com/gfx-rs/wgpu/pull/9270).
5859
- Added full support for mesh shaders, including in WGSL shaders. By @inner-daemons in [#8739](https://github.com/gfx-rs/wgpu/pull/8739).
60+
- Fixed structure field names incorrectly ignoring reserved keywords in the Metal (MSL) backend. By @39ali [#9379](https://github.com/gfx-rs/wgpu/pull/9379).
61+
62+
#### GLES
63+
64+
- Added support for GLSL passthrough. By @inner-daemons in [#9064](https://github.com/gfx-rs/wgpu/pull/9064).
5965

6066
#### DX12
6167

6268
- Added support for mesh shaders in naga's HLSL writer, completing DX12 support for mesh shaders. By @inner-daemons in [#8752](https://github.com/gfx-rs/wgpu/pull/8752).
6369

6470
#### Vulkan
6571

72+
- Add `vulkan::Device::texture_from_dmabuf_fd()` for importing DMA-buf textures on Linux, with `VULKAN_EXTERNAL_MEMORY_FD` and `VULKAN_EXTERNAL_MEMORY_DMA_BUF` feature flags. By @TODO in [#TODO](https://github.com/gfx-rs/wgpu/pull/TODO).
6673
- Add support for RawWindowHandle::Drm on unix. By @rectalogic in [#9182](https://github.com/gfx-rs/wgpu/pull/9182).
6774

6875
### Changes
@@ -73,6 +80,9 @@ Bottom level categories:
7380
- Added more granular limits for mesh shaders. By @inner-daemons in [#8739](https://github.com/gfx-rs/wgpu/pull/8739).
7481
- Added new `InvalidWorkgroupSizeError`, which is now used by `DrawError::InvalidGroupSize` and `StageError::InvalidWorkgroupSize`. By @andyleiserson in [#9357](https://github.com/gfx-rs/wgpu/pull/9357).
7582
- Zero-size `Queue::write_buffer` now returns an error if the offset is invalid or the buffer lacks `COPY_DST`. By @39ali in [#9374](https://github.com/gfx-rs/wgpu/pull/9374).
83+
- `Buffer::get_mapped_range` and variants now return `Result<_, MapRangeError>>` instead of panicking, in line with WebGPU spec. By @atlv24 in [#9281](https://github.com/gfx-rs/wgpu/pull/9281).
84+
- Passthrough shaders now require a list of entry points when being created. by @inner-daemons in [#9064](https://github.com/gfx-rs/wgpu/pull/9064).
85+
- BREAKING: The `dispatch` and `dispatch_indirect` methods on pass and bundle encoders have been renamed to `dispatch_workgroups` and `dispatch_workgroups_indirect`, respectively, to match the WebGPU spec. By @ErichDonGubler in [#9362](https://github.com/gfx-rs/wgpu/pull/9362).
7686

7787
#### Validation
7888

@@ -90,12 +100,12 @@ Bottom level categories:
90100

91101
#### naga
92102

103+
- Fixed atomic load and store operations being incorrectly generated as non-atomic memory accesses in GLSL and HLSL. By @CldStlkr in [#9242](https://github.com/gfx-rs/wgpu/pull/9242).
93104
- Fixed overflow detection and argument domain validation for `acosh`, `length`, `normalize`, and `pow` in constant evaluation. By @ecoricemon in [#9249](https://github.com/gfx-rs/wgpu/pull/9249).
94105
- Naga no longer allows derivative operations on `f16`. WGSL does not currently allow this, although [it may be added in the future](https://github.com/gpuweb/gpuweb/issues/5482). By @andyleiserson in [#9154](https://github.com/gfx-rs/wgpu/pull/9154).
95106
- Disallow direct access to atomic variables in WGSL front-end (e.g. `let x = myAtomic;`). By @ecoricemon in [#9262](https://github.com/gfx-rs/wgpu/pull/9262).
96107
- Fixed handling of unterminated block comments. By @BKDaugherty in [#9356](https://github.com/gfx-rs/wgpu/pull/9356).
97108
- Enforce that `@must_use` appear only on function declarations. By @dnsn021 in [#9367](https://github.com/gfx-rs/wgpu/pull/9367).
98-
- Fix typo in `naga::back::msl::Error::UnsupportedWritable*` variant names. By @ErichDonGubler in [#9376](https://github.com/gfx-rs/wgpu/pull/9376).
99109

100110
#### dx12
101111

examples/features/src/big_compute_buffers/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub async fn execute_gpu_inner(
8585
let mut data = Vec::new();
8686
for staging_buffer in &staging_buffers {
8787
let slice = staging_buffer.slice(..);
88-
let mapped = slice.get_mapped_range();
88+
let mapped = slice.get_mapped_range().unwrap();
8989
let chunk: Vec<f32> = bytemuck::allocation::pod_collect_to_vec(&mapped);
9090
data.extend_from_slice(&chunk);
9191
drop(mapped);

examples/features/src/cooperative_matrix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ async fn execute(
411411
.expect("Channel receive failed")
412412
.expect("Buffer mapping failed");
413413

414-
let data = buffer_slice.get_mapped_range();
414+
let data = buffer_slice.get_mapped_range().unwrap();
415415

416416
// Convert result back to f32 for comparison
417417
let result: Vec<f32> = if use_f16 {

examples/features/src/framework.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ impl<E: Example + wgpu::WasmNotSendSync> From<ExampleTestParams<E>>
744744
ctx.async_poll(wgpu::PollType::wait_indefinitely())
745745
.await
746746
.unwrap();
747-
let bytes = dst_buffer_slice.get_mapped_range().to_vec();
747+
let bytes = dst_buffer_slice.get_mapped_range().unwrap().to_vec();
748748

749749
wgpu_test::image::compare_image_output(
750750
dbg!(env!("CARGO_MANIFEST_DIR").to_string() + "/../../" + params.image_path),

examples/features/src/hello_synchronization/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async fn get_data<T: bytemuck::Pod>(
185185
device.poll(wgpu::PollType::wait_indefinitely()).unwrap();
186186
receiver.recv_async().await.unwrap().unwrap();
187187
let data: Vec<T> =
188-
bytemuck::allocation::pod_collect_to_vec(&buffer_slice.get_mapped_range()[..]);
188+
bytemuck::allocation::pod_collect_to_vec(&buffer_slice.get_mapped_range().unwrap()[..]);
189189
output.copy_from_slice(&data);
190190
staging_buffer.unmap();
191191
}

examples/features/src/hello_workgroups/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ async fn get_data<T: bytemuck::Pod>(
174174
device.poll(wgpu::PollType::wait_indefinitely()).unwrap();
175175
receiver.recv_async().await.unwrap().unwrap();
176176
let data: Vec<T> =
177-
bytemuck::allocation::pod_collect_to_vec(&buffer_slice.get_mapped_range()[..]);
177+
bytemuck::allocation::pod_collect_to_vec(&buffer_slice.get_mapped_range().unwrap()[..]);
178178
output.copy_from_slice(&data);
179179
staging_buffer.unmap();
180180
}

examples/features/src/mesh_shader/mod.rs

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,3 @@
1-
// Same as in mesh shader tests
2-
fn compile_wgsl(device: &wgpu::Device) -> wgpu::ShaderModule {
3-
// Workgroup memory zero initialization can be expensive for mesh shaders
4-
unsafe {
5-
device.create_shader_module_trusted(
6-
wgpu::ShaderModuleDescriptor {
7-
label: None,
8-
source: wgpu::ShaderSource::Wgsl(include_str!("shader.wgsl").into()),
9-
},
10-
wgpu::ShaderRuntimeChecks::unchecked(),
11-
)
12-
}
13-
}
14-
15-
struct Shaders {
16-
ts: wgpu::ShaderModule,
17-
ms: wgpu::ShaderModule,
18-
fs: wgpu::ShaderModule,
19-
ts_name: &'static str,
20-
ms_name: &'static str,
21-
fs_name: &'static str,
22-
}
23-
24-
fn get_shaders(device: &wgpu::Device) -> Shaders {
25-
let compiled = compile_wgsl(device);
26-
Shaders {
27-
ts: compiled.clone(),
28-
ms: compiled.clone(),
29-
fs: compiled.clone(),
30-
ts_name: "ts_main",
31-
ms_name: "ms_main",
32-
fs_name: "fs_main",
33-
}
34-
}
35-
361
pub struct Example {
372
pipeline: wgpu::RenderPipeline,
383
}
@@ -43,14 +8,7 @@ impl crate::framework::Example for Example {
438
device: &wgpu::Device,
449
_queue: &wgpu::Queue,
4510
) -> Self {
46-
let Shaders {
47-
ts,
48-
ms,
49-
fs,
50-
ts_name,
51-
ms_name,
52-
fs_name,
53-
} = get_shaders(device);
11+
let shader = device.create_shader_module(wgpu::include_wgsl!("shader.wgsl"));
5412
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
5513
label: None,
5614
bind_group_layouts: &[],
@@ -60,18 +18,18 @@ impl crate::framework::Example for Example {
6018
label: None,
6119
layout: Some(&pipeline_layout),
6220
task: Some(wgpu::TaskState {
63-
module: &ts,
64-
entry_point: Some(ts_name),
21+
module: &shader,
22+
entry_point: Some("ts_main"),
6523
compilation_options: Default::default(),
6624
}),
6725
mesh: wgpu::MeshState {
68-
module: &ms,
69-
entry_point: Some(ms_name),
26+
module: &shader,
27+
entry_point: Some("ms_main"),
7028
compilation_options: Default::default(),
7129
},
7230
fragment: Some(wgpu::FragmentState {
73-
module: &fs,
74-
entry_point: Some(fs_name),
31+
module: &shader,
32+
entry_point: Some("fs_main"),
7533
compilation_options: Default::default(),
7634
targets: &[Some(config.view_formats[0].into())],
7735
}),

examples/features/src/mipmap/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,13 @@ impl crate::framework::Example for Example {
417417
let timestamp_view = query_sets
418418
.mapping_buffer
419419
.slice(..size_of::<TimestampQueries>() as wgpu::BufferAddress)
420-
.get_mapped_range();
420+
.get_mapped_range()
421+
.unwrap();
421422
let pipeline_stats_view = query_sets
422423
.mapping_buffer
423424
.slice(pipeline_statistics_offset()..)
424-
.get_mapped_range();
425+
.get_mapped_range()
426+
.unwrap();
425427
// Convert the raw data into a useful structure
426428
let timestamp_data: &TimestampQueries = bytemuck::from_bytes(&timestamp_view);
427429
let pipeline_stats_data: &PipelineStatisticsQueries =

examples/features/src/ray_cube_compute/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
471471
optional_features: wgpu::Features::default(),
472472
base_test_parameters: wgpu_test::TestParameters::default()
473473
// https://github.com/gfx-rs/wgpu/issues/9100
474-
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
474+
.disable_mtl_shader_validation(),
475475
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
476476
_phantom: std::marker::PhantomData::<Example>,
477477
};

examples/features/src/ray_cube_fragment/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example
357357
optional_features: wgpu::Features::default(),
358358
base_test_parameters: wgpu_test::TestParameters::default()
359359
// https://github.com/gfx-rs/wgpu/issues/9100
360-
.expect_fail(wgpu_test::FailureCase::backend(wgpu::Backends::METAL)),
360+
.disable_mtl_shader_validation(),
361361
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
362362
_phantom: std::marker::PhantomData::<Example>,
363363
};

0 commit comments

Comments
 (0)