diff --git a/wgpu-native/src/device.rs b/wgpu-native/src/device.rs index b5f1dee0d..225c56caa 100644 --- a/wgpu-native/src/device.rs +++ b/wgpu-native/src/device.rs @@ -800,7 +800,7 @@ pub fn texture_create_view( ref_count: texture.life_guard.ref_count.clone(), }, format: texture.format, - extent: texture.kind.extent(), + extent: texture.kind.extent().at_level(range.levels.start), samples: texture.kind.num_samples(), range, is_owned_by_swap_chain: false, diff --git a/wgpu-native/src/track/mod.rs b/wgpu-native/src/track/mod.rs index 37aa58fc1..4e01ad4a6 100644 --- a/wgpu-native/src/track/mod.rs +++ b/wgpu-native/src/track/mod.rs @@ -90,7 +90,7 @@ pub trait ResourceState: Clone + Default { /// Change the last usage of the selected sub-resources. /// /// If `output` is specified, it's filled with the - /// `PendingTransition` objects cooresponding to smaller + /// `PendingTransition` objects corresponding to smaller /// sub-resource transitions. The old usage is replaced by /// the new one. /// @@ -142,7 +142,7 @@ pub struct PendingTransition { pub usage: Range, } -/// A tracker for all resources of a given tyope. +/// A tracker for all resources of a given type. pub struct ResourceTracker { /// An association of known resource indices with their tracked states. map: FastHashMap>, @@ -396,7 +396,7 @@ pub struct TrackerSet { } impl TrackerSet { - /// Create an emtpy set. + /// Create an empty set. pub fn new() -> Self { TrackerSet { buffers: ResourceTracker::new(), diff --git a/wgpu-native/src/track/range.rs b/wgpu-native/src/track/range.rs index 6ae7d1d05..60be87145 100644 --- a/wgpu-native/src/track/range.rs +++ b/wgpu-native/src/track/range.rs @@ -11,6 +11,8 @@ use std::{ /// are often grouped together linearly. #[derive(Clone, Debug)] pub struct RangedStates { + /// List of ranges, each associated with a singe value. + /// Ranges of keys have to be non-intersecting and ordered. ranges: Vec<(Range, T)>, } @@ -37,6 +39,9 @@ impl RangedStates { } /// Append a range. + /// + /// Assumes that the object is being constructed from a set of + /// ranges, and they are given in the ascending order of their keys. pub fn append(&mut self, index: Range, value: T) { if let Some(last) = self.ranges.last() { debug_assert!(last.0.end <= index.start); @@ -171,7 +176,7 @@ impl RangedStates { } -/// A custom iterator that goes through two `RangedStates` and proces a merge. +/// A custom iterator that goes through two `RangedStates` and process a merge. pub struct Merge<'a, I, T> { base: I, sa: Peekable, T)>>,