From f29ec44fda4b8de2f31a0b3daea98cfd81b68346 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 22 Mar 2026 17:36:38 +0100 Subject: [PATCH] OutputSlot: setup a DataSink wired to the proxy-BufferProvider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...this is the gordian λ Note - embedding a copy of the shared-ptr in the closure - pre-configure a buffer descriptor (buffer type) * with the buffer size as retrieved from the connection * and pass the connection itself marked as LocalTag Thus, on invocation of the DataSink (functor), it suffices to invoke the lock() function on the BufferDescriptor, using the new additional argument introduced with the preceding commit --- src/vault/out/diagnostic-output-slot.hpp | 6 ++++ src/vault/out/output-buffer-proxy.hpp | 26 +++----------- src/vault/out/output-slot-connection.hpp | 18 ++++++++-- src/vault/out/output-slot.hpp | 10 ++++-- tests/steam/play/dummy-builder-context.hpp | 1 + wiki/thinkPad.ichthyo.mm | 41 ++++++++++++++++++---- 6 files changed, 70 insertions(+), 32 deletions(-) diff --git a/src/vault/out/diagnostic-output-slot.hpp b/src/vault/out/diagnostic-output-slot.hpp index 924cc0c84..17c9dbd00 100644 --- a/src/vault/out/diagnostic-output-slot.hpp +++ b/src/vault/out/diagnostic-output-slot.hpp @@ -135,6 +135,12 @@ namespace out { /* === Connection API === */ + size_t + getBufferSize() const override + { + UNIMPLEMENTED ("wtf buff?"); + } + Buff* claimBufferFor (FrameID frameNr) override { diff --git a/src/vault/out/output-buffer-proxy.hpp b/src/vault/out/output-buffer-proxy.hpp index cb02bfe94..18b906696 100644 --- a/src/vault/out/output-buffer-proxy.hpp +++ b/src/vault/out/output-buffer-proxy.hpp @@ -116,15 +116,6 @@ namespace out { auto buildStore() { return std::make_unique(); } }; - BuffDescr - registerBuffer (void* buff, size_t siz) - { - REQUIRE (siz); - REQUIRE (buff); - auto& typeKey = bufferStage_->defineBufferType (siz, TypeHandler::RAW, LocalTag(buff)); - return buildDescriptor (typeKey); - } - public: OutputBufferProxy() @@ -132,20 +123,13 @@ namespace out { { } - template BuffDescr - getDescriptorFor (TAR& dataBlock) + getDescriptorFor (CON& connection) { - return registerBuffer(&dataBlock, sizeof(TAR)); - } - - template - BuffHandle - lockBuffer (TAR& dataBlock) - { - BuffDescr buffType = getDescriptorFor (dataBlock); - ENSURE (buffType.isValid()); - return buffType.lockBuffer(); + LocalTag connectionID{&connection}; + size_t buffSiz = connection.getBufferSize(); + auto& typeKey = bufferStage_->defineBufferType (buffSiz, TypeHandler::RAW, connectionID); + return buildDescriptor (typeKey); } }; diff --git a/src/vault/out/output-slot-connection.hpp b/src/vault/out/output-slot-connection.hpp index b4ee5dc7b..91700ee7d 100644 --- a/src/vault/out/output-slot-connection.hpp +++ b/src/vault/out/output-slot-connection.hpp @@ -35,7 +35,7 @@ #include "vault/out/output-slot.hpp" #include "vault/out/output-buffer-proxy.hpp" #include "lib/scoped-collection.hpp" -#include "lib/iter-adapter-stl.hpp" +#include "lib/iter-explorer.hpp" #include "lib/iter-source.hpp" #include "lib/handle.hpp" #include "lib/time/timevalue.hpp" @@ -43,6 +43,7 @@ //#include "steam/play/timings.hpp" //#include "lib/sync.hpp" #include "vault/mem/buffer-provider.hpp" +#include "lib/util.hpp" //#include #include @@ -59,7 +60,7 @@ namespace out { using vault::mem::BufferProvider; using lib::time::TimeValue; /////////////////OOO Rly? //using std::string; - using lib::iter_stl::eachElm; + using util::unConst; //using std::placeholders::_1; //using std::bind; @@ -95,6 +96,7 @@ namespace out { public: virtual ~Connection(); + virtual size_t getBufferSize() const =0; virtual Buff* claimBufferFor(FrameID) =0; virtual bool isTimely (FrameID, TimeValue) =0; virtual void transfer (Buff*) =0; @@ -151,7 +153,17 @@ namespace out { OpenedSinks connect (PAlloc& lifecycleManager) override { - /////////////////OOO use an iterExplorer-Pipeline to create the functor closure here + return lib::explore (connections_) + .transform([&](CON& connection) -> DataSink + { // setup the DataSink functor + return [bufferDescriptor = bufferProxy_.getDescriptorFor (connection) + ,lifecycleManager ] + (FrameID frame) mutable -> BuffHandle + { + return bufferDescriptor.lockBuffer (frame); + }; + }) + .asIterSource(); } diff --git a/src/vault/out/output-slot.hpp b/src/vault/out/output-slot.hpp index 2806238cb..09e3ad531 100644 --- a/src/vault/out/output-slot.hpp +++ b/src/vault/out/output-slot.hpp @@ -32,7 +32,7 @@ ** retrieving this OutputSlot. For example, a stereo sound output may expect only a single ** data feed, where data blocks for both channels are sent in interleaved format. ** - ** Once the client retrieves some OutputSlot, it was _allocated_ for exclusive use for that client; + ** Once the client retrieves some OutputSlot, it was _allocated_ for exclusive use for that client. ** At any time, there may be only a single client using a given output capability this way. It should ** be noted thus that output slots don't provide any kind of inherent mixing capability; any adaptation, ** mixing, overlaying and sharing needs to be done within the Render Node Network that produces the @@ -115,7 +115,13 @@ namespace out { */ class DataSink : public std::function - { }; + { + public: + template + DataSink (FUN&& fun) + : std::function{std::forward (fun)} + { } + }; diff --git a/tests/steam/play/dummy-builder-context.hpp b/tests/steam/play/dummy-builder-context.hpp index f34983fa8..f26747e3f 100644 --- a/tests/steam/play/dummy-builder-context.hpp +++ b/tests/steam/play/dummy-builder-context.hpp @@ -80,6 +80,7 @@ namespace test { class UnimplementedConnection : public vault::out::OutputSlot::Connection { + size_t getBufferSize() const override { UNIMPLEMENTED ("getBufferSize()"); } Buff* claimBufferFor (FrameID) override; bool isTimely (FrameID, TimeValue) override { return true; } void transfer (Buff*) override { UNIMPLEMENTED ("transfer (BuffHandle const&)"); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 0e6949235..fc6c7dec9 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -138663,7 +138663,35 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + + + + + + +

+ ein shared-ptr mit Alias auf die jeweilige Connection +

+ + +
+ + + + + + + + + + + + + + + + + @@ -138682,16 +138710,17 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension)
- + + - + - + - + @@ -138738,7 +138767,7 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - +