Unify builtin forward phase render graph recording
This commit is contained in:
@@ -166,11 +166,15 @@ bool ResolveGraphManagedOutputSurface(
|
||||
|
||||
} // namespace
|
||||
|
||||
bool RecordRasterRenderPass(
|
||||
RenderPass& pass,
|
||||
bool RecordCallbackRasterRenderPass(
|
||||
const RenderPassRenderGraphContext& context,
|
||||
const RenderPassGraphIO& io) {
|
||||
RenderPass* const renderPass = &pass;
|
||||
const RenderPassGraphIO& io,
|
||||
RenderPassGraphExecutePassCallback executePassCallback,
|
||||
std::vector<RenderGraphTextureHandle> additionalReadTextures) {
|
||||
if (!executePassCallback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const Containers::String passName = context.passName;
|
||||
const RenderContext renderContext = context.renderContext;
|
||||
const std::shared_ptr<const RenderSceneData> sceneData =
|
||||
@@ -190,8 +194,7 @@ bool RecordRasterRenderPass(
|
||||
|
||||
context.graphBuilder.AddRasterPass(
|
||||
passName,
|
||||
[renderPass,
|
||||
renderContext,
|
||||
[renderContext,
|
||||
sceneData,
|
||||
surface,
|
||||
hasSourceSurface,
|
||||
@@ -204,12 +207,20 @@ bool RecordRasterRenderPass(
|
||||
executionSucceeded,
|
||||
beginPassCallback,
|
||||
endPassCallback,
|
||||
executePassCallback,
|
||||
additionalReadTextures,
|
||||
io](
|
||||
RenderGraphPassBuilder& passBuilder) {
|
||||
if (io.readSourceColor && sourceColorTexture.IsValid()) {
|
||||
passBuilder.ReadTexture(sourceColorTexture);
|
||||
}
|
||||
|
||||
for (RenderGraphTextureHandle readTexture : additionalReadTextures) {
|
||||
if (readTexture.IsValid()) {
|
||||
passBuilder.ReadTexture(readTexture);
|
||||
}
|
||||
}
|
||||
|
||||
if (io.writeColor) {
|
||||
for (RenderGraphTextureHandle colorTarget : colorTargets) {
|
||||
if (colorTarget.IsValid()) {
|
||||
@@ -223,8 +234,7 @@ bool RecordRasterRenderPass(
|
||||
}
|
||||
|
||||
passBuilder.SetExecuteCallback(
|
||||
[renderPass,
|
||||
renderContext,
|
||||
[renderContext,
|
||||
sceneData,
|
||||
surface,
|
||||
hasSourceSurface,
|
||||
@@ -237,6 +247,7 @@ bool RecordRasterRenderPass(
|
||||
executionSucceeded,
|
||||
beginPassCallback,
|
||||
endPassCallback,
|
||||
executePassCallback,
|
||||
io](
|
||||
const RenderGraphExecutionContext& executionContext) {
|
||||
if (executionSucceeded != nullptr && !(*executionSucceeded)) {
|
||||
@@ -297,7 +308,7 @@ bool RecordRasterRenderPass(
|
||||
return;
|
||||
}
|
||||
|
||||
const bool executeResult = renderPass->Execute(passContext);
|
||||
const bool executeResult = executePassCallback(passContext);
|
||||
if (endPassCallback) {
|
||||
endPassCallback(passContext);
|
||||
}
|
||||
@@ -309,6 +320,18 @@ bool RecordRasterRenderPass(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecordRasterRenderPass(
|
||||
RenderPass& pass,
|
||||
const RenderPassRenderGraphContext& context,
|
||||
const RenderPassGraphIO& io) {
|
||||
return RecordCallbackRasterRenderPass(
|
||||
context,
|
||||
io,
|
||||
[&pass](const RenderPassContext& passContext) {
|
||||
return pass.Execute(passContext);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Rendering
|
||||
} // namespace XCEngine
|
||||
|
||||
Reference in New Issue
Block a user