refactor(rendering): shrink render pass graph compatibility helpers
This commit is contained in:
@@ -92,6 +92,18 @@ bool ExecuteCameraFrameStandaloneStagePass(
|
||||
});
|
||||
}
|
||||
|
||||
bool RecordCameraFrameFallbackCompatibleRenderPass(
|
||||
RenderPass& pass,
|
||||
const RenderPassRenderGraphContext& renderGraphContext,
|
||||
const RenderPassGraphIO& fallbackIo) {
|
||||
return pass.SupportsRenderGraph()
|
||||
? pass.RecordRenderGraph(renderGraphContext)
|
||||
: RecordRasterRenderPass(
|
||||
pass,
|
||||
renderGraphContext,
|
||||
fallbackIo);
|
||||
}
|
||||
|
||||
std::vector<RenderGraphTextureHandle> BuildCameraFrameStageGraphDefaultColorTargets(
|
||||
const CameraFrameStageGraphBuildState& stageState) {
|
||||
if (stageState.outputColor.IsValid()) {
|
||||
@@ -335,8 +347,7 @@ bool RecordCameraFrameRegularSequenceStageRenderGraphPass(
|
||||
const RenderGraphImportedSurface& outputSurface,
|
||||
const RenderPassGraphBeginCallback& beginPassCallback,
|
||||
RenderPass& pass) {
|
||||
return RecordCompatibleDeclaredRasterPass(
|
||||
pass,
|
||||
const RenderPassRenderGraphContext renderGraphContext =
|
||||
BuildRenderPassRenderGraphContext(
|
||||
BuildCameraFrameStageGraphRecordingContext(
|
||||
context,
|
||||
@@ -346,7 +357,11 @@ bool RecordCameraFrameRegularSequenceStageRenderGraphPass(
|
||||
BuildCameraFrameStageGraphSourceBinding(stageState),
|
||||
outputSurface.colorTextures,
|
||||
outputSurface.depthTexture),
|
||||
beginPassCallback));
|
||||
beginPassCallback);
|
||||
return RecordCameraFrameFallbackCompatibleRenderPass(
|
||||
pass,
|
||||
renderGraphContext,
|
||||
BuildDeclaredRasterPassGraphIO(renderGraphContext));
|
||||
}
|
||||
|
||||
CameraFrameRenderGraphSourceBinding ResolveCameraFrameFullscreenStageGraphSourceBinding(
|
||||
@@ -494,19 +509,22 @@ bool RecordCameraFrameFullscreenSequenceStageGraphPass(
|
||||
: RHI::ResourceStates::PixelShaderResource,
|
||||
currentSourceColor
|
||||
};
|
||||
const RenderPassRenderGraphContext renderGraphContext =
|
||||
BuildRenderPassRenderGraphContext(
|
||||
BuildCameraFrameStageGraphRecordingContext(
|
||||
context,
|
||||
stageState,
|
||||
passName,
|
||||
context.sceneData,
|
||||
passSourceBinding,
|
||||
std::vector<RenderGraphTextureHandle>{ passOutputColor },
|
||||
{}),
|
||||
beginPassCallback);
|
||||
const bool recordSucceeded =
|
||||
RecordCompatibleSourceColorFullscreenRasterPass(
|
||||
RecordCameraFrameFallbackCompatibleRenderPass(
|
||||
pass,
|
||||
BuildRenderPassRenderGraphContext(
|
||||
BuildCameraFrameStageGraphRecordingContext(
|
||||
context,
|
||||
stageState,
|
||||
passName,
|
||||
context.sceneData,
|
||||
passSourceBinding,
|
||||
std::vector<RenderGraphTextureHandle>{ passOutputColor },
|
||||
{}),
|
||||
beginPassCallback));
|
||||
renderGraphContext,
|
||||
BuildSourceColorFullscreenRasterPassGraphIO());
|
||||
if (recordSucceeded) {
|
||||
currentSourceColor = passOutputColor;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <XCEngine/Rendering/RenderPassGraphContract.h>
|
||||
|
||||
#include "Rendering/Execution/Internal/CameraFrameGraph/SurfaceUtils.h"
|
||||
#include "Rendering/FrameData/RenderSceneData.h"
|
||||
#include "Rendering/Graph/RenderGraph.h"
|
||||
|
||||
@@ -10,24 +11,6 @@ namespace XCEngine {
|
||||
namespace Rendering {
|
||||
namespace {
|
||||
|
||||
RenderSurface BuildGraphManagedImportedSurface(
|
||||
const RenderSurface& templateSurface,
|
||||
RHI::ResourceStates colorStateBefore,
|
||||
RHI::ResourceStates colorStateAfter) {
|
||||
RenderSurface surface = templateSurface;
|
||||
surface.SetAutoTransitionEnabled(false);
|
||||
surface.SetColorStateBefore(colorStateBefore);
|
||||
surface.SetColorStateAfter(colorStateAfter);
|
||||
return surface;
|
||||
}
|
||||
|
||||
RenderSurface BuildGraphManagedPassSurface(
|
||||
const RenderSurface& templateSurface) {
|
||||
RenderSurface surface = templateSurface;
|
||||
surface.SetAutoTransitionEnabled(false);
|
||||
return surface;
|
||||
}
|
||||
|
||||
bool ResolveGraphManagedSourceSurface(
|
||||
const RenderSurface* sourceSurfaceTemplate,
|
||||
RHI::RHIResourceView* sourceColorView,
|
||||
|
||||
Reference in New Issue
Block a user