Fix Grapene CLI compilation (#3892)
* Fix grapene-cli compilation * Improve cargo features to reduce recompiles
This commit is contained in:
parent
a3f88b0f96
commit
eb30ee78bc
|
|
@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["dealloc_nodes", "wgpu"]
|
default = ["dealloc_nodes", "wgpu", "loading"]
|
||||||
dealloc_nodes = ["core-types/dealloc_nodes"]
|
dealloc_nodes = ["core-types/dealloc_nodes"]
|
||||||
wgpu = ["wgpu-executor"]
|
wgpu = ["wgpu-executor"]
|
||||||
tokio = ["dep:tokio"]
|
tokio = ["dep:tokio"]
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ futures = { workspace = true }
|
||||||
fern = { workspace = true }
|
fern = { workspace = true }
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
tokio = { workspace = true }
|
||||||
clap = { workspace = true, features = ["cargo", "derive"] }
|
clap = { workspace = true, features = ["cargo", "derive"] }
|
||||||
image = { workspace = true }
|
image = { workspace = true }
|
||||||
wgpu-executor = { workspace = true, optional = true }
|
wgpu-executor = { workspace = true, optional = true }
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ pub async fn export_document(
|
||||||
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture.as_ref().clone());
|
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 cpu_raster: Raster<CPU> = gpu_raster.convert(Footprint::BOUNDLESS, wgpu_executor).await;
|
||||||
let (data, width, height) = cpu_raster.to_flat_u8();
|
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
|
// Encode and write raster image
|
||||||
write_raster_image(output_path, file_type, data, width, height, transparent)?;
|
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 {
|
let (data, img_width, img_height) = match result {
|
||||||
TaggedValue::RenderOutput(output) => match output.data {
|
TaggedValue::RenderOutput(output) => match output.data {
|
||||||
RenderOutputType::Texture(image_texture) => {
|
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;
|
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()
|
cpu_raster.to_flat_u8()
|
||||||
}
|
}
|
||||||
RenderOutputType::Buffer { data, width, height } => (data, width, height),
|
RenderOutputType::Buffer { data, width, height } => (data, width, height),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue