mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 08:51:05 +01:00
[remote-types] vendor BindGroupLayoutEntry and use ShaderStagesWebGPU in it
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
b7a23d6ed7
commit
0584f1eb38
2 files changed
+37
-2
No files matched your search
@@ -67,6 +67,21 @@ pub struct BindGroupDescriptor<'a> {
|
||||
pub entries: Cow<'a, [BindGroupEntry]>,
|
||||
}
|
||||
|
||||
/// Describes a single binding inside a bind group.
|
||||
///
|
||||
/// Corresponds to [WebGPU `GPUBindGroupLayoutEntry`](
|
||||
/// https://gpuweb.github.io/gpuweb/#dictdef-gpubindgrouplayoutentry).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct BindGroupLayoutEntry {
|
||||
/// Binding index. Must match shader index and be unique inside a `BindGroupLayout`. A binding
|
||||
/// of index 1, would be described as `@group(0) @binding(1)` in shaders.
|
||||
pub binding: u32,
|
||||
/// Which shader stages can see this binding.
|
||||
pub visibility: wgt::ShaderStagesWebGPU,
|
||||
/// The type of the binding
|
||||
pub ty: wgt::BindingType,
|
||||
}
|
||||
|
||||
/// Corresponds to [`GPUBindGroupLayoutDescriptor`](https://www.w3.org/TR/webgpu/#dictdef-gpubindgrouplayoutdescriptor).
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct BindGroupLayoutDescriptor<'a> {
|
||||
@@ -75,5 +90,5 @@ pub struct BindGroupLayoutDescriptor<'a> {
|
||||
/// This will show up in graphics debuggers for easy identification.
|
||||
pub label: Label<'a>,
|
||||
/// Array of entries in this BindGroupLayout
|
||||
pub entries: Cow<'a, [wgt::BindGroupLayoutEntry]>,
|
||||
pub entries: Cow<'a, [BindGroupLayoutEntry]>,
|
||||
}
|
||||
@@ -490,9 +490,29 @@ impl Global {
|
||||
|
||||
let device = devices.get(device_id);
|
||||
|
||||
let entries = desc
|
||||
.entries
|
||||
.iter()
|
||||
.map(
|
||||
|&BindGroupLayoutEntry {
|
||||
binding,
|
||||
visibility,
|
||||
ty,
|
||||
}| wgt::BindGroupLayoutEntry {
|
||||
binding,
|
||||
visibility: wgt::ShaderStages::from_internal_flags(
|
||||
visibility,
|
||||
wgt::ShaderStagesWGPU::empty(),
|
||||
),
|
||||
ty,
|
||||
count: None,
|
||||
},
|
||||
)
|
||||
.collect();
|
||||
|
||||
let desc = binding_model::BindGroupLayoutDescriptor {
|
||||
label: desc.label.as_ref().map(|l| Cow::Borrowed(l.as_ref())),
|
||||
entries: Cow::Borrowed(&desc.entries),
|
||||
entries: Cow::Owned(entries),
|
||||
};
|
||||
|
||||
let bgl = device.create_bind_group_layout(&desc);
|
||||
|
||||
Reference in new issue
Block a user