summaryrefslogtreecommitdiff
path: root/src/gpu/sequence_v2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/sequence_v2.cc')
-rw-r--r--src/gpu/sequence_v2.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gpu/sequence_v2.cc b/src/gpu/sequence_v2.cc
index c3f9aea..9e30db0 100644
--- a/src/gpu/sequence_v2.cc
+++ b/src/gpu/sequence_v2.cc
@@ -11,7 +11,15 @@ NodeRegistry::NodeRegistry(WGPUDevice device, int default_width,
int default_height)
: device_(device), default_width_(default_width),
default_height_(default_height) {
- // Reserve source/sink as implicit nodes (managed externally by MainSequence)
+ // Create placeholder source/sink nodes (will be updated externally before rendering)
+ Node placeholder = {};
+ placeholder.type = NodeType::U8X4_NORM;
+ placeholder.width = default_width;
+ placeholder.height = default_height;
+ placeholder.texture = nullptr;
+ placeholder.view = nullptr;
+ nodes_["source"] = placeholder;
+ nodes_["sink"] = placeholder;
}
NodeRegistry::~NodeRegistry() {
@@ -107,6 +115,15 @@ bool NodeRegistry::has_node(const std::string& name) const {
aliases_.find(name) != aliases_.end();
}
+void NodeRegistry::set_external_view(const std::string& name,
+ WGPUTextureView view) {
+ // Register external view (texture not owned by registry)
+ Node node = {};
+ node.view = view;
+ node.texture = nullptr; // Not owned
+ nodes_[name] = node;
+}
+
void NodeRegistry::create_texture(Node& node) {
WGPUTextureFormat format;
WGPUTextureUsage usage;
@@ -205,3 +222,9 @@ void SequenceV2::resize(int width, int height) {
dag_node.effect->resize(width, height);
}
}
+
+void SequenceV2::init_effect_nodes() {
+ for (auto& dag_node : effect_dag_) {
+ dag_node.effect->declare_nodes(nodes_);
+ }
+}