summaryrefslogtreecommitdiffstats
path: root/wgpu/src/layer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2023-11-14 20:59:49 +0100
committerLibravatar GitHub <noreply@github.com>2023-11-14 20:59:49 +0100
commitb474a2b7a763dcde6a377cb409001a7b5285ee8d (patch)
tree6e751607bb103e7011807a45797923d86214d88d /wgpu/src/layer.rs
parent817f72868746461891ca4e74473c555f3b5c5703 (diff)
parent0968c5b64a528ff92a5a93f6586eef557546da25 (diff)
downloadiced-b474a2b7a763dcde6a377cb409001a7b5285ee8d.tar.gz
iced-b474a2b7a763dcde6a377cb409001a7b5285ee8d.tar.bz2
iced-b474a2b7a763dcde6a377cb409001a7b5285ee8d.zip
Merge pull request #2085 from bungoboingo/shader-widget
[Feature] Custom Shader Widget
Diffstat (limited to 'wgpu/src/layer.rs')
-rw-r--r--wgpu/src/layer.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs
index 286801e6..33aaf670 100644
--- a/wgpu/src/layer.rs
+++ b/wgpu/src/layer.rs
@@ -34,6 +34,9 @@ pub struct Layer<'a> {
/// The images of the [`Layer`].
pub images: Vec<Image>,
+
+ /// The custom pipelines of this [`Layer`].
+ pub pipelines: Vec<primitive::Pipeline>,
}
impl<'a> Layer<'a> {
@@ -45,6 +48,7 @@ impl<'a> Layer<'a> {
meshes: Vec::new(),
text: Vec::new(),
images: Vec::new(),
+ pipelines: Vec::new(),
}
}
@@ -308,6 +312,23 @@ impl<'a> Layer<'a> {
}
}
},
+ primitive::Custom::Pipeline(pipeline) => {
+ let layer = &mut layers[current_layer];
+
+ let bounds = Rectangle::new(
+ Point::new(translation.x, translation.y),
+ pipeline.bounds.size(),
+ );
+
+ if let Some(clip_bounds) =
+ layer.bounds.intersection(&bounds)
+ {
+ layer.pipelines.push(primitive::Pipeline {
+ bounds: clip_bounds,
+ primitive: pipeline.primitive.clone(),
+ });
+ }
+ }
},
}
}