render: real texture binding, generator layers and iteration feedback in shader passes

- process_shader_job: bind all texture params by name, recurse into nested
  shader payloads (depth cap 8), fall back to frame size without inputs
- run_effect: take iterative_input so dropshadow previous_iteration_in works
- merge: actually composite inputs; keyer mask, opacity modulation, math
  texture ops and mrg generator layers now bind their textures
- transform distort: real fragment-side inverse-matrix sampling
- time offset / time remap: wire NodeBehavior time adjustment hooks
- plugin: fix first-node identity colliding with unbound sentinel
This commit is contained in:
2026-09-09 16:33:29 +08:00
parent cde4dddf32
commit 5ab12b937f
28 changed files with 1157 additions and 434 deletions
+10 -5
View File
@@ -261,15 +261,20 @@ fn registry() -> &'static Mutex<HashMap<u64, RegistryEntry>> {
}
/// 登记 oaknode 节点(facade 装配期调用;对应 M9 C++ 版
/// `oaknode_node_identity()` 注册表的登记侧)。返回打包身份
/// ([`oak_node::id::NodeId::identity`]),写入
/// [`crate::instance::Instance::bind_node`]。同一身份重复登记
/// 覆盖旧条目(重绑定)。
/// `oaknode_node_identity()` 注册表的登记侧)。返回的注册表键是打包
/// 身份 +1([`oak_node::id::NodeId::identity`]):身份 0 是合法的首
/// 节点,而 `Instance::node_identity` 以 0 为未绑定哨兵,移位后二者
/// 永不冲突。键写入 [`crate::instance::Instance::bind_node`],摘除与
/// 查找([`node_from_identity`])用同一键。同一身份重复登记覆盖旧
/// 条目(重绑定)。
pub fn register_node(
project: Arc<Mutex<oak_node::project::Project>>,
id: oak_node::id::NodeId,
) -> u64 {
let identity = id.identity();
let identity = id
.identity()
.checked_add(1)
.expect("register_node: the invalid node id has no registry key");
let entry = RegistryEntry {
project: Arc::downgrade(&project),
id,
+2 -3
View File
@@ -258,12 +258,11 @@ mod tests {
assert_eq!(p.format, PIXEL_FORMAT_F32);
}
/// 渲染器 kind 查询与 GL 判断;texture_id 桩恒 0(无 GL 命名空间)。
/// 渲染器 kind 查询与 GL 判断(wgpu 后端按设计无 GL 纹理名,
/// `texture_id` 恒 0 的桩不在这里断言)。
#[test]
fn renderer_kind_and_gl_id_stub() {
let r: Renderer = std::sync::Arc::new(FakeGpu);
assert!(!renderer_is_open_gl(&r));
let dummy = Texture::dummy();
assert_eq!(texture_id(&dummy), 0, "wgpu 无 GL 纹理名:桩恒 0");
}
}
+2 -2
View File
@@ -302,9 +302,9 @@ mod tests {
fn shim_v2_table_entry_resolves() {
let _g = TEST_LOCK.lock().unwrap();
let s = suite_v2();
assert!(!std::ptr::eq(
assert!(std::ptr::eq(
s.message as *const (),
ofx_message_shim_v1 as *const ()
ofx_message_shim_v2 as *const ()
));
}
+59
View File
@@ -1028,4 +1028,63 @@ mod tests {
);
}
}
/// paramSetValue → instanceChanged 回写(C++ paramChangedByPlugin):
/// 实例绑定节点后,插件侧改值经 PARAM_OWNER 定位实例、
/// notify_instance_changed 生成 undo 命令并立即 redo——节点输入
/// 即新值。
#[test]
fn set_value_writes_back_to_bound_node() {
let (inst, ih) = make_instance();
let s = suite_v1();
let mut gain: *mut c_void = std::ptr::null_mut();
unsafe {
assert_eq!(
(s.param_get_handle)(ih, cs("gain").as_ptr(), &mut gain, std::ptr::null_mut()),
0
);
}
// 宿主侧登记:param → 实例(生产由 createInstance 路径做),
// 实例 → oaknode 节点(facade 装配期做)。
let project = oak_node::project::Project::new();
let node_id = {
let mut guard = project.lock().unwrap_or_else(|e| e.into_inner());
let id = guard.graph.add_node(
oak_node::node::NodeCore::empty(),
Box::new(oak_node::nodes::EmptyBehavior),
);
guard.graph.get_mut(id).unwrap().core.add_input(
oak_node::input::Input::new(
"gain",
oak_node::value::ValueType::Int,
oak_node::value::NodeValue::Int(0),
),
);
id
};
let identity = crate::node::register_node(project.clone(), node_id);
inst.bind_node(identity as usize);
let param_addr = tag::strip(gain) as usize;
register_param_owner(param_addr, &inst.props as *const PropertySet as usize);
unsafe {
assert_eq!((s.param_set_value)(gain, 5), 0);
}
let stored = project
.lock()
.unwrap_or_else(|e| e.into_inner())
.graph
.get(node_id)
.unwrap()
.core
.standard_value("gain", -1);
assert_eq!(
stored,
oak_node::value::NodeValue::Int(5),
"插件改值必须经 instanceChanged 写回节点输入"
);
unregister_params_of(&inst.props as *const PropertySet as usize);
crate::node::unregister_node(identity);
}
}