mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Cache Vello render output as stitchable textures (#3722)
* WIP render caching * Hook up render cache to render pipeline * Fixed offsets * Initial cleanup * Integrate cache with context invalidation * Cleanup * Improve rounding and reduce tile size to fix vello not rendering * Include pointer position in cache key * Avoid unwraps and zero sized textures * Destroy textures after blitting to surface * Fix context dependencies * Exclude footprint from render params * Batch animation frame messages * Add vello max render size to preference dialogue * Remove unused import * Reorder vello preference * Clean up preferences dialog * Apply review suggestions * Cap max render region size --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -218,6 +218,7 @@ impl<T: NodeGraphUpdateSender> NodeGraphUpdateSender for std::sync::Mutex<T> {
|
||||
|
||||
pub trait GetEditorPreferences {
|
||||
fn use_vello(&self) -> bool;
|
||||
fn max_render_region_area(&self) -> u32;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
@@ -261,6 +262,10 @@ impl GetEditorPreferences for DummyPreferences {
|
||||
fn use_vello(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn max_render_region_area(&self) -> u32 {
|
||||
1024 * 1024
|
||||
}
|
||||
}
|
||||
|
||||
pub struct EditorApi<Io> {
|
||||
|
||||
@@ -280,6 +280,16 @@ impl RenderMetadata {
|
||||
value.transform = transform * value.transform;
|
||||
}
|
||||
}
|
||||
|
||||
/// Merge another RenderMetadata into this one.
|
||||
/// Values from `other` take precedence for duplicate keys.
|
||||
pub fn merge(&mut self, other: &RenderMetadata) {
|
||||
self.upstream_footprints.extend(other.upstream_footprints.iter().map(|(k, v)| (*k, *v)));
|
||||
self.local_transforms.extend(other.local_transforms.iter().map(|(k, v)| (*k, *v)));
|
||||
self.first_element_source_id.extend(other.first_element_source_id.iter().map(|(k, v)| (*k, *v)));
|
||||
self.click_targets.extend(other.click_targets.iter().map(|(k, v)| (*k, v.clone())));
|
||||
self.clip_targets.extend(other.clip_targets.iter().copied());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Rename to "Graphical"
|
||||
|
||||
Reference in New Issue
Block a user