From 9f348e6944787ff168109ccc086489f50cd70780 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 24 Dec 2024 06:23:55 +0100 Subject: [PATCH] Invocation: able to build and invoke a simple Render Node (see: #1367) **This is a Milestone for the Render Engine integration effort** After various rounds of prototyping and refactoring, the Render Node builder and invocation code is now able to * bind a simple function * handle arbitrary input / output and parameter types * invoke a Render Node configured with this function --- src/steam/engine/proc-node.hpp | 30 ++--- src/steam/engine/turnout-system.hpp | 5 +- tests/core/steam/engine/node-builder-test.cpp | 17 ++- wiki/thinkPad.ichthyo.mm | 120 ++++++++++++------ 4 files changed, 110 insertions(+), 62 deletions(-) diff --git a/src/steam/engine/proc-node.hpp b/src/steam/engine/proc-node.hpp index c19adacef..db38c551b 100644 --- a/src/steam/engine/proc-node.hpp +++ b/src/steam/engine/proc-node.hpp @@ -239,25 +239,25 @@ namespace engine { return wiring_.ports[portIdx]; } - /** Engine Core operation: render and pull output from this node. - * On return, currentProcess will hold onto output buffer(s) - * containing the calculated result frames. In case this node - * calculates a multichannel output, only one channel can be - * retrieved by such a \c pull() call, but you can expect data - * of the other channels to be processed and fed to cache. - * @param currentProcess the current processing state for - * managing buffers and accessing current parameter values - * @param requestedOutputNr the output channel requested - * (in case this node delivers more than one output channel) - * @return handle to the buffer containing the calculated result. + + /*************************************************************//** + * Engine Core operation: render and pull output from this node. + * Activate the indicated Port, which may recursively pull from + * »Lead Nodes« (predecessors) and invoke the operation embodied + * by this node. The stack frame of this call acts as anchor + * to hold the TurnoutSystem for parameter access and coordination. + * @param portIdx the port (≙flavour) to activate + * @param output a BuffHandle configured suitably to hold results + * @param nomTime _absolute nominal Time_ to key this invocation + * @param procKey additional process key for context parameters + * @return handle to the buffer containing the calculated result. */ -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation BuffHandle - pull (StateClosure_OBSOLETE& currentProcess, uint requestedOutputNr=0) const + pull (uint portIdx, BuffHandle output, Time nomTime, ProcessKey procKey) { - return this->wiringConfig_.callDown (currentProcess, requestedOutputNr); + TurnoutSystem turnoutSystem{nomTime, procKey}; + return getPort(portIdx).weave (turnoutSystem, output); } -#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1367 : Rebuild the Node Invocation /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation /// „backdoor“ to watch internals from tests diff --git a/src/steam/engine/turnout-system.hpp b/src/steam/engine/turnout-system.hpp index 823a13936..0312dcc05 100644 --- a/src/steam/engine/turnout-system.hpp +++ b/src/steam/engine/turnout-system.hpp @@ -41,11 +41,14 @@ #include "lib/time/timevalue.hpp" #include "lib/hetero-data.hpp" +#include + namespace steam { namespace engine { using lib::time::Time; + using ProcessKey = uint64_t; template class ParamStorageFrame @@ -65,7 +68,7 @@ namespace engine { { /////////////////////////////////////////////////////////OOO Storage: ich brauche Overflow-Buckets. KISS ==> erst mal intrusive linked List public: - TurnoutSystem (Time absoluteNominalTime) + TurnoutSystem (Time absoluteNominalTime, ProcessKey procKey =0) { } // this is a copyable front-end object }; diff --git a/tests/core/steam/engine/node-builder-test.cpp b/tests/core/steam/engine/node-builder-test.cpp index 13dc05dab..c64c44ece 100644 --- a/tests/core/steam/engine/node-builder-test.cpp +++ b/tests/core/steam/engine/node-builder-test.cpp @@ -19,6 +19,7 @@ #include "lib/test/run.hpp" #include "steam/engine/node-builder.hpp" #include "steam/engine/diagnostic-buffer-provider.hpp" +#include "lib/test/diagnostic-output.hpp" //#include "lib/util.hpp" @@ -48,8 +49,8 @@ namespace test { } - /** @test TODO build a simple output-only Render Node - * @todo WIP 12/24 🔁 define ⟶ implement + /** @test build a simple output-only Render Node + * @todo 12/24 ✔ define ⟶ ✔ implement */ void build_simpleNode() @@ -66,10 +67,18 @@ namespace test { CHECK (watch(node).ports().size() == 1); // Prepare setup to invoke such a Render Node... - using Buffer = long; BufferProvider& provider = DiagnosticBufferProvider::build(); - BuffHandle buff = provider.lockBufferFor (-55); + BuffHandle buff = provider.lockBufferFor (-55); + Time nomTime = Time::ZERO; + ProcessKey key{0}; + uint port{0}; + CHECK (-55 == buff.accessAs()); + + // Trigger Node invocation... + buff = node.pull (port, buff, nomTime, key); + + CHECK (LIFE_AND_UNIVERSE_4EVER == buff.accessAs()); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 10d78b996..97b7a33c3 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -88751,14 +88751,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + - - - + + + @@ -88767,9 +88767,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -95206,8 +95206,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -97883,17 +97883,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + +
- - - - + + + + @@ -97903,17 +97904,16 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
-
- - - + + + - + @@ -97923,10 +97923,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + +
- + + @@ -97935,12 +97938,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + + + + + + @@ -97949,9 +97957,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

+ - + @@ -97964,7 +97973,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -97975,8 +97984,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + + @@ -97987,7 +97998,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + + @@ -98088,8 +98101,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + - + + @@ -98100,7 +98116,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -98116,7 +98132,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + @@ -98124,13 +98141,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + - + +

- Ich hatte schon angefangen, über der mögilchen Implementierung zu »brüten« und mich wieder in BufferProvider + OutputSlot eingelesen. Erst nach etwa einer Stunde ist mir aufgefallen, daß OutputSlot ja eine DataSink erzeugt, und daß diese bereits eine lockBufferFor(FrameID)-Funktion hat, die ein (TADAA!) BuffHandle liefert. Nicht wirklich überraschend, da ich ja beide Protokolle (Buffer Provider und Output Slot) kurze Zeit nacheinander entworfen habe. Daher konnte ich wohl damals auch einen Proof-of-Concept-Test ziemlich einfach „aus dem Ärmel schütteln“... + Ich hatte schon angefangen, über der mögilchen Implementierung zu »brüten« und mich wieder in BufferProvider + OutputSlot eingelesen. Erst nach etwa einer Stunde ist mir aufgefallen, daß OutputSlot ja eine DataSink erzeugt, und daß diese bereits eine lockBufferFor(FrameID)-Funktion hat, die ein (TADAA!) BuffHandle liefert. Nicht wirklich überraschend, da ich ja beide Protokolle (Buffer Provider und Output Slot) kurze Zeit nacheinander entworfen habe. Daher konnte ich wohl damals auch einen Proof-of-Concept-Test ziemlich einfach „aus dem Ärmel schütteln“...

@@ -98147,7 +98169,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + + @@ -98175,8 +98198,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -98290,8 +98313,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
allerdings war das Design nie etwas anderes als vorläufig

- -
+ @@ -98299,8 +98321,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
...denn in all honesty, die Prämisse war und ist, daß man auf dieser Basis einen echten BufferProvider implementieren können dürfen sollte

- -
+
@@ -98372,7 +98393,6 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
-
@@ -98386,6 +98406,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + +