further phase 1
This commit is contained in:
@@ -28,7 +28,6 @@ namespace
|
||||
|
||||
OpenGLComposite::OpenGLComposite(HWND hWnd, HDC hDC, HGLRC hRC) :
|
||||
hGLWnd(hWnd), hGLDC(hDC), hGLRC(hRC),
|
||||
mUseCommittedLayerStates(false),
|
||||
mScreenshotRequested(false)
|
||||
{
|
||||
InitializeCriticalSection(&pMutex);
|
||||
@@ -121,9 +120,11 @@ bool OpenGLComposite::InitVideoIO()
|
||||
goto error;
|
||||
}
|
||||
|
||||
PublishVideoIOStatus(mVideoBackend->OutputModelName().empty()
|
||||
? "DeckLink output device selected."
|
||||
: ("Selected output device: " + mVideoBackend->OutputModelName()));
|
||||
mVideoBackend->PublishStatus(
|
||||
mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(),
|
||||
mVideoBackend->OutputModelName().empty()
|
||||
? "DeckLink output device selected."
|
||||
: ("Selected output device: " + mVideoBackend->OutputModelName()));
|
||||
|
||||
// Resize window to match output video frame, but scale large formats down by half for viewing.
|
||||
if (mVideoBackend->OutputFrameWidth() < 1920)
|
||||
@@ -135,21 +136,17 @@ bool OpenGLComposite::InitVideoIO()
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
if (!mVideoBackend->HasInputDevice() && mRuntimeHost)
|
||||
{
|
||||
mRuntimeHost->GetHealthTelemetry().ReportSignalStatus(
|
||||
false,
|
||||
mVideoBackend->InputFrameWidth(),
|
||||
mVideoBackend->InputFrameHeight(),
|
||||
mVideoBackend->InputDisplayModeName());
|
||||
}
|
||||
if (!mVideoBackend->HasInputDevice())
|
||||
mVideoBackend->ReportNoInputDeviceSignalStatus();
|
||||
|
||||
if (!mVideoBackend->ConfigureOutput(videoModes.output, mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(), initFailureReason))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
PublishVideoIOStatus(mVideoBackend->StatusMessage());
|
||||
mVideoBackend->PublishStatus(
|
||||
mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(),
|
||||
mVideoBackend->StatusMessage());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -194,25 +191,6 @@ void OpenGLComposite::resizeWindow(int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLComposite::PublishVideoIOStatus(const std::string& statusMessage)
|
||||
{
|
||||
if (!mRuntimeHost)
|
||||
return;
|
||||
|
||||
if (!statusMessage.empty())
|
||||
mVideoBackend->SetStatusMessage(statusMessage);
|
||||
|
||||
mRuntimeHost->GetHealthTelemetry().ReportVideoIOStatus(
|
||||
"decklink",
|
||||
mVideoBackend->OutputModelName(),
|
||||
mVideoBackend->SupportsInternalKeying(),
|
||||
mVideoBackend->SupportsExternalKeying(),
|
||||
mVideoBackend->KeyerInterfaceAvailable(),
|
||||
mRuntimeStore ? mRuntimeStore->IsExternalKeyingConfigured() : false,
|
||||
mVideoBackend->ExternalKeyingActive(),
|
||||
mVideoBackend->StatusMessage());
|
||||
}
|
||||
|
||||
bool OpenGLComposite::InitOpenGLState()
|
||||
{
|
||||
if (! ResolveGLExtensions())
|
||||
@@ -264,13 +242,12 @@ bool OpenGLComposite::InitOpenGLState()
|
||||
return false;
|
||||
}
|
||||
mRuntimeStore->SetCompileStatus(true, "Shader layers compiled successfully.");
|
||||
mUseCommittedLayerStates = false;
|
||||
|
||||
mRenderEngine->ResetTemporalHistoryState();
|
||||
mRenderEngine->ResetShaderFeedbackState();
|
||||
|
||||
broadcastRuntimeState();
|
||||
mRuntimeServices->BeginPolling(*mRuntimeHost, *mRuntimeStore);
|
||||
mRuntimeServices->BeginPolling(*mRuntimeStore);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -287,7 +264,9 @@ bool OpenGLComposite::Stop()
|
||||
const bool wasExternalKeyingActive = mVideoBackend->ExternalKeyingActive();
|
||||
mVideoBackend->Stop();
|
||||
if (wasExternalKeyingActive)
|
||||
PublishVideoIOStatus("External keying has been disabled.");
|
||||
mVideoBackend->PublishStatus(
|
||||
mRuntimeStore && mRuntimeStore->IsExternalKeyingConfigured(),
|
||||
"External keying has been disabled.");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -340,7 +319,7 @@ void OpenGLComposite::renderEffect()
|
||||
std::vector<RenderEngine::OscOverlayCommitRequest> overlayCommitRequests;
|
||||
const double smoothing = mRuntimeStore ? mRuntimeStore->GetConfiguredOscSmoothing() : 0.0;
|
||||
mRenderEngine->ResolveRenderLayerStates(
|
||||
mUseCommittedLayerStates.load(),
|
||||
mRuntimeCoordinator && mRuntimeCoordinator->UseCommittedLayerStates(),
|
||||
mVideoBackend->InputFrameWidth(),
|
||||
mVideoBackend->InputFrameHeight(),
|
||||
smoothing,
|
||||
@@ -439,20 +418,20 @@ bool OpenGLComposite::ProcessRuntimePollResults()
|
||||
|
||||
if (!events.reloadRequested)
|
||||
{
|
||||
PreparedShaderBuild readyBuild;
|
||||
if (!mShaderBuildQueue || !mShaderBuildQueue->TryConsumeReadyBuild(readyBuild))
|
||||
if (!mShaderBuildQueue || !mRenderEngine)
|
||||
return true;
|
||||
|
||||
char compilerErrorMessage[1024] = {};
|
||||
if (!mRenderEngine->ApplyPreparedShaderBuild(
|
||||
readyBuild,
|
||||
const RenderEngine::PreparedShaderBuildApplyResult buildResult = mRenderEngine->TryApplyReadyShaderBuild(
|
||||
*mShaderBuildQueue,
|
||||
mVideoBackend->InputFrameWidth(),
|
||||
mVideoBackend->InputFrameHeight(),
|
||||
mRuntimeCoordinator && mRuntimeCoordinator->PreserveFeedbackOnNextShaderBuild(),
|
||||
sizeof(compilerErrorMessage),
|
||||
compilerErrorMessage))
|
||||
mRuntimeCoordinator && mRuntimeCoordinator->PreserveFeedbackOnNextShaderBuild());
|
||||
if (!buildResult.hadReadyBuild)
|
||||
return true;
|
||||
|
||||
if (!buildResult.applied)
|
||||
{
|
||||
ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->HandlePreparedShaderBuildFailure(compilerErrorMessage));
|
||||
ApplyRuntimeCoordinatorResult(mRuntimeCoordinator->HandlePreparedShaderBuildFailure(buildResult.errorMessage));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -487,18 +466,8 @@ bool OpenGLComposite::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResu
|
||||
if (result.clearReloadRequest && mRuntimeStore)
|
||||
mRuntimeStore->ClearReloadRequest();
|
||||
|
||||
switch (result.committedStateMode)
|
||||
{
|
||||
case RuntimeCoordinatorCommittedStateMode::UseCommittedStates:
|
||||
mUseCommittedLayerStates = true;
|
||||
break;
|
||||
case RuntimeCoordinatorCommittedStateMode::UseLiveSnapshots:
|
||||
mUseCommittedLayerStates = false;
|
||||
break;
|
||||
case RuntimeCoordinatorCommittedStateMode::Unchanged:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (mRuntimeCoordinator)
|
||||
mRuntimeCoordinator->ApplyCommittedStateMode(result.committedStateMode);
|
||||
|
||||
if (result.clearTransientOscState)
|
||||
{
|
||||
@@ -508,7 +477,8 @@ bool OpenGLComposite::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResu
|
||||
mRuntimeServices->ClearOscState();
|
||||
}
|
||||
|
||||
ApplyRuntimeCoordinatorRenderReset(result.renderResetScope);
|
||||
if (mRenderEngine)
|
||||
mRenderEngine->ApplyRuntimeCoordinatorRenderReset(result.renderResetScope);
|
||||
|
||||
if (result.shaderBuildRequested)
|
||||
RequestShaderBuild();
|
||||
@@ -519,26 +489,6 @@ bool OpenGLComposite::ApplyRuntimeCoordinatorResult(const RuntimeCoordinatorResu
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenGLComposite::ApplyRuntimeCoordinatorRenderReset(RuntimeCoordinatorRenderResetScope resetScope)
|
||||
{
|
||||
if (!mRenderEngine)
|
||||
return;
|
||||
|
||||
switch (resetScope)
|
||||
{
|
||||
case RuntimeCoordinatorRenderResetScope::TemporalHistoryOnly:
|
||||
mRenderEngine->ResetTemporalHistoryState();
|
||||
break;
|
||||
case RuntimeCoordinatorRenderResetScope::TemporalHistoryAndFeedback:
|
||||
mRenderEngine->ResetTemporalHistoryState();
|
||||
mRenderEngine->ResetShaderFeedbackState();
|
||||
break;
|
||||
case RuntimeCoordinatorRenderResetScope::None:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLComposite::broadcastRuntimeState()
|
||||
{
|
||||
if (mRuntimeServices)
|
||||
|
||||
Reference in New Issue
Block a user