From 4a83f97c9ef5391e28cd2fe62c3949104f4de0e5 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 11 Oct 2024 16:57:10 +0200 Subject: [PATCH] Invocation: draft setup for engine context and config Prototyping and analysis revealed that some aspects of the render node wiring refers to effectively global services and can thus be taken out of the picture by relying on classical ''Dependency Injection'' Consequently, `EngineCtx` needs a default implementation, which brings up a simplistic fall-back version of those services in support for prototyping. Moreover, dedicated lifecycle functionality must be provided to bring up and shut down the actual service instances intended for operational use. --- src/steam/engine/buffer-provider.hpp | 2 +- src/steam/engine/engine-ctx-facilities.cpp | 77 ++++++++++ src/steam/engine/engine-ctx-facilities.hpp | 62 ++++++++ src/steam/engine/engine-ctx.hpp | 19 ++- src/steam/engine/turnout.hpp | 6 +- wiki/thinkPad.ichthyo.mm | 164 ++++++++++++++------- 6 files changed, 266 insertions(+), 64 deletions(-) create mode 100644 src/steam/engine/engine-ctx-facilities.cpp create mode 100644 src/steam/engine/engine-ctx-facilities.hpp diff --git a/src/steam/engine/buffer-provider.hpp b/src/steam/engine/buffer-provider.hpp index e8cae91aa..bd5d90a0b 100644 --- a/src/steam/engine/buffer-provider.hpp +++ b/src/steam/engine/buffer-provider.hpp @@ -46,7 +46,7 @@ #include "lib/symbol.hpp" #include "lib/hash-value.h" #include "steam/engine/buffhandle.hpp" -#include "steam/engine/engine-ctx.hpp" +//#include "steam/engine/engine-ctx.hpp" #include "steam/engine/type-handler.hpp" #include "steam/engine/buffer-local-tag.hpp" #include "lib/nocopy.hpp" diff --git a/src/steam/engine/engine-ctx-facilities.cpp b/src/steam/engine/engine-ctx-facilities.cpp new file mode 100644 index 000000000..ccf28e980 --- /dev/null +++ b/src/steam/engine/engine-ctx-facilities.cpp @@ -0,0 +1,77 @@ +/* + EngineCtxFacilities - Implementation of global render engine operational services + + Copyright (C) Lumiera.org + 2024, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +/** @file engine-ctx-facilities.hpp + ** Implementation parts of render engine operational services. + ** @warning as of 10/2024 a preliminary integration of Render-Engine underway ////////////////////////////////////////TICKET #1367 + */ + + +#include "steam/engine/engine-ctx-facilities.hpp" + +//#include +//#include +//#include + + + +namespace steam { +namespace engine{ + +// using std::string; +// using lumiera::Subsys; +// using std::function; +// using std::bind; +// using std::ref; + + + namespace { // hidden local details of the service implementation.... + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Temp Placeholder + BufferProvider* kabooom{nullptr}; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Temp Placeholder + } // (End) hidden service impl details + + + + + + /** storage for the EngineService interface object */ + lib::Depend EngineCtx::access; + + + + /** */ + EngineCtx::EngineCtx() + : mem{*kabooom} + , cache{*kabooom} + { } + + + + /** core operation: blah blubb.... + */ + + + +}} // namespace steam::engine diff --git a/src/steam/engine/engine-ctx-facilities.hpp b/src/steam/engine/engine-ctx-facilities.hpp new file mode 100644 index 000000000..5b404bae7 --- /dev/null +++ b/src/steam/engine/engine-ctx-facilities.hpp @@ -0,0 +1,62 @@ +/* + ENGINE-CTX-FACILITIES.hpp - Implementation of global render engine operational services + + Copyright (C) Lumiera.org + 2024, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file engine-ctx-facilities.hpp + ** Implementation of render engine operational configuration and services. + ** Without further setup, [dependency injection](\ref depend.hpp) will establish a + ** minimalistic default instantiation of these services, sufficient for demonstration + ** and tests. For the real render engine however, dedicated service instances will be + ** created and managed actively. + ** @todo and we'll have yet to »figure out« what specifically to do for these + ** services and how to start an active render engine for productive use. + ** @todo WIP-WIP 10/2024 strive at first complete prototypical engine usage ////////////////////////////////////////TICKET #1367 + ** + ** @see engine-ctx.hpp + ** @see weaving-pattern-builder.hpp + */ + +#ifndef STEAM_ENGINE_ENGINE_CTX_FACILITIES_H +#define STEAM_ENGINE_ENGINE_CTX_FACILITIES_H + + +#include "steam/engine/engine-ctx.hpp" + +//#include +//#include + + +namespace steam { +namespace engine { + +// using lib::Literal; +// using std::unique_ptr; +// using std::forward; + + class EngineCtx::Facilities + { + public: + }; + + + +}} // namespace steam::engine +#endif /*STEAM_ENGINE_ENGINE_CTX_FACILITIES_H*/ diff --git a/src/steam/engine/engine-ctx.hpp b/src/steam/engine/engine-ctx.hpp index 02312b34e..24faf1f89 100644 --- a/src/steam/engine/engine-ctx.hpp +++ b/src/steam/engine/engine-ctx.hpp @@ -26,11 +26,13 @@ ** render node connectivity, where they are used for each invocation of a render job. ** ** The EngineCtx itself is meant to be [dependency injected](\ref lib::Depend), so that - ** tests can use suitably adapted variants for verifications. + ** tests can use suitably adapted variants for verifications. The default instantiation + ** provides a naive self-contained implementation suitable for demonstration and test. ** @todo who is responsible for setup of the services for the actual render engine? ** Might be closely related to brining up façade interfaces. - ** @todo WIP 8/2024 provide render node structures + ** @todo WIP-WIP 10/2024 provide render node structures ** + ** @see engine-ctx-facilities.hpp implementation ** @see buffer-provider.hpp ** @see buffhandle.hpp */ @@ -44,14 +46,14 @@ #include "lib/nocopy.hpp" //#include -#include +//#include namespace steam { namespace engine { // using lib::Literal; - using std::unique_ptr; +// using std::unique_ptr; // using std::forward; class EngineCtx @@ -60,11 +62,16 @@ namespace engine { public: BufferProvider& mem; BufferProvider& cache; - BufferProvider& output; +// BufferProvider& output; /////////////////////////OOO presumably no longer necessary - class Services; + class Facilities; + static lib::Depend access; + + private: EngineCtx(); + + friend class lib::DependencyFactory; }; diff --git a/src/steam/engine/turnout.hpp b/src/steam/engine/turnout.hpp index 6ae7032fc..930b77269 100644 --- a/src/steam/engine/turnout.hpp +++ b/src/steam/engine/turnout.hpp @@ -280,9 +280,9 @@ namespace engine { * the input and output data feeds (buffers) into a processing function. * @tparam CONF a configuration / policy base class * @note assumptions made regarding the overall structure - * - CONF::Feed defines an _invocation adapter_ for the processing function - * - CONF::buildFeed is a functor to (repeatedly) build `Feed` instances - * - this adapter in turn embeds a `FeedManifold` to hold + * - `CONF::Feed` defines an _invocation adapter_ for the processing function + * - `CONF::buildFeed()` is a functor to (repeatedly) build `Feed` instances + * - the _invocation adapter_ in turn embeds a `FeedManifold` to hold * + an array of input buffer pointers * + an array of output buffer pointers * + `CONF::MAX_SIZ` limits both arrays diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index ca378323b..9199571ed 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -7199,9 +7199,7 @@ - - - +

