mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Carry the new layout fields through the hand-built fixtures
The record fixtures spell their metas and resolved layouts out in full, so the name-from-input fields reach them as empty. `named_value!`'s example moves to `ignore`: its `for T` arm implements a core-types trait on the value type, which only core-types itself may do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -310,7 +310,7 @@ pub fn intern_name(name: &str) -> &'static str {
|
||||
/// `Row: &T` and `Row: Option<&T>` declare a token naming a reference value,
|
||||
/// whose payload the writing kernel parks in the arena.
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// core_types::named_value! {
|
||||
/// /// Plain rows, implemented on the value type itself.
|
||||
/// for f64;
|
||||
@@ -318,6 +318,9 @@ pub fn intern_name(name: &str) -> &'static str {
|
||||
/// pub Text: &str;
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// The `for T` arm implements this crate's trait on `T`, so rows over types
|
||||
/// this crate does not own are declared here rather than by a caller.
|
||||
#[macro_export]
|
||||
macro_rules! named_value {
|
||||
() => {};
|
||||
|
||||
@@ -278,6 +278,7 @@ mod tests {
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
lane_invariant: u32::MAX,
|
||||
named_writes: Vec::new(),
|
||||
});
|
||||
RecordExtract::new(graph, &layout)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ mod tests {
|
||||
use core_types::context::{ContextImpl, EvalScope};
|
||||
use core_types::node::Node;
|
||||
use core_types::record::LiftedSource;
|
||||
use core_types::registry::{SourceHandle, ErasedRecordNode};
|
||||
use core_types::registry::{ErasedRecordNode, SourceHandle};
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
fn lifted<T: Clone + Send + Sync + core_types::StaticTypeSized>(value: T) -> LiftedSource<T, impl for<'c> Fn(&ContextImpl<'c>) -> GPoll<T>>
|
||||
|
||||
@@ -662,6 +662,7 @@ mod tests {
|
||||
// The fixtures wire constants into every eager input, which the compiler
|
||||
// pass records as lane-invariant.
|
||||
let resolved = core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
lane_invariant: u32::MAX,
|
||||
..meta.resolve(inputs)
|
||||
};
|
||||
@@ -671,6 +672,7 @@ mod tests {
|
||||
|
||||
fn install_flip<N: Node<ContextImpl<'static>>>(mut node: N, layout: &Layout) -> N {
|
||||
let bundle = core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
@@ -764,6 +766,8 @@ mod tests {
|
||||
let frames = frames_for(&[&base, &count_layout]);
|
||||
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -800,6 +804,8 @@ mod tests {
|
||||
let frames = frames_for(&[&base, &count_layout]);
|
||||
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -844,6 +850,8 @@ mod tests {
|
||||
let frames = frames_for(&[&base, &count_layout, &reverse_layout]);
|
||||
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -894,6 +902,8 @@ mod tests {
|
||||
&[Some(&base)],
|
||||
);
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -992,6 +1002,8 @@ mod tests {
|
||||
field: Some((Length::NAME, 7.)),
|
||||
};
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0, 1],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1060,6 +1072,8 @@ mod tests {
|
||||
field: Some((Opacity::NAME, 0.25)),
|
||||
};
|
||||
let meta = || core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0, 1],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1134,6 +1148,8 @@ mod tests {
|
||||
field: Some((Length::NAME, 7.)),
|
||||
};
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0, 1],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1178,6 +1194,8 @@ mod tests {
|
||||
|
||||
let content_layout = leveled_f64_layout(&[]);
|
||||
let meta = || core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1187,6 +1205,8 @@ mod tests {
|
||||
folded: None,
|
||||
};
|
||||
let extend_meta = || core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0, 1],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1262,6 +1282,8 @@ mod tests {
|
||||
let layout = leveled_f64_layout(&[]);
|
||||
let frames = frames_for(&[&layout]);
|
||||
let meta = || core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1315,6 +1337,8 @@ mod tests {
|
||||
};
|
||||
let (index_edge, index_layout) = lifted_value(index);
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1531,6 +1555,7 @@ mod tests {
|
||||
let evals = std::cell::Cell::new(0u32);
|
||||
let mut node = MirrorNode::new(RecordSource::new(content, &layout, &layout), counting_value(true, &evals));
|
||||
let resolved = core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
lane_invariant: 0,
|
||||
..mirror_layout_meta().resolve(&[Some(&layout)])
|
||||
};
|
||||
@@ -1609,6 +1634,8 @@ mod tests {
|
||||
&[Some(&base)],
|
||||
);
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1662,6 +1689,8 @@ mod tests {
|
||||
&[Some(&base)],
|
||||
);
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1772,6 +1801,8 @@ mod tests {
|
||||
let (count_edge, count_layout) = lifted_value(2u32);
|
||||
let (reverse_edge, reverse_layout) = lifted_value(false);
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -1898,6 +1929,8 @@ mod tests {
|
||||
let frames = frames_for(&[&base, &count_layout, &out]);
|
||||
|
||||
let meta = core_types::record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![0],
|
||||
reads: vec![],
|
||||
element: core_types::record::ElementSpec::Carried,
|
||||
@@ -2443,13 +2476,7 @@ mod tests {
|
||||
let frames = frames_for(&[&source_layout]);
|
||||
|
||||
let node = install(
|
||||
FadeAsyncNode::new(
|
||||
f64_record_source(&source_layout, 3., vec![("length", 9.)]),
|
||||
ValueSource::new(0.5),
|
||||
runtime,
|
||||
source_id,
|
||||
&source_layout,
|
||||
),
|
||||
FadeAsyncNode::new(f64_record_source(&source_layout, 3., vec![("length", 9.)]), ValueSource::new(0.5), runtime, source_id, &source_layout),
|
||||
fade_async_layout_meta(),
|
||||
&[Some(&source_layout)],
|
||||
);
|
||||
@@ -2482,11 +2509,7 @@ mod tests {
|
||||
let layout = measure_async_layout();
|
||||
let frames = frames_for(&[&layout]);
|
||||
|
||||
let node = install(
|
||||
MeasureAsyncNode::new(ValueSource::new(()), ValueSource::new(-4.), runtime, source_id),
|
||||
measure_async_layout_meta(),
|
||||
&[],
|
||||
);
|
||||
let node = install(MeasureAsyncNode::new(ValueSource::new(()), ValueSource::new(-4.), runtime, source_id), measure_async_layout_meta(), &[]);
|
||||
assert_eq!(Node::<ContextImpl>::layout(&node), &layout);
|
||||
|
||||
let GPoll::Final(served) = core_types::record::capture(&node, &ctx, &frames) else {
|
||||
|
||||
@@ -285,6 +285,7 @@ mod tests {
|
||||
// The fixtures wire constants into every eager input, which the compiler
|
||||
// pass records as lane-invariant.
|
||||
let resolved = record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
lane_invariant: u32::MAX,
|
||||
..meta.resolve(inputs)
|
||||
};
|
||||
@@ -294,6 +295,7 @@ mod tests {
|
||||
|
||||
fn install_flip<N: Node<ContextImpl<'static>>>(mut node: N, layout: &Layout) -> N {
|
||||
let bundle = record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
@@ -420,6 +422,8 @@ mod tests {
|
||||
|
||||
fn routing_meta(source: u8, level_delta: i8) -> record::LayoutMeta {
|
||||
record::LayoutMeta {
|
||||
named_writes: Vec::new(),
|
||||
folded_names: Vec::new(),
|
||||
sources: vec![source],
|
||||
reads: vec![],
|
||||
element: record::ElementSpec::Carried,
|
||||
|
||||
@@ -272,6 +272,7 @@ mod tests {
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
lane_invariant: u32::MAX,
|
||||
named_writes: Vec::new(),
|
||||
},
|
||||
);
|
||||
let GPoll::Final(result) = core_types::record::serve_input(&graph, &ctx, &frames) else {
|
||||
|
||||
@@ -1053,6 +1053,7 @@ mod graphene_test {
|
||||
|
||||
fn installed<N: Node<ContextImpl<'static>>>(mut node: N, layout: &Layout) -> N {
|
||||
node.set_layout(core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
@@ -1114,6 +1115,7 @@ mod graphene_test {
|
||||
let mut wired = construct(&entries[0], vec![record_value_source(true), record_value_source(false)]).unwrap();
|
||||
let layout = out_layout::<bool>();
|
||||
wired.set_layout(core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
@@ -1160,6 +1162,7 @@ mod graphene_test {
|
||||
let mut wired = construct(&entries[0], vec![record_value_source(1.5f64), record_value_source(2.5f64)]).unwrap();
|
||||
let layout = out_layout::<f64>();
|
||||
wired.set_layout(core_types::record::RecordLayout {
|
||||
named_writes: Vec::new(),
|
||||
frame_bytes: layout.frame_bytes(),
|
||||
plan: Vec::new(),
|
||||
layout: layout.clone(),
|
||||
|
||||
Reference in New Issue
Block a user