Compare commits
2 Commits
ebbc11bb34
...
4e2ac4a091
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e2ac4a091 | |||
| 3eb5bb5de3 |
@@ -31,7 +31,7 @@ if(NOT EXISTS "${SLANG_LICENSE_FILE}")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(APP_SOURCES
|
set(APP_SOURCES
|
||||||
"${APP_DIR}/DeckLinkAPI_i.c"
|
"${APP_DIR}/videoio/decklink/DeckLinkAPI_i.c"
|
||||||
"${APP_DIR}/control/ControlServer.cpp"
|
"${APP_DIR}/control/ControlServer.cpp"
|
||||||
"${APP_DIR}/control/ControlServer.h"
|
"${APP_DIR}/control/ControlServer.h"
|
||||||
"${APP_DIR}/control/OscServer.cpp"
|
"${APP_DIR}/control/OscServer.cpp"
|
||||||
@@ -40,48 +40,51 @@ set(APP_SOURCES
|
|||||||
"${APP_DIR}/control/RuntimeControlBridge.h"
|
"${APP_DIR}/control/RuntimeControlBridge.h"
|
||||||
"${APP_DIR}/control/RuntimeServices.cpp"
|
"${APP_DIR}/control/RuntimeServices.cpp"
|
||||||
"${APP_DIR}/control/RuntimeServices.h"
|
"${APP_DIR}/control/RuntimeServices.h"
|
||||||
"${APP_DIR}/decklink/DeckLinkDisplayMode.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkAPI_h.h"
|
||||||
"${APP_DIR}/decklink/DeckLinkDisplayMode.h"
|
"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.cpp"
|
||||||
"${APP_DIR}/decklink/DeckLinkFrameTransfer.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkDisplayMode.h"
|
||||||
"${APP_DIR}/decklink/DeckLinkFrameTransfer.h"
|
"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.cpp"
|
||||||
"${APP_DIR}/decklink/DeckLinkSession.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkFrameTransfer.h"
|
||||||
"${APP_DIR}/decklink/DeckLinkSession.h"
|
"${APP_DIR}/videoio/decklink/DeckLinkSession.cpp"
|
||||||
"${APP_DIR}/decklink/DeckLinkVideoIOFormat.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkSession.h"
|
||||||
"${APP_DIR}/decklink/DeckLinkVideoIOFormat.h"
|
"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
|
||||||
"${APP_DIR}/gl/GLExtensions.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.h"
|
||||||
"${APP_DIR}/gl/GLExtensions.h"
|
"${APP_DIR}/gl/renderer/GLExtensions.cpp"
|
||||||
"${APP_DIR}/gl/GlobalParamsBuffer.cpp"
|
"${APP_DIR}/gl/renderer/GLExtensions.h"
|
||||||
"${APP_DIR}/gl/GlobalParamsBuffer.h"
|
"${APP_DIR}/gl/shader/GlobalParamsBuffer.cpp"
|
||||||
"${APP_DIR}/gl/GlRenderConstants.h"
|
"${APP_DIR}/gl/shader/GlobalParamsBuffer.h"
|
||||||
"${APP_DIR}/gl/GlScopedObjects.h"
|
"${APP_DIR}/gl/renderer/GlRenderConstants.h"
|
||||||
"${APP_DIR}/gl/GlShaderSources.cpp"
|
"${APP_DIR}/gl/renderer/GlScopedObjects.h"
|
||||||
"${APP_DIR}/gl/GlShaderSources.h"
|
"${APP_DIR}/gl/shader/GlShaderSources.cpp"
|
||||||
|
"${APP_DIR}/gl/shader/GlShaderSources.h"
|
||||||
"${APP_DIR}/gl/OpenGLComposite.cpp"
|
"${APP_DIR}/gl/OpenGLComposite.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLComposite.h"
|
"${APP_DIR}/gl/OpenGLComposite.h"
|
||||||
"${APP_DIR}/gl/OpenGLCompositeRuntimeControls.cpp"
|
"${APP_DIR}/gl/OpenGLCompositeRuntimeControls.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderPass.cpp"
|
"${APP_DIR}/gl/pipeline/OpenGLRenderPass.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderPass.h"
|
"${APP_DIR}/gl/pipeline/OpenGLRenderPass.h"
|
||||||
"${APP_DIR}/gl/OpenGLRenderer.cpp"
|
"${APP_DIR}/gl/pipeline/OpenGLRenderPipeline.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLRenderer.h"
|
"${APP_DIR}/gl/pipeline/OpenGLRenderPipeline.h"
|
||||||
"${APP_DIR}/gl/OpenGLVideoIOBridge.cpp"
|
"${APP_DIR}/gl/renderer/OpenGLRenderer.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLVideoIOBridge.h"
|
"${APP_DIR}/gl/renderer/OpenGLRenderer.h"
|
||||||
"${APP_DIR}/gl/OpenGLShaderPrograms.cpp"
|
"${APP_DIR}/gl/pipeline/OpenGLVideoIOBridge.cpp"
|
||||||
"${APP_DIR}/gl/OpenGLShaderPrograms.h"
|
"${APP_DIR}/gl/pipeline/OpenGLVideoIOBridge.h"
|
||||||
"${APP_DIR}/gl/PngScreenshotWriter.cpp"
|
"${APP_DIR}/gl/shader/OpenGLShaderPrograms.cpp"
|
||||||
"${APP_DIR}/gl/PngScreenshotWriter.h"
|
"${APP_DIR}/gl/shader/OpenGLShaderPrograms.h"
|
||||||
"${APP_DIR}/gl/ShaderProgramCompiler.cpp"
|
"${APP_DIR}/gl/pipeline/PngScreenshotWriter.cpp"
|
||||||
"${APP_DIR}/gl/ShaderProgramCompiler.h"
|
"${APP_DIR}/gl/pipeline/PngScreenshotWriter.h"
|
||||||
"${APP_DIR}/gl/ShaderBuildQueue.cpp"
|
"${APP_DIR}/gl/shader/ShaderProgramCompiler.cpp"
|
||||||
"${APP_DIR}/gl/ShaderBuildQueue.h"
|
"${APP_DIR}/gl/shader/ShaderProgramCompiler.h"
|
||||||
"${APP_DIR}/gl/ShaderTextureBindings.cpp"
|
"${APP_DIR}/gl/shader/ShaderBuildQueue.cpp"
|
||||||
"${APP_DIR}/gl/ShaderTextureBindings.h"
|
"${APP_DIR}/gl/shader/ShaderBuildQueue.h"
|
||||||
"${APP_DIR}/gl/Std140Buffer.h"
|
"${APP_DIR}/gl/shader/ShaderTextureBindings.cpp"
|
||||||
"${APP_DIR}/gl/TextRasterizer.cpp"
|
"${APP_DIR}/gl/shader/ShaderTextureBindings.h"
|
||||||
"${APP_DIR}/gl/TextRasterizer.h"
|
"${APP_DIR}/gl/shader/Std140Buffer.h"
|
||||||
"${APP_DIR}/gl/TextureAssetLoader.cpp"
|
"${APP_DIR}/gl/shader/TextRasterizer.cpp"
|
||||||
"${APP_DIR}/gl/TextureAssetLoader.h"
|
"${APP_DIR}/gl/shader/TextRasterizer.h"
|
||||||
"${APP_DIR}/gl/TemporalHistoryBuffers.cpp"
|
"${APP_DIR}/gl/shader/TextureAssetLoader.cpp"
|
||||||
"${APP_DIR}/gl/TemporalHistoryBuffers.h"
|
"${APP_DIR}/gl/shader/TextureAssetLoader.h"
|
||||||
|
"${APP_DIR}/gl/pipeline/TemporalHistoryBuffers.cpp"
|
||||||
|
"${APP_DIR}/gl/pipeline/TemporalHistoryBuffers.h"
|
||||||
"${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp"
|
"${APP_DIR}/LoopThroughWithOpenGLCompositing.cpp"
|
||||||
"${APP_DIR}/LoopThroughWithOpenGLCompositing.h"
|
"${APP_DIR}/LoopThroughWithOpenGLCompositing.h"
|
||||||
"${APP_DIR}/LoopThroughWithOpenGLCompositing.rc"
|
"${APP_DIR}/LoopThroughWithOpenGLCompositing.rc"
|
||||||
@@ -116,12 +119,15 @@ add_executable(LoopThroughWithOpenGLCompositing WIN32 ${APP_SOURCES})
|
|||||||
target_include_directories(LoopThroughWithOpenGLCompositing PRIVATE
|
target_include_directories(LoopThroughWithOpenGLCompositing PRIVATE
|
||||||
"${APP_DIR}"
|
"${APP_DIR}"
|
||||||
"${APP_DIR}/control"
|
"${APP_DIR}/control"
|
||||||
"${APP_DIR}/decklink"
|
|
||||||
"${APP_DIR}/gl"
|
"${APP_DIR}/gl"
|
||||||
|
"${APP_DIR}/gl/pipeline"
|
||||||
|
"${APP_DIR}/gl/renderer"
|
||||||
|
"${APP_DIR}/gl/shader"
|
||||||
"${APP_DIR}/platform"
|
"${APP_DIR}/platform"
|
||||||
"${APP_DIR}/runtime"
|
"${APP_DIR}/runtime"
|
||||||
"${APP_DIR}/shader"
|
"${APP_DIR}/shader"
|
||||||
"${APP_DIR}/videoio"
|
"${APP_DIR}/videoio"
|
||||||
|
"${APP_DIR}/videoio/decklink"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(LoopThroughWithOpenGLCompositing PRIVATE
|
target_link_libraries(LoopThroughWithOpenGLCompositing PRIVATE
|
||||||
@@ -202,6 +208,7 @@ add_executable(Std140BufferTests
|
|||||||
target_include_directories(Std140BufferTests PRIVATE
|
target_include_directories(Std140BufferTests PRIVATE
|
||||||
"${APP_DIR}"
|
"${APP_DIR}"
|
||||||
"${APP_DIR}/gl"
|
"${APP_DIR}/gl"
|
||||||
|
"${APP_DIR}/gl/shader"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -250,15 +257,15 @@ endif()
|
|||||||
add_test(NAME OscServerTests COMMAND OscServerTests)
|
add_test(NAME OscServerTests COMMAND OscServerTests)
|
||||||
|
|
||||||
add_executable(VideoIOFormatTests
|
add_executable(VideoIOFormatTests
|
||||||
"${APP_DIR}/decklink/DeckLinkVideoIOFormat.cpp"
|
"${APP_DIR}/videoio/decklink/DeckLinkVideoIOFormat.cpp"
|
||||||
"${APP_DIR}/videoio/VideoIOFormat.cpp"
|
"${APP_DIR}/videoio/VideoIOFormat.cpp"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoIOFormatTests.cpp"
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/VideoIOFormatTests.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(VideoIOFormatTests PRIVATE
|
target_include_directories(VideoIOFormatTests PRIVATE
|
||||||
"${APP_DIR}"
|
"${APP_DIR}"
|
||||||
"${APP_DIR}/decklink"
|
|
||||||
"${APP_DIR}/videoio"
|
"${APP_DIR}/videoio"
|
||||||
|
"${APP_DIR}/videoio/decklink"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -274,8 +281,8 @@ add_executable(VideoPlayoutSchedulerTests
|
|||||||
|
|
||||||
target_include_directories(VideoPlayoutSchedulerTests PRIVATE
|
target_include_directories(VideoPlayoutSchedulerTests PRIVATE
|
||||||
"${APP_DIR}"
|
"${APP_DIR}"
|
||||||
"${APP_DIR}/decklink"
|
|
||||||
"${APP_DIR}/videoio"
|
"${APP_DIR}/videoio"
|
||||||
|
"${APP_DIR}/videoio/decklink"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -291,8 +298,8 @@ add_executable(VideoIODeviceFakeTests
|
|||||||
|
|
||||||
target_include_directories(VideoIODeviceFakeTests PRIVATE
|
target_include_directories(VideoIODeviceFakeTests PRIVATE
|
||||||
"${APP_DIR}"
|
"${APP_DIR}"
|
||||||
"${APP_DIR}/decklink"
|
|
||||||
"${APP_DIR}/videoio"
|
"${APP_DIR}/videoio"
|
||||||
|
"${APP_DIR}/videoio/decklink"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -15,6 +15,14 @@ The app loads shader packages from `shaders/`, compiles Slang to GLSL at runtime
|
|||||||
- `tests/`: focused native tests for pure runtime logic.
|
- `tests/`: focused native tests for pure runtime logic.
|
||||||
- `.gitea/workflows/ci.yml`: Gitea Actions CI for Windows native tests and Ubuntu UI build.
|
- `.gitea/workflows/ci.yml`: Gitea Actions CI for Windows native tests and Ubuntu UI build.
|
||||||
|
|
||||||
|
Native app internals are grouped by boundary:
|
||||||
|
|
||||||
|
- `videoio/`: backend-neutral video I/O contracts, formats, and playout timing.
|
||||||
|
- `videoio/decklink/`: DeckLink-specific device adapter, callbacks, and SDK bindings.
|
||||||
|
- `gl/renderer/`: low-level OpenGL resources and extension helpers.
|
||||||
|
- `gl/pipeline/`: frame pipeline, render passes, video I/O bridge, preview/readback, and screenshots.
|
||||||
|
- `gl/shader/`: shader compilation, texture/text assets, UBO packing, and shader program ownership.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Windows with Visual Studio 2022 C++ tooling.
|
- Windows with Visual Studio 2022 C++ tooling.
|
||||||
@@ -238,7 +246,7 @@ If `SLANG_ROOT` is not set, the workflow falls back to the repo-local default un
|
|||||||
- Genlock.
|
- Genlock.
|
||||||
- Find a better UI library for react.
|
- Find a better UI library for react.
|
||||||
- Logs.
|
- Logs.
|
||||||
- Continue source cleanup/refactoring. Pass 2 done
|
- Continue source cleanup/refactoring. Pass 3 done
|
||||||
- Support a separate sound shader `.slang` file in shader packages. (https://www.shadertoy.com/view/XsBXWt)
|
- Support a separate sound shader `.slang` file in shader packages. (https://www.shadertoy.com/view/XsBXWt)
|
||||||
- Add WebView2
|
- Add WebView2
|
||||||
- move to MSDF, typography rasterisation
|
- move to MSDF, typography rasterisation
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>.;control;decklink;gl;videoio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;control;gl;gl\pipeline;gl\renderer;gl\shader;videoio;videoio\decklink;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
</Midl>
|
</Midl>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>.;control;decklink;gl;videoio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;control;gl;gl\pipeline;gl\renderer;gl\shader;videoio;videoio\decklink;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>.;control;decklink;gl;videoio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;control;gl;gl\pipeline;gl\renderer;gl\shader;videoio;videoio\decklink;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>.;control;decklink;gl;videoio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>.;control;gl;gl\pipeline;gl\renderer;gl\shader;videoio;videoio\decklink;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@@ -175,47 +175,49 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="gl\GLExtensions.cpp" />
|
<ClCompile Include="gl\renderer\GLExtensions.cpp" />
|
||||||
<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\pipeline\OpenGLRenderPass.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLRenderer.cpp" />
|
<ClCompile Include="gl\pipeline\OpenGLRenderPipeline.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLShaderPrograms.cpp" />
|
<ClCompile Include="gl\renderer\OpenGLRenderer.cpp" />
|
||||||
<ClCompile Include="gl\PngScreenshotWriter.cpp" />
|
<ClCompile Include="gl\shader\OpenGLShaderPrograms.cpp" />
|
||||||
<ClCompile Include="gl\ShaderBuildQueue.cpp" />
|
<ClCompile Include="gl\pipeline\PngScreenshotWriter.cpp" />
|
||||||
<ClCompile Include="gl\TemporalHistoryBuffers.cpp" />
|
<ClCompile Include="gl\shader\ShaderBuildQueue.cpp" />
|
||||||
<ClCompile Include="gl\OpenGLVideoIOBridge.cpp" />
|
<ClCompile Include="gl\pipeline\TemporalHistoryBuffers.cpp" />
|
||||||
|
<ClCompile Include="gl\pipeline\OpenGLVideoIOBridge.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="DeckLinkAPI_i.c" />
|
<ClCompile Include="videoio\decklink\DeckLinkAPI_i.c" />
|
||||||
<ClCompile Include="control\RuntimeServices.cpp" />
|
<ClCompile Include="control\RuntimeServices.cpp" />
|
||||||
<ClCompile Include="decklink\DeckLinkSession.cpp" />
|
<ClCompile Include="videoio\decklink\DeckLinkSession.cpp" />
|
||||||
<ClCompile Include="decklink\DeckLinkVideoIOFormat.cpp" />
|
<ClCompile Include="videoio\decklink\DeckLinkVideoIOFormat.cpp" />
|
||||||
<ClCompile Include="runtime\RuntimeClock.cpp" />
|
<ClCompile Include="runtime\RuntimeClock.cpp" />
|
||||||
<ClCompile Include="videoio\VideoIOFormat.cpp" />
|
<ClCompile Include="videoio\VideoIOFormat.cpp" />
|
||||||
<ClCompile Include="videoio\VideoPlayoutScheduler.cpp" />
|
<ClCompile Include="videoio\VideoPlayoutScheduler.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="gl\GLExtensions.h" />
|
<ClInclude Include="gl\renderer\GLExtensions.h" />
|
||||||
<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\pipeline\OpenGLRenderPass.h" />
|
||||||
<ClInclude Include="gl\OpenGLRenderer.h" />
|
<ClInclude Include="gl\pipeline\OpenGLRenderPipeline.h" />
|
||||||
<ClInclude Include="gl\OpenGLShaderPrograms.h" />
|
<ClInclude Include="gl\renderer\OpenGLRenderer.h" />
|
||||||
<ClInclude Include="gl\PngScreenshotWriter.h" />
|
<ClInclude Include="gl\shader\OpenGLShaderPrograms.h" />
|
||||||
<ClInclude Include="gl\ShaderBuildQueue.h" />
|
<ClInclude Include="gl\pipeline\PngScreenshotWriter.h" />
|
||||||
<ClInclude Include="gl\TemporalHistoryBuffers.h" />
|
<ClInclude Include="gl\shader\ShaderBuildQueue.h" />
|
||||||
<ClInclude Include="gl\OpenGLVideoIOBridge.h" />
|
<ClInclude Include="gl\pipeline\TemporalHistoryBuffers.h" />
|
||||||
|
<ClInclude Include="gl\pipeline\OpenGLVideoIOBridge.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="targetver.h" />
|
<ClInclude Include="targetver.h" />
|
||||||
<ClInclude Include="control\RuntimeServices.h" />
|
<ClInclude Include="control\RuntimeServices.h" />
|
||||||
<ClInclude Include="decklink\DeckLinkSession.h" />
|
<ClInclude Include="videoio\decklink\DeckLinkSession.h" />
|
||||||
<ClInclude Include="decklink\DeckLinkVideoIOFormat.h" />
|
<ClInclude Include="videoio\decklink\DeckLinkVideoIOFormat.h" />
|
||||||
<ClInclude Include="runtime\RuntimeClock.h" />
|
<ClInclude Include="runtime\RuntimeClock.h" />
|
||||||
<ClInclude Include="videoio\VideoIOFormat.h" />
|
<ClInclude Include="videoio\VideoIOFormat.h" />
|
||||||
<ClInclude Include="videoio\VideoIOTypes.h" />
|
<ClInclude Include="videoio\VideoIOTypes.h" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="gl\GLExtensions.cpp">
|
<ClCompile Include="gl\renderer\GLExtensions.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="LoopThroughWithOpenGLCompositing.cpp">
|
<ClCompile Include="LoopThroughWithOpenGLCompositing.cpp">
|
||||||
@@ -27,40 +27,43 @@
|
|||||||
<ClCompile Include="gl\OpenGLComposite.cpp">
|
<ClCompile Include="gl\OpenGLComposite.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\OpenGLRenderPass.cpp">
|
<ClCompile Include="gl\pipeline\OpenGLRenderPass.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\OpenGLRenderer.cpp">
|
<ClCompile Include="gl\pipeline\OpenGLRenderPipeline.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\OpenGLShaderPrograms.cpp">
|
<ClCompile Include="gl\renderer\OpenGLRenderer.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\PngScreenshotWriter.cpp">
|
<ClCompile Include="gl\shader\OpenGLShaderPrograms.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\ShaderBuildQueue.cpp">
|
<ClCompile Include="gl\pipeline\PngScreenshotWriter.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\TemporalHistoryBuffers.cpp">
|
<ClCompile Include="gl\shader\ShaderBuildQueue.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gl\OpenGLVideoIOBridge.cpp">
|
<ClCompile Include="gl\pipeline\TemporalHistoryBuffers.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="gl\pipeline\OpenGLVideoIOBridge.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="DeckLinkAPI_i.c">
|
<ClCompile Include="videoio\decklink\DeckLinkAPI_i.c">
|
||||||
<Filter>DeckLink API</Filter>
|
<Filter>DeckLink API</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="control\RuntimeServices.cpp">
|
<ClCompile Include="control\RuntimeServices.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="decklink\DeckLinkSession.cpp">
|
<ClCompile Include="videoio\decklink\DeckLinkSession.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="decklink\DeckLinkVideoIOFormat.cpp">
|
<ClCompile Include="videoio\decklink\DeckLinkVideoIOFormat.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="runtime\RuntimeClock.cpp">
|
<ClCompile Include="runtime\RuntimeClock.cpp">
|
||||||
@@ -74,7 +77,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="gl\GLExtensions.h">
|
<ClInclude Include="gl\renderer\GLExtensions.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="LoopThroughWithOpenGLCompositing.h">
|
<ClInclude Include="LoopThroughWithOpenGLCompositing.h">
|
||||||
@@ -83,25 +86,28 @@
|
|||||||
<ClInclude Include="gl\OpenGLComposite.h">
|
<ClInclude Include="gl\OpenGLComposite.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\OpenGLRenderPass.h">
|
<ClInclude Include="gl\pipeline\OpenGLRenderPass.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\OpenGLRenderer.h">
|
<ClInclude Include="gl\pipeline\OpenGLRenderPipeline.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\OpenGLShaderPrograms.h">
|
<ClInclude Include="gl\renderer\OpenGLRenderer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\PngScreenshotWriter.h">
|
<ClInclude Include="gl\shader\OpenGLShaderPrograms.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\ShaderBuildQueue.h">
|
<ClInclude Include="gl\pipeline\PngScreenshotWriter.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\TemporalHistoryBuffers.h">
|
<ClInclude Include="gl\shader\ShaderBuildQueue.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gl\OpenGLVideoIOBridge.h">
|
<ClInclude Include="gl\pipeline\TemporalHistoryBuffers.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="gl\pipeline\OpenGLVideoIOBridge.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="resource.h">
|
||||||
@@ -116,10 +122,10 @@
|
|||||||
<ClInclude Include="control\RuntimeServices.h">
|
<ClInclude Include="control\RuntimeServices.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="decklink\DeckLinkSession.h">
|
<ClInclude Include="videoio\decklink\DeckLinkSession.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="decklink\DeckLinkVideoIOFormat.h">
|
<ClInclude Include="videoio\decklink\DeckLinkVideoIOFormat.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="runtime\RuntimeClock.h">
|
<ClInclude Include="runtime\RuntimeClock.h">
|
||||||
|
|||||||
@@ -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