2011-05-23 04:43:56 +02:00
|
|
|
|
/*
|
2011-05-23 05:46:40 +02:00
|
|
|
|
ENGINE-SERVICE.hpp - primary service access point for using the renderengine
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2011, Hermann Vosseler <Ichthyostega@web.de>
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** 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. See the file COPYING for further details.
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2011-05-23 05:46:40 +02:00
|
|
|
|
/** @file engine-service.hpp
|
2011-08-14 03:09:05 +02:00
|
|
|
|
** Access point for the (core) calculation service of the render engine.
|
2018-11-15 21:13:52 +01:00
|
|
|
|
** This Steam-Layer internal service is provided for use by the Player subsystem.
|
|
|
|
|
|
** The actual implementation is forwarded to Vault services (especially the scheduler).
|
2011-08-16 03:02:55 +02:00
|
|
|
|
** The EngineService singleton has no state beyond the jobs currently managed by the
|
|
|
|
|
|
** scheduler; when the latter isn't available, any invocation will throw.
|
2011-08-14 03:09:05 +02:00
|
|
|
|
**
|
2025-04-26 23:59:29 +02:00
|
|
|
|
** The central concept provided through this facade interface is the **calculation stream**.
|
2011-08-16 03:02:55 +02:00
|
|
|
|
** This represents a series of calculations, expected to happen in a timely fashion and in order
|
2013-09-01 02:30:14 +02:00
|
|
|
|
** to deliver a frame data stream into an opened output connection. On the implementation side,
|
|
|
|
|
|
** a calculation stream will be translated into a series of jobs to invoke render nodes;
|
2018-11-15 21:13:52 +01:00
|
|
|
|
** these jobs are to be executed through the scheduler in the Vault Layer.
|
2011-08-16 03:02:55 +02:00
|
|
|
|
**
|
|
|
|
|
|
** While the individual CalcStram is simple, linear and unmodifiable, any CalcStream may be
|
2016-11-09 19:13:52 +01:00
|
|
|
|
** _superseded_ by a new definition. In this case, the engine will care for a seamless
|
2011-08-16 03:02:55 +02:00
|
|
|
|
** switch and continuation; under the hood, there is a mechanism to discard resources
|
|
|
|
|
|
** tied to the original CalcStream, once the switch to the new definition is complete.
|
|
|
|
|
|
**
|
2013-10-25 06:34:38 +02:00
|
|
|
|
** @ingroup engine
|
2016-11-09 19:13:52 +01:00
|
|
|
|
** @todo draft from 2013, stalled, but still relevant and to be continued eventually
|
2023-04-17 04:51:38 +02:00
|
|
|
|
** @warning as of 4/2023 Render-Engine integration work is underway ////////////////////////////////////////TICKET #1233
|
|
|
|
|
|
**
|
2011-08-16 03:02:55 +02:00
|
|
|
|
** @see EngineInterface_test
|
|
|
|
|
|
** @see CalcStream_test
|
2018-11-15 23:59:23 +01:00
|
|
|
|
** @see steam::play::PlayerService
|
|
|
|
|
|
** @see vault::engine::EngineConfig
|
2013-01-12 11:17:29 +01:00
|
|
|
|
**
|
2011-05-23 04:43:56 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:52:02 +01:00
|
|
|
|
#ifndef STEAM_ENGINE_ENGINE_SERVICE_H
|
|
|
|
|
|
#define STEAM_ENGINE_ENGINE_SERVICE_H
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
2011-08-15 00:52:56 +02:00
|
|
|
|
#include "lib/error.hpp"
|
2018-03-24 05:35:13 +01:00
|
|
|
|
#include "lib/nocopy.hpp"
|
2011-05-23 05:46:40 +02:00
|
|
|
|
//#include "include/dummy-player-facade.h"
|
|
|
|
|
|
//#include "include/display-facade.h"
|
2026-03-10 23:12:30 +01:00
|
|
|
|
#include "vault/out/timings.hpp"
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/engine/calc-stream.hpp"
|
|
|
|
|
|
#include "steam/mobject/model-port.hpp"
|
2026-03-10 23:12:30 +01:00
|
|
|
|
#include "vault/out/output-slot.hpp"
|
2026-02-28 22:55:09 +01:00
|
|
|
|
//#include "vessel/instancehandle.hpp"
|
2011-05-23 05:46:40 +02:00
|
|
|
|
//#include "lib/singleton-ref.hpp"
|
2011-08-15 00:52:56 +02:00
|
|
|
|
#include "lib/polymorphic-value.hpp"
|
2013-10-20 03:19:36 +02:00
|
|
|
|
#include "lib/depend.hpp"
|
2018-03-24 05:35:13 +01:00
|
|
|
|
|
2013-06-03 05:25:13 +02:00
|
|
|
|
#include <functional>
|
2011-05-23 05:46:40 +02:00
|
|
|
|
//#include <string>
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
2023-04-17 04:51:38 +02:00
|
|
|
|
namespace steam {
|
2011-08-15 00:52:56 +02:00
|
|
|
|
namespace engine{
|
2011-05-23 04:43:56 +02:00
|
|
|
|
|
2011-05-23 05:46:40 +02:00
|
|
|
|
// using std::string;
|
2026-02-28 22:55:09 +01:00
|
|
|
|
// using vessel::Subsys;
|
|
|
|
|
|
// using vessel::Display;
|
|
|
|
|
|
// using vessel::DummyPlayer;
|
2014-04-03 22:42:48 +02:00
|
|
|
|
// using std::function;
|
2011-08-15 00:52:56 +02:00
|
|
|
|
using mobject::ModelPort;
|
2026-03-10 23:12:30 +01:00
|
|
|
|
using vault::out::Timings;
|
2011-08-15 00:52:56 +02:00
|
|
|
|
|
2026-03-20 23:39:10 +01:00
|
|
|
|
using vault::out::OutputSlot;
|
2011-05-23 05:46:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/**************************************************//**
|
2011-08-14 03:09:05 +02:00
|
|
|
|
* A service to schedule series of calculations,
|
|
|
|
|
|
* delivering the rendered data into an external output
|
|
|
|
|
|
* sink in a timely fashion. Actually the CalculationStream
|
|
|
|
|
|
* instances provided through this (facade) interface are
|
|
|
|
|
|
* backed by jobs executed through the scheduler in the
|
2018-11-15 21:13:52 +01:00
|
|
|
|
* vault layer. The implementation of this service is
|
2012-07-01 03:42:50 +02:00
|
|
|
|
* responsible for creating the right job entries in the
|
|
|
|
|
|
* correct order and to enqueue these into the scheduler.
|
2013-10-25 06:34:38 +02:00
|
|
|
|
* @ingroup engine
|
2011-05-23 05:46:40 +02:00
|
|
|
|
*/
|
|
|
|
|
|
class EngineService
|
2018-03-24 05:35:13 +01:00
|
|
|
|
: util::NonCopyable
|
2011-05-23 05:46:40 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-15 00:52:56 +02:00
|
|
|
|
/* The following typedefs allow to hand out predefined
|
|
|
|
|
|
* Quality-of-Service strategy definitions as value objects,
|
|
|
|
|
|
* without disclosing implementation details here in this header.
|
|
|
|
|
|
*/
|
|
|
|
|
|
enum{ QoS_IMPL_SIZE = sizeof(size_t) }; /////////////////////////////////////////TODO is this correct??
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-05-23 05:46:40 +02:00
|
|
|
|
public:
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/*********************************************************//**
|
2011-08-15 00:52:56 +02:00
|
|
|
|
* Quality-of-Service definition for an Render Engine usage.
|
|
|
|
|
|
* This strategy defines how to decide between conflicting goals like
|
|
|
|
|
|
* - timely delivery
|
|
|
|
|
|
* - image quality
|
|
|
|
|
|
* - niceness and resource usage
|
|
|
|
|
|
*/
|
|
|
|
|
|
class Quality
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
2015-07-04 21:09:44 +02:00
|
|
|
|
virtual ~Quality() { }; ///< this is an Interface
|
2011-08-15 00:52:56 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-07 23:59:57 +02:00
|
|
|
|
using _Clonable_QoS_Strategy = lib::polyvalue::CloneValueSupport<Quality>;
|
|
|
|
|
|
using QoS_Definition = lib::PolymorphicValue<Quality, QoS_IMPL_SIZE, _Clonable_QoS_Strategy>;
|
2011-08-15 00:52:56 +02:00
|
|
|
|
|
|
|
|
|
|
static QoS_Definition QoS_DEFAULT;
|
|
|
|
|
|
static QoS_Definition QoS_BACKGROUND;
|
|
|
|
|
|
static QoS_Definition QoS_SYNC_PRIORITY;
|
|
|
|
|
|
static QoS_Definition QoS_PERFECT_RESULT;
|
|
|
|
|
|
static QoS_Definition QoS_COMPROMISE;
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-16 03:02:55 +02:00
|
|
|
|
/** access point to the Engine Interface.
|
|
|
|
|
|
* @internal this is an facade interface for internal use
|
|
|
|
|
|
* by the player. Client code should use the Player.
|
|
|
|
|
|
*/
|
2013-10-20 03:19:36 +02:00
|
|
|
|
static lib::Depend<EngineService> instance;
|
2011-08-15 00:52:56 +02:00
|
|
|
|
|
2011-05-23 05:46:40 +02:00
|
|
|
|
|
2012-01-23 02:25:12 +01:00
|
|
|
|
virtual ~EngineService() { }
|
|
|
|
|
|
|
2011-08-16 03:02:55 +02:00
|
|
|
|
EngineService();
|
2011-05-23 05:46:40 +02:00
|
|
|
|
|
2011-12-17 04:45:42 +01:00
|
|
|
|
CalcStreams
|
2011-08-15 00:52:56 +02:00
|
|
|
|
calculate(ModelPort mPort,
|
|
|
|
|
|
Timings nominalTimings,
|
2026-03-20 23:39:10 +01:00
|
|
|
|
OutputSlot& outputSlot,
|
2011-08-15 00:52:56 +02:00
|
|
|
|
Quality serviceQuality =QoS_DEFAULT);
|
2011-08-14 03:09:05 +02:00
|
|
|
|
|
2011-12-17 04:45:42 +01:00
|
|
|
|
CalcStreams
|
2011-08-15 00:52:56 +02:00
|
|
|
|
calculateBackground(ModelPort mPort,
|
|
|
|
|
|
Timings nominalTimings,
|
|
|
|
|
|
Quality serviceQuality =QoS_BACKGROUND);
|
2011-08-14 03:09:05 +02:00
|
|
|
|
|
2011-08-16 03:02:55 +02:00
|
|
|
|
|
|
|
|
|
|
protected:
|
2023-04-17 04:51:38 +02:00
|
|
|
|
virtual RenderEnvironment& configureCalculation (ModelPort,Timings,Quality);
|
2012-01-21 03:13:33 +01:00
|
|
|
|
|
2011-08-16 03:02:55 +02:00
|
|
|
|
void activateTracing();
|
|
|
|
|
|
void disableTracing(); ///< EX_FREE
|
|
|
|
|
|
|
|
|
|
|
|
friend class EngineDiagnostics;
|
2013-06-15 04:02:48 +02:00
|
|
|
|
|
|
|
|
|
|
private:
|
2026-06-01 23:33:25 +02:00
|
|
|
|
static CalcStream activateCalculation (vault::out::OutputSlot::DataSink&, RenderEnvironment&);
|
2011-05-23 05:46:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-15 00:52:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}} // namespace steam::engine
|
2018-11-15 23:52:02 +01:00
|
|
|
|
#endif /*STEAM_ENGINE_ENGINE_SERVICE_H*/
|