...halten wir besser raus aus diesem Design. @@ -7255,9 +7253,7 @@ - - - +

...was für verschiedene Arten von Zugriff @@ -7292,9 +7288,7 @@ - - - +

mögliche @@ -7404,9 +7398,7 @@ - - - +

betrachte ich als ungesund @@ -7483,9 +7475,7 @@ - - - +

auf welche Eigenschaften @@ -8012,9 +8002,7 @@ - - - +

Tiefensuche über die reale UI-Topologie @@ -8513,9 +8501,7 @@ - - - +

sind Monaden @@ -9674,9 +9660,7 @@ - - - +

...ohne daß die Funktionen auch virtuell sind, @@ -11847,9 +11831,7 @@ - - - +

ist keine Lösung @@ -15774,9 +15756,7 @@ - - - +

  • @@ -85795,15 +85775,25 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + - + - + - + + + + + + + + + + + @@ -88425,8 +88415,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -88454,7 +88444,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -88547,7 +88537,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -88557,7 +88547,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + + + @@ -88566,8 +88558,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - + + @@ -88597,7 +88589,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + + + + +

    + nein! jetzt direkt im Aufruf gelöst +

    + + +
    + +
    @@ -88612,7 +88615,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + + + + +

    + ja: ist problematisch — und genau deshalb ziehe ich jetzt vor, den Output-Buffer direkt über den Aufruf bereitzustellen; dieser Aspekt spielt damit für das Thema Dependency-Injection keine Rolle mehr +

    + + +
    + @@ -88679,7 +88692,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + @@ -88776,12 +88789,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - - - + + + - - + + + @@ -89070,10 +89084,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + - + + @@ -89085,6 +89100,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    +
    @@ -89117,9 +89133,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - + + + + + + + +

    + ...es ist zwar gut, daß es das LocalTag gibt, aber für diesen Fall ist das eine unsinnige Trickserei; es ist viel besser, an der einzigen Stelle, wo das benötigt wird (nämlich auf top-Level) explizit eine Flag zu setzen und dann den Buffer zu entnehmen +

    + + +
    +
    @@ -89136,12 +89165,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    - +

    - Den OutputBufferProvider handhaben wir jetzt eine Ebene höher, und dort können wir direkt ein LocalTag setzen und dann ein zugehöriges BuffHandle erstellen, das nur an einen bestimmten Buffer im Output-system gebunden ist. Alle anderen Use-Cases (Memory-Blöcke und Cache) sind ohnehin global für die gesamte RenderEngine + Den OutputBufferProvider handhaben wir jetzt eine Ebene höher; genauer, wir hanhaben ihn direkt, denn es ist nur ein einziger Buffer auf top-Level. +

    +

    + Alle anderen Use-Cases (Memory-Blöcke und Cache) sind ohnehin global für die gesamte RenderEngine, und damit handhabbar mit den normalen DI-Mechanismen

    @@ -89164,6 +89196,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    + @@ -89180,6 +89213,22 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    + + + + + + + + + + + + + + + +
    @@ -89270,6 +89319,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
    + + + + + + +