Fix texture view extent, improve docs according to the review

This commit is contained in:
Dzmitry Malyshau committed 2019-06-14 10:20:13 -04:00
1 parent 7c647a7d3c
commit 3da6c9f65b
3 files changed
+10 -5

No files matched your search

+1 -1
View File
@@ -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,
+3 -3
View File
@@ -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<S: ResourceState> {
pub usage: Range<S::Usage>,
}
/// A tracker for all resources of a given tyope.
/// A tracker for all resources of a given type.
pub struct ResourceTracker<S: ResourceState> {
/// An association of known resource indices with their tracked states.
map: FastHashMap<Index, Resource<S>>,
@@ -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(),
+6 -1
View File
@@ -11,6 +11,8 @@ use std::{
/// are often grouped together linearly.
#[derive(Clone, Debug)]
pub struct RangedStates<I, T> {
/// List of ranges, each associated with a singe value.
/// Ranges of keys have to be non-intersecting and ordered.
ranges: Vec<(Range<I>, T)>,
}
@@ -37,6 +39,9 @@ impl<I: Copy + PartialOrd, T: Copy + PartialEq> RangedStates<I, T> {
}
/// 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<I>, value: T) {
if let Some(last) = self.ranges.last() {
debug_assert!(last.0.end <= index.start);
@@ -171,7 +176,7 @@ impl<I: Copy + PartialOrd, T: Copy + PartialEq> RangedStates<I, T> {
}
/// 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<Iter<'a, (Range<I>, T)>>,