diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c06a8aae..8e82ab676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## v0.4.1 (28-11-2019) + - fixed depth/stencil transitions + - fixed dynamic offset iteration + ## v0.4 (03-11-2019) - Platforms: removed OpenGL/WebGL support temporarily - Features: diff --git a/Cargo.lock b/Cargo.lock index dedc0e556..b0ef48e3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -620,7 +620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wgpu-native" -version = "0.4.0" +version = "0.4.1" dependencies = [ "arrayvec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -649,7 +649,7 @@ version = "0.1.0" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wgpu-native 0.4.0", + "wgpu-native 0.4.1", ] [[package]] diff --git a/wgpu-native/Cargo.toml b/wgpu-native/Cargo.toml index 46c094bff..efe4510a5 100644 --- a/wgpu-native/Cargo.toml +++ b/wgpu-native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-native" -version = "0.4.0" +version = "0.4.1" authors = [ "Dzmitry Malyshau ", "Joshua Groves ", diff --git a/wgpu-native/src/command/bind.rs b/wgpu-native/src/command/bind.rs index e6e04365b..58fbb3b49 100644 --- a/wgpu-native/src/command/bind.rs +++ b/wgpu-native/src/command/bind.rs @@ -14,7 +14,7 @@ use crate::{ use smallvec::{smallvec, SmallVec}; -use std::convert::identity; +use std::slice; pub const DEFAULT_BIND_GROUPS: usize = 4; type BindGroupMask = u8; @@ -38,16 +38,21 @@ pub enum Provision { Changed { was_compatible: bool }, } -struct TakeSome { - iter: I, +#[derive(Clone)] +pub struct FollowUpIter<'a> { + iter: slice::Iter<'a, BindGroupEntry>, } -impl Iterator for TakeSome -where - I: Iterator>, -{ - type Item = T; - fn next(&mut self) -> Option { - self.iter.next().and_then(identity) +impl<'a> Iterator for FollowUpIter<'a> { + type Item = (BindGroupId, &'a [BufferAddress]); + fn next(&mut self) -> Option { + self.iter + .next() + .and_then(|entry| { + Some(( + entry.actual_value()?, + entry.dynamic_offsets.as_slice(), + )) + }) } } @@ -165,11 +170,7 @@ impl Binder { bind_group_id: BindGroupId, bind_group: &BindGroup, offsets: &[BufferAddress], - ) -> Option<( - PipelineLayoutId, - impl 'a + Iterator, - impl 'a + Iterator, - )> { + ) -> Option<(PipelineLayoutId, FollowUpIter<'a>)> { log::trace!("\tBinding [{}] = group {:?}", index, bind_group_id); debug_assert_eq!(B::VARIANT, bind_group_id.backend()); @@ -186,14 +187,9 @@ impl Binder { log::trace!("\t\tbinding up to {}", end); Some(( self.pipeline_layout_id?, - TakeSome { - iter: self.entries[index + 1 .. end] - .iter() - .map(|entry| entry.actual_value()), - }, - self.entries[index + 1 .. end] - .iter() - .flat_map(|entry| entry.dynamic_offsets.as_slice()), + FollowUpIter { + iter: self.entries[index + 1 .. end].iter(), + } )) } else { log::trace!("\t\tskipping above compatible {}", compatible_count); diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index 5278cc299..9818c40f7 100644 --- a/wgpu-native/src/command/compute.rs +++ b/wgpu-native/src/command/compute.rs @@ -127,12 +127,12 @@ pub fn compute_pass_set_bind_group( &*texture_guard, ); - if let Some((pipeline_layout_id, follow_up_sets, follow_up_offsets)) = pass + if let Some((pipeline_layout_id, follow_ups)) = pass .binder .provide_entry(index as usize, bind_group_id, bind_group, offsets) { let bind_groups = iter::once(bind_group.raw.raw()) - .chain(follow_up_sets.map(|bg_id| bind_group_guard[bg_id].raw.raw())); + .chain(follow_ups.clone().map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw())); unsafe { pass.raw.bind_compute_descriptor_sets( &pipeline_layout_guard[pipeline_layout_id].raw, @@ -140,7 +140,7 @@ pub fn compute_pass_set_bind_group( bind_groups, offsets .iter() - .chain(follow_up_offsets) + .chain(follow_ups.flat_map(|(_, offsets)| offsets)) .map(|&off| off as hal::command::DescriptorSetOffset), ); } diff --git a/wgpu-native/src/command/render.rs b/wgpu-native/src/command/render.rs index 2c4c8a979..e642176da 100644 --- a/wgpu-native/src/command/render.rs +++ b/wgpu-native/src/command/render.rs @@ -258,12 +258,12 @@ pub fn render_pass_set_bind_group( pass.trackers.merge_extend(&bind_group.used); - if let Some((pipeline_layout_id, follow_up_sets, follow_up_offsets)) = pass + if let Some((pipeline_layout_id, follow_ups)) = pass .binder .provide_entry(index as usize, bind_group_id, bind_group, offsets) { let bind_groups = iter::once(bind_group.raw.raw()) - .chain(follow_up_sets.map(|bg_id| bind_group_guard[bg_id].raw.raw())); + .chain(follow_ups.clone().map(|(bg_id, _)| bind_group_guard[bg_id].raw.raw())); unsafe { pass.raw.bind_graphics_descriptor_sets( &&pipeline_layout_guard[pipeline_layout_id].raw, @@ -271,7 +271,7 @@ pub fn render_pass_set_bind_group( bind_groups, offsets .iter() - .chain(follow_up_offsets) + .chain(follow_ups.flat_map(|(_, offsets)| offsets)) .map(|&off| off as hal::command::DescriptorSetOffset), ); } diff --git a/wgpu-native/src/track/texture.rs b/wgpu-native/src/track/texture.rs index b845e1b25..50f97f52b 100644 --- a/wgpu-native/src/track/texture.rs +++ b/wgpu-native/src/track/texture.rs @@ -129,7 +129,7 @@ impl ResourceState for TextureState { let pending = PendingTransition { id, selector: hal::image::SubresourceRange { - aspects: hal::format::Aspects::COLOR, + aspects: aspect, levels: level .. level + 1, layers: range.clone(), },