Skip to content

Commit bd87a84

Browse files
committed
add changelog entry
1 parent 32185b1 commit bd87a84

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ Bottom level categories:
4242

4343
## Unreleased
4444

45+
### Major changes
46+
47+
#### Optional vertex buffer slots
48+
49+
This allows gaps in `VertexState`'s `buffers` and adds support for unbinding vertex buffers, bringing us in compliance with the WebGPU spec. As a result of this `VertexState`'s `buffers` field now has type of `&[Option<VertexBufferLayout>]`. To migrate wrap vertex buffer layouts in `Some`:
50+
51+
```diff
52+
let vertex_state = wgpu::VertexState {
53+
module: &vs_module,
54+
entry_point: Some("vs_main"),
55+
compilation_options: wgpu::PipelineCompilationOptions::default(),
56+
buffers: &[
57+
- &vertex_buffer_layout
58+
+ Some(&vertex_buffer_layout)
59+
],
60+
};
61+
```
62+
63+
By @teoxoy in [#9351](https://github.com/gfx-rs/wgpu/pull/9351).
64+
4565
### Added/New Features
4666

4767
#### General

wgpu/src/backend/webgpu.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,8 +2180,8 @@ impl dispatch::DeviceInterface for WebDevice {
21802180
.vertex
21812181
.buffers
21822182
.iter()
2183-
.map(|vbuf| {
2184-
vbuf.as_ref().map(|vbuf| {
2183+
.map(|vbuf| match vbuf {
2184+
Some(vbuf) => {
21852185
let mapped_attributes = vbuf
21862186
.attributes
21872187
.iter()
@@ -2199,8 +2199,9 @@ impl dispatch::DeviceInterface for WebDevice {
21992199
&mapped_attributes,
22002200
);
22012201
mapped_vbuf.set_step_mode(map_vertex_step_mode(vbuf.step_mode));
2202-
mapped_vbuf
2203-
})
2202+
wasm_bindgen::JsValue::from(mapped_vbuf)
2203+
}
2204+
None => wasm_bindgen::JsValue::NULL,
22042205
})
22052206
.collect::<js_sys::Array>();
22062207

0 commit comments

Comments
 (0)