Files
oak-editor/app/render/backend/renderworker.h
T
itsmattkc 5227e10f39 render one frame per thread for increased parallelism
If the nodes are now stateless, there's nothing stopping the renderer from
rendering multiple frames at once. Earlier since the nodes held some of their
input/output data (and that data could change per frame), it was not possible
to render multiple frames at once without conflicts. Now that the node state is
held in render threads, they can do whatever they want at any time.
2019-12-06 15:37:31 +11:00

69 lines
1.5 KiB
C++

#ifndef RENDERWORKER_H
#define RENDERWORKER_H
#include <QObject>
#include "common/constructors.h"
#include "node/output/track/track.h"
#include "node/node.h"
#include "decodercache.h"
class RenderWorker : public QObject
{
Q_OBJECT
public:
RenderWorker(QObject* parent = nullptr);
DISABLE_COPY_MOVE(RenderWorker)
bool Init();
bool IsStarted();
bool IsAvailable();
public slots:
void Close();
void Render(NodeDependency path);
NodeValueTable RenderAsSibling(NodeDependency dep);
signals:
void RequestSibling(NodeDependency path);
void CompletedCache(NodeDependency dep, NodeValueTable data);
protected:
virtual bool InitInternal() = 0;
virtual void CloseInternal() = 0;
virtual NodeValueTable RenderInternal(const NodeDependency& path);
virtual bool OutputIsAccelerated(Node *output);
virtual void RunNodeAccelerated(Node *node, const NodeValueDatabase *input_params, NodeValueTable* output_params);
StreamPtr ResolveStreamFromInput(NodeInput* input);
DecoderPtr ResolveDecoderFromInput(StreamPtr stream);
virtual FramePtr RetrieveFromDecoder(DecoderPtr decoder, const TimeRange& range) = 0;
virtual void FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable* table) = 0;
NodeValueTable ProcessNodeNormally(const NodeDependency &dep);
virtual NodeValueTable RenderBlock(TrackOutput *track, const TimeRange& range) = 0;
QAtomicInt working_;
private:
bool started_;
DecoderCache decoder_cache_;
};
#endif // RENDERWORKER_H