diff --git a/Cargo.lock b/Cargo.lock index db293ba2de..04fc13f09e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -500,9 +500,9 @@ dependencies = [ [[package]] name = "gfx-backend-vulkan" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84bda4200a82e1912d575801e2bb76ae19c6256359afbc0adfbbaec02fcadc6" +checksum = "26d6c5b718953362f4252575a9d77c22bd73eb8308e7b3af8237deace565e7ca" dependencies = [ "arrayvec", "ash", diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index b3e5145ab8..49579b6b40 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -50,15 +50,15 @@ version = "0.6" [target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies] gfx-backend-metal = { version = "0.6" } -gfx-backend-vulkan = { version = "0.6", optional = true } +gfx-backend-vulkan = { version = "0.6.4", optional = true } [target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies] -gfx-backend-vulkan = { version = "0.6.1" } +gfx-backend-vulkan = { version = "0.6.4" } [target.'cfg(windows)'.dependencies] gfx-backend-dx12 = { version = "0.6" } gfx-backend-dx11 = { version = "0.6" } -gfx-backend-vulkan = { version = "0.6" } +gfx-backend-vulkan = { version = "0.6.4" } [dev-dependencies] loom = "0.3" diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index a2a9c97ea8..504c27e46f 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -702,13 +702,13 @@ impl Device { .map_or(1, |v| v.get() as hal::pso::DescriptorArrayIndex), //TODO: consolidate stage_flags: conv::map_shader_stage_flags(entry.visibility), immutable_samplers: false, // TODO - }); - let desc_counts = raw_bindings.clone().collect(); + }) + .collect::>(); //TODO: avoid heap allocation let raw = unsafe { let mut raw_layout = self .raw - .create_descriptor_set_layout(raw_bindings, &[]) + .create_descriptor_set_layout(&raw_bindings, &[]) .or(Err(DeviceError::OutOfMemory))?; if let Some(label) = label { self.raw @@ -734,7 +734,7 @@ impl Device { ref_count: self.life_guard.add_ref(), }, multi_ref_count: MultiRefCount::new(), - desc_counts, + desc_counts: raw_bindings.iter().cloned().collect(), dynamic_count: entry_map .values() .filter(|b| b.ty.has_dynamic_offset()) @@ -2358,27 +2358,19 @@ impl Global { } } - if !write_map.is_empty() { - let mut writes = Vec::>>::new(); - let mut prev_stages = wgt::ShaderStage::empty(); - let mut prev_ty = wgt::BindingType::Sampler { comparison: false }; // doesn't matter - for (binding, list) in write_map { - let layout = &bind_group_layout.entries[&binding]; - if layout.visibility == prev_stages && layout.ty == prev_ty { - writes.last_mut().unwrap().descriptors.extend(list); - } else { - prev_stages = layout.visibility; - prev_ty = layout.ty; - writes.push(hal::pso::DescriptorSetWrite { - set: desc_set.raw(), - binding, - array_offset: 0, - descriptors: list, - }); - } - } + if let Some(start_binding) = write_map.keys().next().cloned() { + let descriptors = write_map + .into_iter() + .flat_map(|(_, list)| list) + .collect::>(); + let write = hal::pso::DescriptorSetWrite { + set: desc_set.raw(), + binding: start_binding, + array_offset: 0, + descriptors, + }; unsafe { - device.raw.write_descriptor_sets(writes); + device.raw.write_descriptor_sets(iter::once(write)); } } desc_set diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index dad2d5cb5e..8418fb6eaa 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1720,7 +1720,7 @@ pub struct TextureDataLayout { /// Specific type of a binding. /// /// WebGPU spec: https://gpuweb.github.io/gpuweb/#dictdef-gpubindgrouplayoutentry -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +#[derive(Clone, Debug, Eq, PartialEq, Hash)] #[cfg_attr(feature = "trace", derive(Serialize))] #[cfg_attr(feature = "replay", derive(Deserialize))] pub enum BindingType {