Files
oak-editor/app/render/backend/opengl/openglbackend.h
T
itsmattkc f6064b40df hold worker busy state in renderbackend rather than in renderworker
Workers run in different threads and the backends can poll whether the worker
is currently busy or not. However the previous iteration has the worker (and an
atomic int) provide the busy state which could easily desync with the main
thread (since all workers run in different threads). By holding the busy states
in the main thread, the main thread will always be able to poll the busy state
accurately.
2019-12-06 19:38:57 +11:00

48 lines
1.1 KiB
C++

#ifndef OPENGLBACKEND_H
#define OPENGLBACKEND_H
#include "../videorenderbackend.h"
#include "openglframebuffer.h"
#include "openglworker.h"
#include "opengltexture.h"
#include "openglshader.h"
#include "openglshadercache.h"
class OpenGLBackend : public VideoRenderBackend
{
Q_OBJECT
public:
OpenGLBackend(QObject* parent = nullptr);
virtual ~OpenGLBackend() override;
OpenGLTexturePtr GetCachedFrameAsTexture(const rational& time);
protected:
virtual bool InitInternal() override;
virtual void CloseInternal() override;
virtual bool CompileInternal() override;
virtual void DecompileInternal() override;
private:
bool TimeIsCached(const TimeRange &time);
OpenGLTexturePtr master_texture_;
OpenGLShaderCache shader_cache_;
int last_download_thread_;
private slots:
void ThreadCompletedFrame(NodeDependency path, QByteArray hash, NodeValueTable table);
void ThreadCompletedDownload(NodeDependency dep, QByteArray hash);
void ThreadSkippedFrame(NodeDependency dep, QByteArray hash);
void ThreadHashAlreadyExists(NodeDependency dep, QByteArray hash);
};
#endif // OPENGLBACKEND_H