mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
#ifndef RENDERMANAGER_H
|
|
#define RENDERMANAGER_H
|
|
|
|
#include <QMutex>
|
|
#include <QQueue>
|
|
#include <QString>
|
|
#include <QThread>
|
|
#include <QWaitCondition>
|
|
#include <functional>
|
|
#include "renderdoc_replay.h"
|
|
|
|
struct IReplayRenderer;
|
|
class LambdaThread;
|
|
|
|
// simple helper for the common case of 'we just need to run this on the render thread
|
|
#define INVOKE_MEMFN(function) \
|
|
m_Core->Renderer()->AsyncInvoke([this](IReplayRenderer *) { function(); });
|
|
|
|
class RenderManager
|
|
{
|
|
public:
|
|
typedef std::function<void(IReplayRenderer *)> InvokeMethod;
|
|
|
|
RenderManager();
|
|
~RenderManager();
|
|
|
|
void Init(int proxyRenderer, QString replayHost, QString logfile, float *progress);
|
|
|
|
bool IsRunning();
|
|
ReplayCreateStatus GetCreateStatus() { return m_CreateStatus; }
|
|
void AsyncInvoke(InvokeMethod m);
|
|
void BlockInvoke(InvokeMethod m);
|
|
|
|
void CloseThread();
|
|
|
|
private:
|
|
struct InvokeHandle
|
|
{
|
|
InvokeHandle(InvokeMethod m)
|
|
{
|
|
method = m;
|
|
processed = false;
|
|
selfdelete = true;
|
|
}
|
|
|
|
InvokeMethod method;
|
|
bool processed;
|
|
bool selfdelete;
|
|
};
|
|
|
|
void run();
|
|
|
|
QMutex m_RenderLock;
|
|
QQueue<InvokeHandle *> m_RenderQueue;
|
|
QWaitCondition m_RenderCondition;
|
|
|
|
void PushInvoke(InvokeHandle *cmd);
|
|
|
|
int m_ProxyRenderer;
|
|
QString m_ReplayHost;
|
|
QString m_Logfile;
|
|
float *m_Progress;
|
|
|
|
volatile bool m_Running;
|
|
LambdaThread *m_Thread;
|
|
ReplayCreateStatus m_CreateStatus;
|
|
};
|
|
|
|
#endif // RENDERMANAGER_H
|