summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wgpu-core/src/track/texture.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/rust/wgpu-core/src/track/texture.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/third_party/rust/wgpu-core/src/track/texture.rs b/third_party/rust/wgpu-core/src/track/texture.rs
index e7c4707c93..3cf95ff38a 100644
--- a/third_party/rust/wgpu-core/src/track/texture.rs
+++ b/third_party/rust/wgpu-core/src/track/texture.rs
@@ -210,6 +210,7 @@ pub(crate) struct TextureStateSet {
simple: Vec<TextureUses>,
complex: FastHashMap<usize, ComplexTextureState>,
}
+
impl TextureStateSet {
fn new() -> Self {
Self {
@@ -235,15 +236,16 @@ pub(crate) struct TextureUsageScope<A: HalApi> {
metadata: ResourceMetadata<Texture<A>>,
}
-impl<A: HalApi> TextureUsageScope<A> {
- pub fn new() -> Self {
+impl<A: HalApi> Default for TextureUsageScope<A> {
+ fn default() -> Self {
Self {
set: TextureStateSet::new(),
-
metadata: ResourceMetadata::new(),
}
}
+}
+impl<A: HalApi> TextureUsageScope<A> {
fn tracker_assert_in_bounds(&self, index: usize) {
self.metadata.tracker_assert_in_bounds(index);
@@ -258,6 +260,11 @@ impl<A: HalApi> TextureUsageScope<A> {
});
}
+ pub fn clear(&mut self) {
+ self.set.clear();
+ self.metadata.clear();
+ }
+
/// Sets the size of all the vectors inside the tracker.
///
/// Must be called with the highest possible Texture ID before