refactor(rendering): infer raster pass graph io from declared context
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <XCEngine/Rendering/RenderPass.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Rendering {
|
||||
|
||||
@@ -27,6 +29,22 @@ inline RenderPassGraphIO BuildColorDepthRasterPassGraphIO() {
|
||||
};
|
||||
}
|
||||
|
||||
inline RenderPassGraphIO BuildDeclaredRasterPassGraphIO(
|
||||
const RenderPassRenderGraphContext& context) {
|
||||
const bool writesColor =
|
||||
std::any_of(
|
||||
context.colorTargets.begin(),
|
||||
context.colorTargets.end(),
|
||||
[](RenderGraphTextureHandle handle) {
|
||||
return handle.IsValid();
|
||||
});
|
||||
return {
|
||||
context.sourceSurface != nullptr || context.sourceColorTexture.IsValid(),
|
||||
writesColor,
|
||||
context.depthTarget.IsValid()
|
||||
};
|
||||
}
|
||||
|
||||
using RenderPassGraphExecutePassCallback =
|
||||
std::function<bool(const RenderPassContext&)>;
|
||||
|
||||
@@ -59,6 +77,15 @@ inline bool RecordColorDepthRasterPass(
|
||||
BuildColorDepthRasterPassGraphIO());
|
||||
}
|
||||
|
||||
inline bool RecordDeclaredRasterPass(
|
||||
RenderPass& pass,
|
||||
const RenderPassRenderGraphContext& context) {
|
||||
return RecordRasterRenderPass(
|
||||
pass,
|
||||
context,
|
||||
BuildDeclaredRasterPassGraphIO(context));
|
||||
}
|
||||
|
||||
inline bool RecordSourceColorFullscreenCallbackRasterPass(
|
||||
const RenderPassRenderGraphContext& context,
|
||||
RenderPassGraphExecutePassCallback executePassCallback,
|
||||
|
||||
Reference in New Issue
Block a user