refactor(srp): align renderer api with unity contexts

This commit is contained in:
2026-04-19 13:05:57 +08:00
parent fe7e6dddf3
commit 0cea7b80e8
16 changed files with 59 additions and 230 deletions

View File

@@ -1,7 +1,6 @@
using System.Reflection;
using XCEngine;
using XCEngine.Rendering;
using XCEngine.Rendering.Renderer;
namespace Gameplay
{
@@ -12,12 +11,10 @@ namespace Gameplay
public bool HasPublicContextRecordOpaqueScenePhase;
public bool HasPublicContextRecordBeforeOpaqueInjection;
public bool HasPublicContextRecordShaderVectorFullscreenPass;
public bool HasPublicRendererRecordOpaqueScenePhase;
public bool HasPublicRendererRecordShaderVectorFullscreenPass;
public bool HasPublicCameraRequestContextHasDirectionalShadow;
public bool HasPublicCameraRequestContextClearDirectionalShadow;
public bool HasPublicRendererCameraRequestContextHasDirectionalShadow;
public bool HasPublicRendererCameraRequestContextClearDirectionalShadow;
public bool HasRendererRecordingContextType;
public bool HasRendererCameraRequestContextType;
public void Start()
{
@@ -25,12 +22,8 @@ namespace Gameplay
BindingFlags.Instance | BindingFlags.Public;
System.Type contextType =
typeof(ScriptableRenderContext);
System.Type rendererContextType =
typeof(RendererRecordingContext);
System.Type cameraRequestContextType =
typeof(ScriptableRenderPipelineCameraRequestContext);
System.Type rendererCameraRequestContextType =
typeof(RendererCameraRequestContext);
HasPublicContextRecordScene =
contextType.GetMethod(
@@ -48,14 +41,6 @@ namespace Gameplay
contextType.GetMethod(
"RecordShaderVectorFullscreenPass",
PublicInstanceMethodFlags) != null;
HasPublicRendererRecordOpaqueScenePhase =
rendererContextType.GetMethod(
"RecordOpaqueScenePhase",
PublicInstanceMethodFlags) != null;
HasPublicRendererRecordShaderVectorFullscreenPass =
rendererContextType.GetMethod(
"RecordShaderVectorFullscreenPass",
PublicInstanceMethodFlags) != null;
HasPublicCameraRequestContextHasDirectionalShadow =
cameraRequestContextType.GetProperty(
"hasDirectionalShadow",
@@ -64,14 +49,12 @@ namespace Gameplay
cameraRequestContextType.GetMethod(
"ClearDirectionalShadow",
PublicInstanceMethodFlags) != null;
HasPublicRendererCameraRequestContextHasDirectionalShadow =
rendererCameraRequestContextType.GetProperty(
"hasDirectionalShadow",
PublicInstanceMethodFlags) != null;
HasPublicRendererCameraRequestContextClearDirectionalShadow =
rendererCameraRequestContextType.GetMethod(
"ClearDirectionalShadow",
PublicInstanceMethodFlags) != null;
HasRendererRecordingContextType =
System.Type.GetType(
"XCEngine.Rendering.Renderer.RendererRecordingContext, XCEngine.RenderPipelines.Universal") != null;
HasRendererCameraRequestContextType =
System.Type.GetType(
"XCEngine.Rendering.Renderer.RendererCameraRequestContext, XCEngine.RenderPipelines.Universal") != null;
}
}
}