refactor(srp): move native scene feature registration into backend setup
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
# SRP / URP Native Scene Feature Registration Ownership Plan
|
||||
|
||||
## Background
|
||||
|
||||
Current native gaussian splat / volumetric scene feature passes have already
|
||||
been lifted into a managed URP-facing wrapper layer:
|
||||
|
||||
- `UniversalRendererData` owns the default feature list
|
||||
- managed URP records native scene features explicitly
|
||||
- native dispatch now uses stable `NativeSceneFeaturePassId`
|
||||
|
||||
But one C++ ownership seam is still dirty:
|
||||
|
||||
- `BuiltinForwardPipeline` constructor silently registers default native scene
|
||||
feature passes
|
||||
- that means pipeline instantiation itself still decides which first-party
|
||||
native scene features exist
|
||||
- the default backend asset / scene draw backend factory do not own that policy
|
||||
|
||||
This keeps an avoidable hidden side effect inside the pipeline runtime object.
|
||||
|
||||
## Goal
|
||||
|
||||
Move default native scene feature registration out of
|
||||
`BuiltinForwardPipeline` construction and into explicit backend
|
||||
configuration/factory ownership.
|
||||
|
||||
After this phase:
|
||||
|
||||
- `BuiltinForwardPipeline` only owns execution/runtime state
|
||||
- default native scene feature availability is configured by
|
||||
backend asset/factory code
|
||||
- default backend asset creation and default scene draw backend creation share
|
||||
the same setup path
|
||||
|
||||
## Scope
|
||||
|
||||
### Step 1. Remove constructor-side feature registration
|
||||
|
||||
- stop registering default scene features inside
|
||||
`BuiltinForwardPipeline::BuiltinForwardPipeline()`
|
||||
|
||||
### Step 2. Centralize configured builtin forward creation
|
||||
|
||||
- introduce one explicit setup path for default builtin forward scene features
|
||||
- use that path from `BuiltinForwardPipelineAsset`
|
||||
- use that path from default scene draw backend creation / fallback creation
|
||||
|
||||
### Step 3. Verify no behavior regression
|
||||
|
||||
- rebuild old `XCEditor`
|
||||
- run old editor smoke until `SceneReady`
|
||||
|
||||
## Non-goals
|
||||
|
||||
- changing gaussian splat runtime logic
|
||||
- changing volumetric runtime logic
|
||||
- moving shadow runtime in this phase
|
||||
- deferred renderer work
|
||||
- editor / new_editor work
|
||||
|
||||
## Exit Criteria
|
||||
|
||||
- `BuiltinForwardPipeline` constructor no longer performs implicit native scene
|
||||
feature registration
|
||||
- default builtin forward backend creation still exposes gaussian splat /
|
||||
volumetric native features through the explicit factory path
|
||||
- old editor `XCEditor` Debug build passes
|
||||
- old editor smoke reaches `SceneReady`
|
||||
|
||||
## Result
|
||||
|
||||
Completed on 2026-04-21.
|
||||
|
||||
- removed constructor-side default native scene feature registration from
|
||||
`BuiltinForwardPipeline`
|
||||
- centralized configured builtin forward creation in
|
||||
`BuiltinForwardSceneSetup`
|
||||
- routed builtin forward asset creation, default scene draw backend creation,
|
||||
and host fallback creation through the same configured pipeline path
|
||||
|
||||
## Verification
|
||||
|
||||
- `cmake --build . --config Debug --target XCEditor`
|
||||
- old editor smoke passed
|
||||
- `SceneReady elapsed_ms=5493 first_frame_ms=614`
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Rendering/Execution/DirectionalShadowExecutionState.h"
|
||||
#include "Rendering/Pipelines/BuiltinForwardPipeline.h"
|
||||
#include "Rendering/Pipelines/Internal/BuiltinForwardSceneSetup.h"
|
||||
#include "Rendering/Pipelines/ManagedScriptableRenderPipelineAsset.h"
|
||||
#include "Rendering/Pipelines/ScriptableRenderPipelineHost.h"
|
||||
#include "Rendering/Passes/BuiltinDepthOnlyPass.h"
|
||||
@@ -160,7 +161,14 @@ std::unique_ptr<SceneDrawBackend> CreateSceneDrawBackendFromAsset(
|
||||
}
|
||||
|
||||
std::unique_ptr<SceneDrawBackend> CreateDefaultSceneDrawBackend() {
|
||||
return std::make_unique<Pipelines::BuiltinForwardPipeline>();
|
||||
if (std::unique_ptr<SceneDrawBackend> sceneDrawBackend =
|
||||
TryCreateSceneDrawBackendFromAsset(
|
||||
CreateDefaultPipelineBackendAsset());
|
||||
sceneDrawBackend != nullptr) {
|
||||
return sceneDrawBackend;
|
||||
}
|
||||
|
||||
return Pipelines::Internal::CreateConfiguredBuiltinForwardPipeline();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -6,9 +6,7 @@ namespace XCEngine {
|
||||
namespace Rendering {
|
||||
namespace Pipelines {
|
||||
|
||||
BuiltinForwardPipeline::BuiltinForwardPipeline() {
|
||||
Internal::RegisterBuiltinForwardSceneFeatures(m_forwardSceneFeatureHost);
|
||||
}
|
||||
BuiltinForwardPipeline::BuiltinForwardPipeline() = default;
|
||||
|
||||
BuiltinForwardPipeline::~BuiltinForwardPipeline() {
|
||||
Shutdown();
|
||||
@@ -28,7 +26,7 @@ SceneRenderFeaturePass* BuiltinForwardPipeline::GetForwardSceneFeaturePass(size_
|
||||
}
|
||||
|
||||
std::unique_ptr<RenderPipeline> BuiltinForwardPipelineAsset::CreatePipeline() const {
|
||||
return std::make_unique<BuiltinForwardPipeline>();
|
||||
return Internal::CreateConfiguredBuiltinForwardPipeline();
|
||||
}
|
||||
|
||||
} // namespace Pipelines
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "Rendering/Features/BuiltinGaussianSplatPass.h"
|
||||
#include "Rendering/Features/BuiltinVolumetricPass.h"
|
||||
#include "Rendering/SceneRenderFeatureHost.h"
|
||||
#include "Rendering/Pipelines/BuiltinForwardPipeline.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -11,9 +11,20 @@ namespace Rendering {
|
||||
namespace Pipelines {
|
||||
namespace Internal {
|
||||
|
||||
void RegisterBuiltinForwardSceneFeatures(SceneRenderFeatureHost& featureHost) {
|
||||
featureHost.AddFeaturePass(std::make_unique<Features::BuiltinGaussianSplatPass>());
|
||||
featureHost.AddFeaturePass(std::make_unique<Features::BuiltinVolumetricPass>());
|
||||
void ConfigureBuiltinForwardPipeline(
|
||||
BuiltinForwardPipeline& pipeline) {
|
||||
pipeline.AddForwardSceneFeaturePass(
|
||||
std::make_unique<Features::BuiltinGaussianSplatPass>());
|
||||
pipeline.AddForwardSceneFeaturePass(
|
||||
std::make_unique<Features::BuiltinVolumetricPass>());
|
||||
}
|
||||
|
||||
std::unique_ptr<BuiltinForwardPipeline>
|
||||
CreateConfiguredBuiltinForwardPipeline() {
|
||||
std::unique_ptr<BuiltinForwardPipeline> pipeline =
|
||||
std::make_unique<BuiltinForwardPipeline>();
|
||||
ConfigureBuiltinForwardPipeline(*pipeline);
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Rendering {
|
||||
|
||||
class SceneRenderFeatureHost;
|
||||
|
||||
namespace Pipelines {
|
||||
class BuiltinForwardPipeline;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
void RegisterBuiltinForwardSceneFeatures(SceneRenderFeatureHost& featureHost);
|
||||
void ConfigureBuiltinForwardPipeline(
|
||||
BuiltinForwardPipeline& pipeline);
|
||||
std::unique_ptr<BuiltinForwardPipeline>
|
||||
CreateConfiguredBuiltinForwardPipeline();
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Pipelines
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Rendering/Execution/DirectionalShadowExecutionState.h"
|
||||
#include "Rendering/Internal/RenderPipelineFactory.h"
|
||||
#include "Rendering/Pipelines/BuiltinForwardPipeline.h"
|
||||
#include "Rendering/Pipelines/Internal/BuiltinForwardSceneSetup.h"
|
||||
#include "Rendering/Pipelines/ManagedScriptableRenderPipelineAsset.h"
|
||||
#include "Rendering/Passes/BuiltinDepthOnlyPass.h"
|
||||
#include "Rendering/Passes/BuiltinObjectIdPass.h"
|
||||
@@ -30,7 +31,7 @@ std::unique_ptr<RenderPipelineBackend> CreatePipelineBackendFromAsset(
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_unique<BuiltinForwardPipeline>();
|
||||
return Internal::CreateConfiguredBuiltinForwardPipeline();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user