refactor(srp): add asset runtime invalidation seam

This commit is contained in:
2026-04-20 03:06:04 +08:00
parent d196ec9264
commit 59f2249e07
6 changed files with 554 additions and 14 deletions

View File

@@ -4,6 +4,8 @@ namespace XCEngine.Rendering
{
public abstract class ScriptableRenderPipelineAsset : RenderPipelineAsset
{
private int m_runtimeResourceVersion = 1;
protected ScriptableRenderPipelineAsset()
{
}
@@ -19,6 +21,11 @@ namespace XCEngine.Rendering
ConfigureCameraFramePlan(context);
}
internal int GetRuntimeResourceVersionInstance()
{
return m_runtimeResourceVersion;
}
protected virtual ScriptableRenderPipeline CreatePipeline()
{
return null;
@@ -47,6 +54,21 @@ namespace XCEngine.Rendering
protected virtual void ReleaseRuntimeResources()
{
}
protected void SetDirty()
{
ReleaseRuntimeResources();
unchecked
{
++m_runtimeResourceVersion;
}
if (m_runtimeResourceVersion <= 0)
{
m_runtimeResourceVersion = 1;
}
}
}
}