Fix Grapene CLI compilation (#3892)

* Fix grapene-cli compilation

* Improve cargo features to reduce recompiles
This commit is contained in:
Dennis Kobert 2026-03-13 11:28:34 +01:00 committed by GitHub
parent a3f88b0f96
commit eb30ee78bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
authors.workspace = true
[features]
default = ["dealloc_nodes", "wgpu"]
default = ["dealloc_nodes", "wgpu", "loading"]
dealloc_nodes = ["core-types/dealloc_nodes"]
wgpu = ["wgpu-executor"]
tokio = ["dep:tokio"]

View File

@ -24,7 +24,7 @@ futures = { workspace = true }
fern = { workspace = true }
chrono = { workspace = true }
wgpu = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread"] }
tokio = { workspace = true }
clap = { workspace = true, features = ["cargo", "derive"] }
image = { workspace = true }
wgpu-executor = { workspace = true, optional = true }

View File

@ -72,6 +72,8 @@ pub async fn export_document(
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture.as_ref().clone());
let cpu_raster: Raster<CPU> = gpu_raster.convert(Footprint::BOUNDLESS, wgpu_executor).await;
let (data, width, height) = cpu_raster.to_flat_u8();
// Explicitly drop texture to make sure it lives long enough
std::mem::drop(image_texture);
// Encode and write raster image
write_raster_image(output_path, file_type, data, width, height, transparent)?;
@ -200,8 +202,10 @@ pub async fn export_gif(
let (data, img_width, img_height) = match result {
TaggedValue::RenderOutput(output) => match output.data {
RenderOutputType::Texture(image_texture) => {
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture);
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture.as_ref().clone());
let cpu_raster: Raster<CPU> = gpu_raster.convert(Footprint::BOUNDLESS, wgpu_executor).await;
// Explicitly drop texture to make sure it lives long enough
std::mem::drop(image_texture);
cpu_raster.to_flat_u8()
}
RenderOutputType::Buffer { data, width, height } => (data, width, height),