Skip to content

Commit a35e5a2

Browse files
feat(core): add Global::create_bind_group_layout_error (#8650)
1 parent a15ffbd commit a35e5a2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609).
181181
- Added support for binding arrays of storage textures on Metal. By @msvbg in [#8464](https://github.com/gfx-rs/wgpu/pull/8464)
182182
- Added support for multisampled texture arrays on Vulkan through adapter feature `MULTISAMPLE_ARRAY`. By @LaylBongers in [#8571](https://github.com/gfx-rs/wgpu/pull/8571).
183183
- Added `get_configuration` to `wgpu::Surface`, that returns the current configuration of `wgpu::Surface`. By @sagudev in [#8664](https://github.com/gfx-rs/wgpu/pull/8664).
184+
- Add `wgpu_core::Global::create_bind_group_layout_error`. By @ErichDonGubler in [#8650](https://github.com/gfx-rs/wgpu/pull/8650).
184185

185186
### Changes
186187

wgpu-core/src/device/global.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,23 @@ impl Global {
215215
fid.assign(Fallible::Invalid(Arc::new(desc.label.to_string())));
216216
}
217217

218+
/// Assign `id_in` an error with the given `label`.
219+
///
220+
/// In JavaScript environments, it is possible to call `GPUDevice.createBindGroupLayout` with
221+
/// entries that are invalid. Because our Rust's types for bind group layouts prevent even
222+
/// calling [`Self::device_create_bind_group`], we let standards-compliant environments
223+
/// register an invalid bind group layout so this crate's API can still be consistently used.
224+
///
225+
/// See [`Self::create_buffer_error`] for additional context and explanation.
226+
pub fn create_bind_group_layout_error(
227+
&self,
228+
id_in: Option<id::BindGroupLayoutId>,
229+
label: Option<Cow<'_, str>>,
230+
) {
231+
let fid = self.hub.bind_group_layouts.prepare(id_in);
232+
fid.assign(Fallible::Invalid(Arc::new(label.to_string())));
233+
}
234+
218235
pub fn buffer_destroy(&self, buffer_id: id::BufferId) {
219236
profiling::scope!("Buffer::destroy");
220237
api_log!("Buffer::destroy {buffer_id:?}");

0 commit comments

Comments
 (0)