Group camera frame fullscreen color chain intent
This commit is contained in:
@@ -12,6 +12,17 @@ enum class CameraFrameColorSource {
|
||||
PostProcessColor
|
||||
};
|
||||
|
||||
struct CameraFrameFullscreenStagePlan {
|
||||
bool usesGraphManagedOutputColor = false;
|
||||
CameraFrameColorSource source = CameraFrameColorSource::ExplicitSurface;
|
||||
};
|
||||
|
||||
struct CameraFrameColorChainPlan {
|
||||
bool usesGraphManagedMainSceneColor = false;
|
||||
CameraFrameFullscreenStagePlan postProcess = {};
|
||||
CameraFrameFullscreenStagePlan finalOutput = {};
|
||||
};
|
||||
|
||||
struct CameraFramePlan {
|
||||
static RenderSurface BuildGraphManagedIntermediateSurfaceTemplate(
|
||||
const RenderSurface& surface) {
|
||||
@@ -32,10 +43,7 @@ struct CameraFramePlan {
|
||||
RenderPassSequence* preScenePasses = nullptr;
|
||||
RenderPassSequence* postScenePasses = nullptr;
|
||||
RenderPassSequence* overlayPasses = nullptr;
|
||||
bool usesGraphManagedMainSceneColor = false;
|
||||
bool usesGraphManagedPostProcessColor = false;
|
||||
CameraFrameColorSource postProcessSource = CameraFrameColorSource::ExplicitSurface;
|
||||
CameraFrameColorSource finalOutputSource = CameraFrameColorSource::ExplicitSurface;
|
||||
CameraFrameColorChainPlan colorChain = {};
|
||||
RenderSurface graphManagedMainSceneSurface = {};
|
||||
|
||||
static CameraFramePlan FromRequest(const CameraRenderRequest& request) {
|
||||
@@ -61,20 +69,45 @@ struct CameraFramePlan {
|
||||
BuildGraphManagedIntermediateSurfaceTemplate(request.surface);
|
||||
}
|
||||
|
||||
bool UsesGraphManagedMainSceneColor() const {
|
||||
return colorChain.usesGraphManagedMainSceneColor;
|
||||
}
|
||||
|
||||
bool UsesGraphManagedOutputColor(CameraFrameStage stage) const {
|
||||
switch (stage) {
|
||||
case CameraFrameStage::PostProcess:
|
||||
return colorChain.postProcess.usesGraphManagedOutputColor;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CameraFrameColorSource ResolveStageColorSource(CameraFrameStage stage) const {
|
||||
switch (stage) {
|
||||
case CameraFrameStage::PostProcess:
|
||||
return colorChain.postProcess.source;
|
||||
case CameraFrameStage::FinalOutput:
|
||||
return colorChain.finalOutput.source;
|
||||
default:
|
||||
return CameraFrameColorSource::ExplicitSurface;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPostProcessStageValid() const {
|
||||
if (!postProcess.IsRequested()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (postProcessSource == CameraFrameColorSource::ExplicitSurface) {
|
||||
if (ResolveStageColorSource(CameraFrameStage::PostProcess) ==
|
||||
CameraFrameColorSource::ExplicitSurface) {
|
||||
return postProcess.IsValid();
|
||||
}
|
||||
|
||||
const bool hasUsableDestination =
|
||||
usesGraphManagedPostProcessColor ||
|
||||
UsesGraphManagedOutputColor(CameraFrameStage::PostProcess) ||
|
||||
(HasValidColorTarget(postProcess.destinationSurface) &&
|
||||
HasValidSurfaceSampleDescription(postProcess.destinationSurface));
|
||||
return usesGraphManagedMainSceneColor &&
|
||||
return UsesGraphManagedMainSceneColor() &&
|
||||
postProcess.passes != nullptr &&
|
||||
HasValidSingleSampleColorSource(request.surface) &&
|
||||
hasUsableDestination;
|
||||
@@ -85,14 +118,16 @@ struct CameraFramePlan {
|
||||
return true;
|
||||
}
|
||||
|
||||
const CameraFrameColorSource finalOutputSource =
|
||||
ResolveStageColorSource(CameraFrameStage::FinalOutput);
|
||||
if (finalOutputSource == CameraFrameColorSource::ExplicitSurface) {
|
||||
return finalOutput.IsValid();
|
||||
}
|
||||
|
||||
const bool hasUsableSource =
|
||||
finalOutputSource == CameraFrameColorSource::MainSceneColor
|
||||
? usesGraphManagedMainSceneColor
|
||||
: usesGraphManagedPostProcessColor;
|
||||
? UsesGraphManagedMainSceneColor()
|
||||
: UsesGraphManagedOutputColor(CameraFrameStage::PostProcess);
|
||||
return hasUsableSource &&
|
||||
finalOutput.passes != nullptr &&
|
||||
HasValidColorTarget(finalOutput.destinationSurface) &&
|
||||
@@ -157,7 +192,7 @@ struct CameraFramePlan {
|
||||
}
|
||||
|
||||
const RenderSurface& GetMainSceneSurface() const {
|
||||
if (usesGraphManagedMainSceneColor &&
|
||||
if (UsesGraphManagedMainSceneColor() &&
|
||||
graphManagedMainSceneSurface.GetWidth() > 0u &&
|
||||
graphManagedMainSceneSurface.GetHeight() > 0u) {
|
||||
return graphManagedMainSceneSurface;
|
||||
|
||||
@@ -40,25 +40,16 @@ inline bool UsesCameraFrameStageGraphManagedOutputColor(
|
||||
CameraFrameStage stage) {
|
||||
switch (stage) {
|
||||
case CameraFrameStage::MainScene:
|
||||
return plan.usesGraphManagedMainSceneColor;
|
||||
case CameraFrameStage::PostProcess:
|
||||
return plan.usesGraphManagedPostProcessColor;
|
||||
return plan.UsesGraphManagedMainSceneColor();
|
||||
default:
|
||||
return false;
|
||||
return plan.UsesGraphManagedOutputColor(stage);
|
||||
}
|
||||
}
|
||||
|
||||
inline CameraFrameColorSource ResolveCameraFrameStageGraphManagedColorSource(
|
||||
const CameraFramePlan& plan,
|
||||
CameraFrameStage stage) {
|
||||
switch (stage) {
|
||||
case CameraFrameStage::PostProcess:
|
||||
return plan.postProcessSource;
|
||||
case CameraFrameStage::FinalOutput:
|
||||
return plan.finalOutputSource;
|
||||
default:
|
||||
return CameraFrameColorSource::ExplicitSurface;
|
||||
}
|
||||
return plan.ResolveStageColorSource(stage);
|
||||
}
|
||||
|
||||
inline CameraFrameRenderGraphSourceBinding ResolveCameraFrameFullscreenStageGraphSourceBinding(
|
||||
|
||||
Reference in New Issue
Block a user