73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "OpenGLRenderPass.h"
|
|
#include "OpenGLRenderPipeline.h"
|
|
#include "OpenGLRenderer.h"
|
|
#include "OpenGLShaderPrograms.h"
|
|
#include "RuntimeHost.h"
|
|
#include "RuntimeSnapshotProvider.h"
|
|
|
|
#include <windows.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class RenderEngine
|
|
{
|
|
public:
|
|
using RenderEffectCallback = std::function<void()>;
|
|
using ScreenshotCallback = std::function<void()>;
|
|
using PreviewPaintCallback = std::function<void()>;
|
|
|
|
RenderEngine(
|
|
RuntimeHost& runtimeHost,
|
|
RuntimeSnapshotProvider& runtimeSnapshotProvider,
|
|
CRITICAL_SECTION& mutex,
|
|
HDC hdc,
|
|
HGLRC hglrc,
|
|
RenderEffectCallback renderEffect,
|
|
ScreenshotCallback screenshotReady,
|
|
PreviewPaintCallback previewPaint);
|
|
~RenderEngine();
|
|
|
|
bool CompileDecodeShader(int errorMessageSize, char* errorMessage);
|
|
bool CompileOutputPackShader(int errorMessageSize, char* errorMessage);
|
|
bool InitializeResources(
|
|
unsigned inputFrameWidth,
|
|
unsigned inputFrameHeight,
|
|
unsigned captureTextureWidth,
|
|
unsigned outputFrameWidth,
|
|
unsigned outputFrameHeight,
|
|
unsigned outputPackTextureWidth,
|
|
std::string& error);
|
|
bool CompileLayerPrograms(unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage);
|
|
bool CommitPreparedLayerPrograms(const PreparedShaderBuild& preparedBuild, unsigned inputFrameWidth, unsigned inputFrameHeight, int errorMessageSize, char* errorMessage);
|
|
|
|
const std::vector<RuntimeRenderState>& CommittedLayerStates() const;
|
|
void ResetTemporalHistoryState();
|
|
void ResetShaderFeedbackState();
|
|
void ResizeView(int width, int height);
|
|
bool TryPresentToWindow(unsigned outputFrameWidth, unsigned outputFrameHeight);
|
|
bool TryUploadInputFrame(const VideoIOFrame& inputFrame, const VideoIOState& videoState);
|
|
bool RenderOutputFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame);
|
|
void RenderLayerStack(
|
|
bool hasInputSource,
|
|
const std::vector<RuntimeRenderState>& layerStates,
|
|
unsigned inputFrameWidth,
|
|
unsigned inputFrameHeight,
|
|
unsigned captureTextureWidth,
|
|
VideoIOPixelFormat inputPixelFormat,
|
|
unsigned historyCap);
|
|
bool ReadOutputFrameRgba(unsigned width, unsigned height, std::vector<unsigned char>& bottomUpPixels);
|
|
|
|
private:
|
|
OpenGLRenderer mRenderer;
|
|
OpenGLRenderPass mRenderPass;
|
|
OpenGLRenderPipeline mRenderPipeline;
|
|
OpenGLShaderPrograms mShaderPrograms;
|
|
CRITICAL_SECTION& mMutex;
|
|
HDC mHdc;
|
|
HGLRC mHglrc;
|
|
};
|