Convert create_context to a sync derivation kernel over the bare-root contract

This commit is contained in:
Dennis Kobert
2026-07-27 11:40:16 +00:00
parent 3d17fa0f0c
commit c3fdc97f81
8 changed files with 95 additions and 22 deletions

View File

@@ -16,6 +16,7 @@ wgpu = ["dep:raster-types", "raster-types/wgpu"]
# Local dependencies
dyn-any = { workspace = true }
core-types = { workspace = true }
graphene-hash = { workspace = true }
vector-types = { workspace = true }
text-nodes = { workspace = true }
graphene-resource = { workspace = true }

View File

@@ -61,7 +61,7 @@ pub trait GetEditorPreferences {
fn max_render_region_area(&self) -> u32;
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, graphene_hash::CacheHash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ExportFormat {
#[default]
@@ -69,14 +69,14 @@ pub enum ExportFormat {
Raster,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny)]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, graphene_hash::CacheHash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TimingInformation {
pub time: f64,
pub animation_time: Duration,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny)]
#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, graphene_hash::CacheHash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RenderConfig {
pub viewport: Footprint,

View File

@@ -770,6 +770,12 @@ impl<'a> EvalScope<'a> {
scope
}
pub fn with_pointer_position(&self, pointer_position: Option<DVec2>) -> EvalScope<'a> {
let mut scope = EvalScope { pointer_position, ..*self };
scope.hash = scope.compute_hash(None);
scope
}
pub fn nullified(&self, keep: ContextFeatures) -> EvalScope<'a> {
let mut scope = EvalScope {
real_time: self.real_time.filter(|_| keep.contains(ContextFeatures::REAL_TIME)),

View File

@@ -225,7 +225,7 @@ mod tests {
);
assert_eq!(GNode::eval(&graph, &ctx), GPoll::Pending);
assert_eq!(runtime.drain(), vec![], "an interrupted prologue must not spawn or claim the slot");
assert_eq!(runtime.drain(), Vec::<SourceId>::new(), "an interrupted prologue must not spawn or claim the slot");
gate.store(true, Ordering::Relaxed);
assert_eq!(GNode::eval(&graph, &ctx), GPoll::Pending);
assert_eq!(runtime.drain(), vec![9]);

View File

@@ -68,6 +68,7 @@ impl_via_hash! {
#[cfg(feature = "std")]
impl_via_hash! {
String,
core::time::Duration,
}
impl<'a> CacheHash for std::borrow::Cow<'a, str> {