refactor(srp): move urp final color execution into managed feature

This commit is contained in:
2026-04-21 12:59:52 +08:00
parent 0063acadc9
commit 5bec70dcc5
12 changed files with 385 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
#include <XCEngine/Core/Containers/String.h>
#include <XCEngine/Core/Math/Vector4.h>
#include <XCEngine/Rendering/Planning/FinalColorSettings.h>
#include <cstdint>
#include <vector>
@@ -11,7 +12,8 @@ namespace Rendering {
enum class FullscreenPassType : uint8_t {
ColorScale = 0,
ShaderVector = 1
ShaderVector = 1,
FinalColor = 2
};
struct FullscreenColorScaleDesc {
@@ -28,10 +30,15 @@ struct FullscreenShaderVectorDesc {
}
};
struct FullscreenFinalColorDesc {
FinalColorSettings settings = {};
};
struct FullscreenPassDesc {
FullscreenPassType type = FullscreenPassType::ColorScale;
FullscreenColorScaleDesc colorScale = {};
FullscreenShaderVectorDesc shaderVector = {};
FullscreenFinalColorDesc finalColor = {};
static FullscreenPassDesc MakeColorScale(const Math::Vector4& scale) {
FullscreenPassDesc desc = {};
@@ -52,12 +59,22 @@ struct FullscreenPassDesc {
return desc;
}
static FullscreenPassDesc MakeFinalColor(
const FinalColorSettings& settings) {
FullscreenPassDesc desc = {};
desc.type = FullscreenPassType::FinalColor;
desc.finalColor.settings = settings;
return desc;
}
bool IsValid() const {
switch (type) {
case FullscreenPassType::ColorScale:
return true;
case FullscreenPassType::ShaderVector:
return shaderVector.IsValid();
case FullscreenPassType::FinalColor:
return finalColor.settings.RequiresProcessing();
default:
return false;
}

View File

@@ -35,6 +35,10 @@ inline std::unique_ptr<RenderPassSequence> BuildFullscreenPassSequence(
passDesc.shaderVector.shaderPath,
passDesc.shaderVector.passName));
break;
case FullscreenPassType::FinalColor:
sequence->AddPass(std::make_unique<Passes::BuiltinFinalColorPass>(
passDesc.finalColor.settings));
break;
default:
break;
}