summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-08 12:29:17 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-05-08 12:29:17 +0200
commit447f3a2d14ab1c4bc20e232df1aa2375623af2de (patch)
treefe98bc375b334a480c2370096bcec540d3abec02
parente07b42ac96b8d098a883c93afe828a439f479c7b (diff)
downloadiced-447f3a2d14ab1c4bc20e232df1aa2375623af2de.tar.gz
iced-447f3a2d14ab1c4bc20e232df1aa2375623af2de.tar.bz2
iced-447f3a2d14ab1c4bc20e232df1aa2375623af2de.zip
Reuse `glyphon::Pipeline` state in `iced_wgpu`
-rw-r--r--Cargo.toml2
-rw-r--r--wgpu/src/text.rs15
2 files changed, 12 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 06f7d198..4f50f018 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -142,7 +142,7 @@ cosmic-text = "0.10"
dark-light = "1.0"
futures = "0.3"
glam = "0.25"
-glyphon = { git = "https://github.com/hecrj/glyphon.git", rev = "ceed55403ce53e120ce9d1fae17dcfe388726118" }
+glyphon = { git = "https://github.com/hecrj/glyphon.git", rev = "cd66a24859cf30b0b8cabf06256dacad362ed44a" }
guillotiere = "0.6"
half = "2.2"
image = "0.24"
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 7e683c77..68741461 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -115,6 +115,7 @@ impl Storage {
queue: &wgpu::Queue,
encoder: &mut wgpu::CommandEncoder,
format: wgpu::TextureFormat,
+ pipeline: &glyphon::Pipeline,
cache: &Cache,
new_transformation: Transformation,
bounds: Rectangle,
@@ -131,7 +132,7 @@ impl Storage {
Group {
atlas: glyphon::TextAtlas::with_color_mode(
- device, queue, format, COLOR_MODE,
+ device, queue, pipeline, format, COLOR_MODE,
),
version: 0,
should_trim: false,
@@ -259,6 +260,7 @@ impl Storage {
#[allow(missing_debug_implementations)]
pub struct Pipeline {
+ state: glyphon::Pipeline,
format: wgpu::TextureFormat,
atlas: glyphon::TextAtlas,
renderers: Vec<glyphon::TextRenderer>,
@@ -272,12 +274,16 @@ impl Pipeline {
queue: &wgpu::Queue,
format: wgpu::TextureFormat,
) -> Self {
+ let state = glyphon::Pipeline::new(device);
+ let atlas = glyphon::TextAtlas::with_color_mode(
+ device, queue, &state, format, COLOR_MODE,
+ );
+
Pipeline {
+ state,
format,
renderers: Vec::new(),
- atlas: glyphon::TextAtlas::with_color_mode(
- device, queue, format, COLOR_MODE,
- ),
+ atlas,
prepare_layer: 0,
cache: BufferCache::new(),
}
@@ -343,6 +349,7 @@ impl Pipeline {
queue,
encoder,
self.format,
+ &self.state,
cache,
layer_transformation * *transformation,
layer_bounds * layer_transformation,