refactor(srp): align urp renderer feature ownership model

This commit is contained in:
2026-04-21 20:17:08 +08:00
parent 0d0919b276
commit e527ca4e3a
6 changed files with 201 additions and 76 deletions

View File

@@ -41,11 +41,6 @@ namespace XCEngine.Rendering.Universal
return m_rendererInstance;
}
internal ScriptableRendererFeature[] CreateRendererFeaturesInstance()
{
return GetRendererFeatures();
}
internal void SetupRendererInstance(
ScriptableRenderer renderer)
{
@@ -245,12 +240,6 @@ namespace XCEngine.Rendering.Universal
{
}
protected virtual ScriptableRendererFeature[] CreateRendererFeatures()
{
return rendererFeatures ??
Array.Empty<ScriptableRendererFeature>();
}
protected virtual void ReleaseRuntimeResources()
{
}
@@ -342,15 +331,21 @@ namespace XCEngine.Rendering.Universal
rendererFeatures =
CreateDefaultRendererFeatures() ??
Array.Empty<ScriptableRendererFeature>();
BindRendererFeatureOwners(rendererFeatures);
}
private ScriptableRendererFeature[] GetRendererFeatures()
{
if (m_rendererFeatures == null)
{
ScriptableRendererFeature[]
configuredRendererFeatures =
rendererFeatures ??
Array.Empty<ScriptableRendererFeature>();
rendererFeatures =
configuredRendererFeatures;
m_rendererFeatures =
CreateRendererFeatures() ??
Array.Empty<ScriptableRendererFeature>();
configuredRendererFeatures;
}
BindRendererFeatureOwners(m_rendererFeatures);