summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/layer/cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/widget/canvas/layer/cache.rs')
-rw-r--r--wgpu/src/widget/canvas/layer/cache.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/wgpu/src/widget/canvas/layer/cache.rs b/wgpu/src/widget/canvas/layer/cache.rs
index 4f8c2bec..2e87297c 100644
--- a/wgpu/src/widget/canvas/layer/cache.rs
+++ b/wgpu/src/widget/canvas/layer/cache.rs
@@ -1,5 +1,5 @@
use crate::{
- canvas::{Drawable, Frame, Layer},
+ canvas::{Drawable, Frame, Layer, Program},
Primitive,
};
@@ -79,6 +79,20 @@ where
}
}
+impl<T> Program for Cache<T>
+where
+ T: Drawable + std::fmt::Debug,
+{
+ type Input = T;
+
+ fn layers<'a>(
+ &'a self,
+ input: &'a Self::Input,
+ ) -> Vec<Box<dyn Layer + 'a>> {
+ vec![Box::new(self.with(input))]
+ }
+}
+
#[derive(Debug)]
struct Bind<'a, T: Drawable> {
cache: &'a Cache<T>,