Splitting out rendering
This commit is contained in:
@@ -61,6 +61,8 @@ set(APP_SOURCES
|
|||||||
"${APP_DIR}/gl/OpenGLCompositeRuntimeControls.cpp"
|
"${APP_DIR}/gl/OpenGLCompositeRuntimeControls.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderPass.cpp"
|
"${APP_DIR}/gl/OpenGLRenderPass.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderPass.h"
|
"${APP_DIR}/gl/OpenGLRenderPass.h"
|
||||||
|
"${APP_DIR}/gl/OpenGLRenderPipeline.cpp"
|
||||||
|
"${APP_DIR}/gl/OpenGLRenderPipeline.h"
|
||||||
"${APP_DIR}/gl/OpenGLRenderer.cpp"
|
"${APP_DIR}/gl/OpenGLRenderer.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderer.h"
|
"${APP_DIR}/gl/OpenGLRenderer.h"
|
||||||
"${APP_DIR}/gl/OpenGLVideoIOBridge.cpp"
|
"${APP_DIR}/gl/OpenGLVideoIOBridge.cpp"
|
||||||
|
|||||||
@@ -179,6 +179,7 @@
|
|||||||
<ClCompile Include="LoopThroughWithOpenGLCompositing.cpp" />
|
<ClCompile Include="LoopThroughWithOpenGLCompositing.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLComposite.cpp" />
|
<ClCompile Include="gl\OpenGLComposite.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLRenderPass.cpp" />
|
<ClCompile Include="gl\OpenGLRenderPass.cpp" />
|
||||||
|
<ClCompile Include="gl\OpenGLRenderPipeline.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLRenderer.cpp" />
|
<ClCompile Include="gl\OpenGLRenderer.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLShaderPrograms.cpp" />
|
<ClCompile Include="gl\OpenGLShaderPrograms.cpp" />
|
||||||
<ClCompile Include="gl\PngScreenshotWriter.cpp" />
|
<ClCompile Include="gl\PngScreenshotWriter.cpp" />
|
||||||
@@ -204,6 +205,7 @@
|
|||||||
<ClInclude Include="LoopThroughWithOpenGLCompositing.h" />
|
<ClInclude Include="LoopThroughWithOpenGLCompositing.h" />
|
||||||
<ClInclude Include="gl\OpenGLComposite.h" />
|
<ClInclude Include="gl\OpenGLComposite.h" />
|
||||||
<ClInclude Include="gl\OpenGLRenderPass.h" />
|
<ClInclude Include="gl\OpenGLRenderPass.h" />
|
||||||
|
<ClInclude Include="gl\OpenGLRenderPipeline.h" />
|
||||||
<ClInclude Include="gl\OpenGLRenderer.h" />
|
<ClInclude Include="gl\OpenGLRenderer.h" />
|
||||||
<ClInclude Include="gl\OpenGLShaderPrograms.h" />
|
<ClInclude Include="gl\OpenGLShaderPrograms.h" />
|
||||||
<ClInclude Include="gl\PngScreenshotWriter.h" />
|
<ClInclude Include="gl\PngScreenshotWriter.h" />
|
||||||
|
|||||||
@@ -30,6 +30,9 @@
|
|||||||
<ClCompile Include="gl\OpenGLRenderPass.cpp">
|
<ClCompile Include="gl\OpenGLRenderPass.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="gl\OpenGLRenderPipeline.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="gl\OpenGLRenderer.cpp">
|
<ClCompile Include="gl\OpenGLRenderer.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -86,6 +89,9 @@
|
|||||||
<ClInclude Include="gl\OpenGLRenderPass.h">
|
<ClInclude Include="gl\OpenGLRenderPass.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="gl\OpenGLRenderPipeline.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="gl\OpenGLRenderer.h">
|
<ClInclude Include="gl\OpenGLRenderer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "GLExtensions.h"
|
#include "GLExtensions.h"
|
||||||
#include "GlRenderConstants.h"
|
#include "GlRenderConstants.h"
|
||||||
#include "OpenGLRenderPass.h"
|
#include "OpenGLRenderPass.h"
|
||||||
|
#include "OpenGLRenderPipeline.h"
|
||||||
#include "OpenGLShaderPrograms.h"
|
#include "OpenGLShaderPrograms.h"
|
||||||
#include "OpenGLVideoIOBridge.h"
|
#include "OpenGLVideoIOBridge.h"
|
||||||
#include "PngScreenshotWriter.h"
|
#include "PngScreenshotWriter.h"
|
||||||
@@ -29,16 +30,20 @@ OpenGLComposite::OpenGLComposite(HWND hWnd, HDC hDC, HGLRC hRC) :
|
|||||||
{
|
{
|
||||||
InitializeCriticalSection(&pMutex);
|
InitializeCriticalSection(&pMutex);
|
||||||
mRuntimeHost = std::make_unique<RuntimeHost>();
|
mRuntimeHost = std::make_unique<RuntimeHost>();
|
||||||
mVideoIOBridge = std::make_unique<OpenGLVideoIOBridge>(
|
mRenderPipeline = std::make_unique<OpenGLRenderPipeline>(
|
||||||
*mVideoIO,
|
|
||||||
*mRenderer,
|
*mRenderer,
|
||||||
*mRuntimeHost,
|
*mRuntimeHost,
|
||||||
pMutex,
|
|
||||||
hGLDC,
|
|
||||||
hGLRC,
|
|
||||||
[this]() { renderEffect(); },
|
[this]() { renderEffect(); },
|
||||||
[this]() { ProcessScreenshotRequest(); },
|
[this]() { ProcessScreenshotRequest(); },
|
||||||
[this]() { paintGL(); });
|
[this]() { paintGL(); });
|
||||||
|
mVideoIOBridge = std::make_unique<OpenGLVideoIOBridge>(
|
||||||
|
*mVideoIO,
|
||||||
|
*mRenderer,
|
||||||
|
*mRenderPipeline,
|
||||||
|
*mRuntimeHost,
|
||||||
|
pMutex,
|
||||||
|
hGLDC,
|
||||||
|
hGLRC);
|
||||||
mRenderPass = std::make_unique<OpenGLRenderPass>(*mRenderer);
|
mRenderPass = std::make_unique<OpenGLRenderPass>(*mRenderer);
|
||||||
mShaderPrograms = std::make_unique<OpenGLShaderPrograms>(*mRenderer, *mRuntimeHost);
|
mShaderPrograms = std::make_unique<OpenGLShaderPrograms>(*mRenderer, *mRuntimeHost);
|
||||||
mShaderBuildQueue = std::make_unique<ShaderBuildQueue>(*mRuntimeHost);
|
mShaderBuildQueue = std::make_unique<ShaderBuildQueue>(*mRuntimeHost);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
class VideoIODevice;
|
class VideoIODevice;
|
||||||
class OpenGLVideoIOBridge;
|
class OpenGLVideoIOBridge;
|
||||||
class OpenGLRenderPass;
|
class OpenGLRenderPass;
|
||||||
|
class OpenGLRenderPipeline;
|
||||||
class OpenGLShaderPrograms;
|
class OpenGLShaderPrograms;
|
||||||
class RuntimeServices;
|
class RuntimeServices;
|
||||||
class ShaderBuildQueue;
|
class ShaderBuildQueue;
|
||||||
@@ -81,6 +82,7 @@ private:
|
|||||||
std::unique_ptr<RuntimeHost> mRuntimeHost;
|
std::unique_ptr<RuntimeHost> mRuntimeHost;
|
||||||
std::unique_ptr<OpenGLVideoIOBridge> mVideoIOBridge;
|
std::unique_ptr<OpenGLVideoIOBridge> mVideoIOBridge;
|
||||||
std::unique_ptr<OpenGLRenderPass> mRenderPass;
|
std::unique_ptr<OpenGLRenderPass> mRenderPass;
|
||||||
|
std::unique_ptr<OpenGLRenderPipeline> mRenderPipeline;
|
||||||
std::unique_ptr<OpenGLShaderPrograms> mShaderPrograms;
|
std::unique_ptr<OpenGLShaderPrograms> mShaderPrograms;
|
||||||
std::unique_ptr<ShaderBuildQueue> mShaderBuildQueue;
|
std::unique_ptr<ShaderBuildQueue> mShaderBuildQueue;
|
||||||
std::unique_ptr<RuntimeServices> mRuntimeServices;
|
std::unique_ptr<RuntimeServices> mRuntimeServices;
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
#include "OpenGLRenderPipeline.h"
|
||||||
|
|
||||||
|
#include "OpenGLRenderer.h"
|
||||||
|
#include "RuntimeHost.h"
|
||||||
|
#include "VideoIOFormat.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <gl/gl.h>
|
||||||
|
|
||||||
|
OpenGLRenderPipeline::OpenGLRenderPipeline(
|
||||||
|
OpenGLRenderer& renderer,
|
||||||
|
RuntimeHost& runtimeHost,
|
||||||
|
RenderEffectCallback renderEffect,
|
||||||
|
OutputReadyCallback outputReady,
|
||||||
|
PaintCallback paint) :
|
||||||
|
mRenderer(renderer),
|
||||||
|
mRuntimeHost(runtimeHost),
|
||||||
|
mRenderEffect(renderEffect),
|
||||||
|
mOutputReady(outputReady),
|
||||||
|
mPaint(paint)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OpenGLRenderPipeline::RenderFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame)
|
||||||
|
{
|
||||||
|
const VideoIOState& state = context.videoState;
|
||||||
|
|
||||||
|
const auto renderStartTime = std::chrono::steady_clock::now();
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.CompositeFramebuffer());
|
||||||
|
mRenderEffect();
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.CompositeFramebuffer());
|
||||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
||||||
|
glBlitFramebuffer(0, 0, state.inputFrameSize.width, state.inputFrameSize.height, 0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
||||||
|
if (mOutputReady)
|
||||||
|
mOutputReady();
|
||||||
|
if (state.outputPixelFormat == VideoIOPixelFormat::V210)
|
||||||
|
PackOutputForV210(state);
|
||||||
|
glFlush();
|
||||||
|
|
||||||
|
const auto renderEndTime = std::chrono::steady_clock::now();
|
||||||
|
const double renderMilliseconds = std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(renderEndTime - renderStartTime).count();
|
||||||
|
mRuntimeHost.TrySetPerformanceStats(state.frameBudgetMilliseconds, renderMilliseconds);
|
||||||
|
mRuntimeHost.TryAdvanceFrame();
|
||||||
|
|
||||||
|
ReadOutputFrame(state, outputFrame);
|
||||||
|
if (mPaint)
|
||||||
|
mPaint();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenGLRenderPipeline::PackOutputForV210(const VideoIOState& state)
|
||||||
|
{
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputPackFramebuffer());
|
||||||
|
glViewport(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height);
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, mRenderer.OutputTexture());
|
||||||
|
glBindVertexArray(mRenderer.FullscreenVertexArray());
|
||||||
|
glUseProgram(mRenderer.OutputPackProgram());
|
||||||
|
|
||||||
|
const GLint outputResolutionLocation = glGetUniformLocation(mRenderer.OutputPackProgram(), "uOutputVideoResolution");
|
||||||
|
const GLint activeWordsLocation = glGetUniformLocation(mRenderer.OutputPackProgram(), "uActiveV210Words");
|
||||||
|
if (outputResolutionLocation >= 0)
|
||||||
|
glUniform2f(outputResolutionLocation, static_cast<float>(state.outputFrameSize.width), static_cast<float>(state.outputFrameSize.height));
|
||||||
|
if (activeWordsLocation >= 0)
|
||||||
|
glUniform1f(activeWordsLocation, static_cast<float>(ActiveV210WordsForWidth(state.outputFrameSize.width)));
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
|
glUseProgram(0);
|
||||||
|
glBindVertexArray(0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenGLRenderPipeline::ReadOutputFrame(const VideoIOState& state, VideoIOOutputFrame& outputFrame)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||||
|
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||||
|
if (state.outputPixelFormat == VideoIOPixelFormat::V210)
|
||||||
|
{
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputPackFramebuffer());
|
||||||
|
glReadPixels(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height, GL_RGBA, GL_UNSIGNED_BYTE, outputFrame.bytes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
||||||
|
glReadPixels(0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, outputFrame.bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "VideoIOTypes.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
class OpenGLRenderer;
|
||||||
|
class RuntimeHost;
|
||||||
|
|
||||||
|
struct RenderPipelineFrameContext
|
||||||
|
{
|
||||||
|
VideoIOState videoState;
|
||||||
|
VideoIOCompletion completion;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpenGLRenderPipeline
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using RenderEffectCallback = std::function<void()>;
|
||||||
|
using OutputReadyCallback = std::function<void()>;
|
||||||
|
using PaintCallback = std::function<void()>;
|
||||||
|
|
||||||
|
OpenGLRenderPipeline(
|
||||||
|
OpenGLRenderer& renderer,
|
||||||
|
RuntimeHost& runtimeHost,
|
||||||
|
RenderEffectCallback renderEffect,
|
||||||
|
OutputReadyCallback outputReady,
|
||||||
|
PaintCallback paint);
|
||||||
|
|
||||||
|
bool RenderFrame(const RenderPipelineFrameContext& context, VideoIOOutputFrame& outputFrame);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void PackOutputForV210(const VideoIOState& state);
|
||||||
|
void ReadOutputFrame(const VideoIOState& state, VideoIOOutputFrame& outputFrame);
|
||||||
|
|
||||||
|
OpenGLRenderer& mRenderer;
|
||||||
|
RuntimeHost& mRuntimeHost;
|
||||||
|
RenderEffectCallback mRenderEffect;
|
||||||
|
OutputReadyCallback mOutputReady;
|
||||||
|
PaintCallback mPaint;
|
||||||
|
};
|
||||||
@@ -9,22 +9,18 @@
|
|||||||
OpenGLVideoIOBridge::OpenGLVideoIOBridge(
|
OpenGLVideoIOBridge::OpenGLVideoIOBridge(
|
||||||
VideoIODevice& videoIO,
|
VideoIODevice& videoIO,
|
||||||
OpenGLRenderer& renderer,
|
OpenGLRenderer& renderer,
|
||||||
|
OpenGLRenderPipeline& renderPipeline,
|
||||||
RuntimeHost& runtimeHost,
|
RuntimeHost& runtimeHost,
|
||||||
CRITICAL_SECTION& mutex,
|
CRITICAL_SECTION& mutex,
|
||||||
HDC hdc,
|
HDC hdc,
|
||||||
HGLRC hglrc,
|
HGLRC hglrc) :
|
||||||
RenderEffectCallback renderEffect,
|
|
||||||
OutputReadyCallback outputReady,
|
|
||||||
PaintCallback paint) :
|
|
||||||
mVideoIO(videoIO),
|
mVideoIO(videoIO),
|
||||||
mRenderer(renderer),
|
mRenderer(renderer),
|
||||||
|
mRenderPipeline(renderPipeline),
|
||||||
mRuntimeHost(runtimeHost),
|
mRuntimeHost(runtimeHost),
|
||||||
mMutex(mutex),
|
mMutex(mutex),
|
||||||
mHdc(hdc),
|
mHdc(hdc),
|
||||||
mHglrc(hglrc),
|
mHglrc(hglrc)
|
||||||
mRenderEffect(renderEffect),
|
|
||||||
mOutputReady(outputReady),
|
|
||||||
mPaint(paint)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,58 +109,7 @@ void OpenGLVideoIOBridge::PlayoutFrameCompleted(const VideoIOCompletion& complet
|
|||||||
// make GL context current in this thread
|
// make GL context current in this thread
|
||||||
wglMakeCurrent(mHdc, mHglrc);
|
wglMakeCurrent(mHdc, mHglrc);
|
||||||
|
|
||||||
// Draw the effect output to the off-screen framebuffer.
|
mRenderPipeline.RenderFrame(frameContext, outputFrame);
|
||||||
const auto renderStartTime = std::chrono::steady_clock::now();
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.CompositeFramebuffer());
|
|
||||||
mRenderEffect();
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.CompositeFramebuffer());
|
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
|
||||||
glBlitFramebuffer(0, 0, state.inputFrameSize.width, state.inputFrameSize.height, 0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
|
||||||
if (mOutputReady)
|
|
||||||
mOutputReady();
|
|
||||||
if (state.outputPixelFormat == VideoIOPixelFormat::V210)
|
|
||||||
{
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mRenderer.OutputPackFramebuffer());
|
|
||||||
glViewport(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height);
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, mRenderer.OutputTexture());
|
|
||||||
glBindVertexArray(mRenderer.FullscreenVertexArray());
|
|
||||||
glUseProgram(mRenderer.OutputPackProgram());
|
|
||||||
const GLint outputResolutionLocation = glGetUniformLocation(mRenderer.OutputPackProgram(), "uOutputVideoResolution");
|
|
||||||
const GLint activeWordsLocation = glGetUniformLocation(mRenderer.OutputPackProgram(), "uActiveV210Words");
|
|
||||||
if (outputResolutionLocation >= 0)
|
|
||||||
glUniform2f(outputResolutionLocation, static_cast<float>(state.outputFrameSize.width), static_cast<float>(state.outputFrameSize.height));
|
|
||||||
if (activeWordsLocation >= 0)
|
|
||||||
glUniform1f(activeWordsLocation, static_cast<float>(ActiveV210WordsForWidth(state.outputFrameSize.width)));
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
glUseProgram(0);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
glFlush();
|
|
||||||
const auto renderEndTime = std::chrono::steady_clock::now();
|
|
||||||
const double frameBudgetMilliseconds = state.frameBudgetMilliseconds;
|
|
||||||
const double renderMilliseconds = std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(renderEndTime - renderStartTime).count();
|
|
||||||
mRuntimeHost.TrySetPerformanceStats(frameBudgetMilliseconds, renderMilliseconds);
|
|
||||||
mRuntimeHost.TryAdvanceFrame();
|
|
||||||
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
|
||||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
|
||||||
if (state.outputPixelFormat == VideoIOPixelFormat::V210)
|
|
||||||
{
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputPackFramebuffer());
|
|
||||||
glReadPixels(0, 0, state.outputPackTextureWidth, state.outputFrameSize.height, GL_RGBA, GL_UNSIGNED_BYTE, outputFrame.bytes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, mRenderer.OutputFramebuffer());
|
|
||||||
glReadPixels(0, 0, state.outputFrameSize.width, state.outputFrameSize.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, outputFrame.bytes);
|
|
||||||
}
|
|
||||||
mPaint();
|
|
||||||
|
|
||||||
mVideoIO.EndOutputFrame(outputFrame);
|
mVideoIO.EndOutputFrame(outputFrame);
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "VideoIOTypes.h"
|
#include "OpenGLRenderPipeline.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class OpenGLRenderer;
|
|
||||||
class RuntimeHost;
|
class RuntimeHost;
|
||||||
|
|
||||||
struct RenderPipelineFrameContext
|
|
||||||
{
|
|
||||||
VideoIOState videoState;
|
|
||||||
VideoIOCompletion completion;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OpenGLVideoIOBridge
|
class OpenGLVideoIOBridge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using RenderEffectCallback = std::function<void()>;
|
|
||||||
using OutputReadyCallback = std::function<void()>;
|
|
||||||
using PaintCallback = std::function<void()>;
|
|
||||||
|
|
||||||
OpenGLVideoIOBridge(
|
OpenGLVideoIOBridge(
|
||||||
VideoIODevice& videoIO,
|
VideoIODevice& videoIO,
|
||||||
OpenGLRenderer& renderer,
|
OpenGLRenderer& renderer,
|
||||||
|
OpenGLRenderPipeline& renderPipeline,
|
||||||
RuntimeHost& runtimeHost,
|
RuntimeHost& runtimeHost,
|
||||||
CRITICAL_SECTION& mutex,
|
CRITICAL_SECTION& mutex,
|
||||||
HDC hdc,
|
HDC hdc,
|
||||||
HGLRC hglrc,
|
HGLRC hglrc);
|
||||||
RenderEffectCallback renderEffect,
|
|
||||||
OutputReadyCallback outputReady,
|
|
||||||
PaintCallback paint);
|
|
||||||
|
|
||||||
void VideoFrameArrived(const VideoIOFrame& inputFrame);
|
void VideoFrameArrived(const VideoIOFrame& inputFrame);
|
||||||
void PlayoutFrameCompleted(const VideoIOCompletion& completion);
|
void PlayoutFrameCompleted(const VideoIOCompletion& completion);
|
||||||
@@ -43,13 +29,11 @@ private:
|
|||||||
|
|
||||||
VideoIODevice& mVideoIO;
|
VideoIODevice& mVideoIO;
|
||||||
OpenGLRenderer& mRenderer;
|
OpenGLRenderer& mRenderer;
|
||||||
|
OpenGLRenderPipeline& mRenderPipeline;
|
||||||
RuntimeHost& mRuntimeHost;
|
RuntimeHost& mRuntimeHost;
|
||||||
CRITICAL_SECTION& mMutex;
|
CRITICAL_SECTION& mMutex;
|
||||||
HDC mHdc;
|
HDC mHdc;
|
||||||
HGLRC mHglrc;
|
HGLRC mHglrc;
|
||||||
RenderEffectCallback mRenderEffect;
|
|
||||||
OutputReadyCallback mOutputReady;
|
|
||||||
PaintCallback mPaint;
|
|
||||||
std::chrono::steady_clock::time_point mLastPlayoutCompletionTime;
|
std::chrono::steady_clock::time_point mLastPlayoutCompletionTime;
|
||||||
double mCompletionIntervalMilliseconds = 0.0;
|
double mCompletionIntervalMilliseconds = 0.0;
|
||||||
double mSmoothedCompletionIntervalMilliseconds = 0.0;
|
double mSmoothedCompletionIntervalMilliseconds = 0.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user