Files
XCEngine/managed/GameScripts/ScriptableRenderContextApiSurfaceProbe.cs
ssdfasd 5e88449e3d refactor(srp): move renderer feature setup into renderer data
Introduce a formal ScriptableRendererData setup seam so renderer feature attachment is owned by renderer data instead of renderer constructors pulling feature caches.

Route lifecycle and reuse probes through the new setup path, lock the non-public setup seam in the API surface probe, and update scripting expectations accordingly.
2026-04-20 02:30:07 +08:00

204 lines
10 KiB
C#

using System.Reflection;
using XCEngine;
using XCEngine.Rendering;
using XCEngine.Rendering.Universal;
namespace Gameplay
{
public sealed class ScriptableRenderContextApiSurfaceProbe
: MonoBehaviour
{
public bool HasPublicContextRecordScene;
public bool HasPublicContextRecordOpaqueScenePhase;
public bool HasPublicContextRecordBeforeOpaqueInjection;
public bool HasPublicContextRecordShaderVectorFullscreenPass;
public bool HasPublicContextCameraData;
public bool HasPublicContextLightingData;
public bool HasPublicContextShadowData;
public bool HasPublicContextEnvironmentData;
public bool HasPublicContextFinalColorData;
public bool HasPublicContextStageColorData;
public bool HasPublicRequestContextHasDirectionalShadow;
public bool HasPublicRequestContextClearDirectionalShadow;
public bool HasUniversalContextRecordSceneExtension;
public bool HasUniversalContextRecordOpaqueScenePhaseExtension;
public bool HasUniversalContextRecordBeforeOpaqueInjectionExtension;
public bool HasUniversalContextRecordShaderVectorFullscreenPassExtension;
public bool HasUniversalRequestContextHasDirectionalShadowExtension;
public bool HasUniversalRequestContextClearDirectionalShadowExtension;
public bool HasPublicPipelineAssetConfigureCameraFramePlan;
public bool HasPlanningContextType;
public bool HasRendererFeatureConfigureCameraFramePlan;
public bool HasRendererRecordingContextType;
public bool HasRendererCameraRequestContextType;
public bool HasRendererBackedRenderPipelineAssetType;
public bool HasRendererBackedRenderPipelineType;
public bool HasRendererDrivenRenderPipelineType;
public bool HasRendererDataSetupRenderer;
public bool HasRendererSupportsRendererRecording;
public bool HasRendererRecordRenderer;
public bool HasPublicRendererSupportsStageRenderGraph;
public bool HasPublicRendererRecordStageRenderGraph;
public void Start()
{
const BindingFlags PublicInstanceMethodFlags =
BindingFlags.Instance | BindingFlags.Public;
System.Type contextType =
typeof(ScriptableRenderContext);
System.Type requestContextType =
typeof(CameraRenderRequestContext);
System.Type pipelineAssetType =
typeof(ScriptableRenderPipelineAsset);
System.Type rendererFeatureType =
typeof(ScriptableRendererFeature);
System.Type rendererDataType =
typeof(ScriptableRendererData);
System.Type rendererType =
typeof(ScriptableRenderer);
System.Type universalAssemblyType =
typeof(ScriptableRendererFeature);
System.Reflection.Assembly universalAssembly =
universalAssemblyType.Assembly;
System.Type renderContextExtensionsType =
universalAssembly.GetType(
"XCEngine.Rendering.Universal.ScriptableRenderContextExtensions");
System.Type requestContextExtensionsType =
universalAssembly.GetType(
"XCEngine.Rendering.Universal.CameraRenderRequestContextExtensions");
HasPublicContextRecordScene =
contextType.GetMethod(
"RecordScene",
PublicInstanceMethodFlags) != null;
HasPublicContextRecordOpaqueScenePhase =
contextType.GetMethod(
"RecordOpaqueScenePhase",
PublicInstanceMethodFlags) != null;
HasPublicContextRecordBeforeOpaqueInjection =
contextType.GetMethod(
"RecordBeforeOpaqueInjection",
PublicInstanceMethodFlags) != null;
HasPublicContextRecordShaderVectorFullscreenPass =
contextType.GetMethod(
"RecordShaderVectorFullscreenPass",
PublicInstanceMethodFlags) != null;
HasPublicContextCameraData =
contextType.GetProperty(
"cameraData",
PublicInstanceMethodFlags) != null;
HasPublicContextLightingData =
contextType.GetProperty(
"lightingData",
PublicInstanceMethodFlags) != null;
HasPublicContextShadowData =
contextType.GetProperty(
"shadowData",
PublicInstanceMethodFlags) != null;
HasPublicContextEnvironmentData =
contextType.GetProperty(
"environmentData",
PublicInstanceMethodFlags) != null;
HasPublicContextFinalColorData =
contextType.GetProperty(
"finalColorData",
PublicInstanceMethodFlags) != null;
HasPublicContextStageColorData =
contextType.GetProperty(
"stageColorData",
PublicInstanceMethodFlags) != null;
HasPublicRequestContextHasDirectionalShadow =
requestContextType.GetProperty(
"hasDirectionalShadow",
PublicInstanceMethodFlags) != null;
HasPublicRequestContextClearDirectionalShadow =
requestContextType.GetMethod(
"ClearDirectionalShadow",
PublicInstanceMethodFlags) != null;
HasUniversalContextRecordSceneExtension =
renderContextExtensionsType != null &&
renderContextExtensionsType.GetMethod(
"RecordScene",
BindingFlags.Static | BindingFlags.Public) != null;
HasUniversalContextRecordOpaqueScenePhaseExtension =
renderContextExtensionsType != null &&
renderContextExtensionsType.GetMethod(
"RecordOpaqueScenePhase",
BindingFlags.Static | BindingFlags.Public) != null;
HasUniversalContextRecordBeforeOpaqueInjectionExtension =
renderContextExtensionsType != null &&
renderContextExtensionsType.GetMethod(
"RecordBeforeOpaqueInjection",
BindingFlags.Static | BindingFlags.Public) != null;
HasUniversalContextRecordShaderVectorFullscreenPassExtension =
renderContextExtensionsType != null &&
renderContextExtensionsType.GetMethod(
"RecordShaderVectorFullscreenPass",
BindingFlags.Static | BindingFlags.Public) != null;
HasUniversalRequestContextHasDirectionalShadowExtension =
requestContextExtensionsType != null &&
requestContextExtensionsType.GetMethod(
"HasDirectionalShadow",
BindingFlags.Static | BindingFlags.Public) != null;
HasUniversalRequestContextClearDirectionalShadowExtension =
requestContextExtensionsType != null &&
requestContextExtensionsType.GetMethod(
"ClearDirectionalShadow",
BindingFlags.Static | BindingFlags.Public) != null;
HasPublicPipelineAssetConfigureCameraFramePlan =
pipelineAssetType.GetMethod(
"ConfigureCameraFramePlan",
BindingFlags.Instance |
BindingFlags.Public |
BindingFlags.NonPublic) != null;
HasPlanningContextType =
contextType.Assembly.GetType(
"XCEngine.Rendering.ScriptableRenderPipelinePlanningContext") != null;
HasRendererFeatureConfigureCameraFramePlan =
rendererFeatureType.GetMethod(
"ConfigureCameraFramePlan",
BindingFlags.Instance |
BindingFlags.Public |
BindingFlags.NonPublic) != null;
HasRendererRecordingContextType =
System.Type.GetType(
"XCEngine.Rendering.Universal.RendererRecordingContext, XCEngine.RenderPipelines.Universal") != null;
HasRendererCameraRequestContextType =
System.Type.GetType(
"XCEngine.Rendering.Universal.RendererCameraRequestContext, XCEngine.RenderPipelines.Universal") != null;
HasRendererBackedRenderPipelineAssetType =
System.Type.GetType(
"XCEngine.Rendering.Universal.RendererBackedRenderPipelineAsset, XCEngine.RenderPipelines.Universal") != null;
HasRendererBackedRenderPipelineType =
System.Type.GetType(
"XCEngine.Rendering.Universal.RendererBackedRenderPipeline, XCEngine.RenderPipelines.Universal") != null;
HasRendererDrivenRenderPipelineType =
System.Type.GetType(
"XCEngine.Rendering.Universal.RendererDrivenRenderPipeline, XCEngine.RenderPipelines.Universal") != null;
HasRendererDataSetupRenderer =
rendererDataType.GetMethod(
"SetupRenderer",
BindingFlags.Instance |
BindingFlags.NonPublic) != null;
HasRendererSupportsRendererRecording =
rendererType.GetMethod(
"SupportsRendererRecording",
BindingFlags.Instance |
BindingFlags.NonPublic) != null;
HasRendererRecordRenderer =
rendererType.GetMethod(
"RecordRenderer",
BindingFlags.Instance |
BindingFlags.NonPublic) != null;
HasPublicRendererSupportsStageRenderGraph =
rendererType.GetMethod(
"SupportsStageRenderGraph",
PublicInstanceMethodFlags) != null;
HasPublicRendererRecordStageRenderGraph =
rendererType.GetMethod(
"RecordStageRenderGraph",
PublicInstanceMethodFlags) != null;
}
}
}