196 lines
7.0 KiB
C#
196 lines
7.0 KiB
C#
using XCEngine;
|
|
|
|
namespace Gameplay
|
|
{
|
|
public sealed class LegacyRenderPipelineApiProbeAsset : RenderPipelineAsset
|
|
{
|
|
}
|
|
|
|
public sealed class RenderPipelineApiProbeAsset : ScriptableRenderPipelineAsset
|
|
{
|
|
}
|
|
|
|
public sealed class ManagedRenderPipelineProbeAsset : ScriptableRenderPipelineAsset
|
|
{
|
|
public static int CreatePipelineCallCount;
|
|
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
CreatePipelineCallCount++;
|
|
return new ManagedRenderPipelineProbe();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPostProcessRenderPipelineProbeAsset : ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedPostProcessRenderPipelineProbe();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPlannedFullscreenRenderPipelineProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedPlannedFullscreenRenderPipelineProbe();
|
|
}
|
|
|
|
protected override void ConfigureCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context)
|
|
{
|
|
context.ClearPostProcessStage();
|
|
context.ClearFinalOutputStage();
|
|
context.RequestPostProcessStage(
|
|
CameraFrameColorSource.MainSceneColor,
|
|
true);
|
|
context.RequestFinalOutputStage(
|
|
CameraFrameColorSource.PostProcessColor);
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedCameraRequestConfiguredRenderPipelineProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedRenderPipelineProbe();
|
|
}
|
|
|
|
protected override void ConfigureCameraRenderRequest(
|
|
ScriptableRenderPipelineCameraRequestContext context)
|
|
{
|
|
if (context != null && context.hasDirectionalShadow)
|
|
{
|
|
context.ClearDirectionalShadow();
|
|
}
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderPipelineProbe : ScriptableRenderPipeline
|
|
{
|
|
public static int SupportsStageCallCount;
|
|
public static int RecordStageCallCount;
|
|
|
|
protected override bool SupportsStageRenderGraph(
|
|
CameraFrameStage stage)
|
|
{
|
|
SupportsStageCallCount++;
|
|
return stage == CameraFrameStage.MainScene;
|
|
}
|
|
|
|
protected override bool RecordStageRenderGraph(
|
|
ScriptableRenderContext context)
|
|
{
|
|
RecordStageCallCount++;
|
|
return context != null &&
|
|
context.stage == CameraFrameStage.MainScene &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.BeforeOpaque) &&
|
|
context.RecordBuiltinForwardScenePhase(ScenePhase.Opaque) &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.AfterOpaque) &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.BeforeSkybox) &&
|
|
context.RecordBuiltinForwardScenePhase(ScenePhase.Skybox) &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.AfterSkybox) &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.BeforeTransparent) &&
|
|
context.RecordBuiltinForwardScenePhase(ScenePhase.Transparent) &&
|
|
context.RecordBuiltinForwardInjectionPoint(
|
|
SceneRenderInjectionPoint.AfterTransparent);
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPostProcessRenderPipelineProbe : ScriptableRenderPipeline
|
|
{
|
|
protected override bool SupportsStageRenderGraph(
|
|
CameraFrameStage stage)
|
|
{
|
|
return stage == CameraFrameStage.PostProcess;
|
|
}
|
|
|
|
protected override bool RecordStageRenderGraph(
|
|
ScriptableRenderContext context)
|
|
{
|
|
return context != null &&
|
|
context.stage == CameraFrameStage.PostProcess &&
|
|
context.RecordBuiltinColorScaleFullscreenPass(
|
|
new Vector4(1.10f, 0.95f, 0.90f, 1.0f)) &&
|
|
context.RecordBuiltinColorScaleFullscreenPass(
|
|
new Vector4(0.95f, 1.05f, 1.10f, 1.0f));
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPlannedFullscreenRenderPipelineProbe
|
|
: ScriptableRenderPipeline
|
|
{
|
|
protected override bool SupportsStageRenderGraph(
|
|
CameraFrameStage stage)
|
|
{
|
|
return stage == CameraFrameStage.PostProcess ||
|
|
stage == CameraFrameStage.FinalOutput;
|
|
}
|
|
|
|
protected override bool RecordStageRenderGraph(
|
|
ScriptableRenderContext context)
|
|
{
|
|
return context != null &&
|
|
(context.stage == CameraFrameStage.PostProcess ||
|
|
context.stage == CameraFrameStage.FinalOutput) &&
|
|
context.RecordBuiltinColorScaleFullscreenPass(
|
|
new Vector4(1.05f, 1.0f, 0.95f, 1.0f));
|
|
}
|
|
}
|
|
|
|
public sealed class RenderPipelineApiProbe : MonoBehaviour
|
|
{
|
|
public bool InitialTypeWasNull;
|
|
public bool InvalidSelectionRejected;
|
|
public bool InvalidSelectionMentionsScriptableBase;
|
|
public bool SelectionRoundTripSucceeded;
|
|
public string SelectedPipelineTypeName = string.Empty;
|
|
|
|
public void Start()
|
|
{
|
|
InitialTypeWasNull = GraphicsSettings.renderPipelineAssetType == null;
|
|
|
|
try
|
|
{
|
|
GraphicsSettings.renderPipelineAssetType =
|
|
typeof(LegacyRenderPipelineApiProbeAsset);
|
|
InvalidSelectionRejected = false;
|
|
}
|
|
catch (System.ArgumentException ex)
|
|
{
|
|
InvalidSelectionRejected = true;
|
|
InvalidSelectionMentionsScriptableBase =
|
|
ex.Message.Contains("ScriptableRenderPipelineAsset");
|
|
}
|
|
|
|
GraphicsSettings.renderPipelineAssetType =
|
|
typeof(RenderPipelineApiProbeAsset);
|
|
System.Type selectedType = GraphicsSettings.renderPipelineAssetType;
|
|
SelectionRoundTripSucceeded =
|
|
selectedType == typeof(RenderPipelineApiProbeAsset);
|
|
SelectedPipelineTypeName = selectedType != null
|
|
? selectedType.FullName ?? string.Empty
|
|
: string.Empty;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderPipelineRuntimeSelectionProbe : MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
ManagedRenderPipelineProbeAsset.CreatePipelineCallCount = 0;
|
|
ManagedRenderPipelineProbe.SupportsStageCallCount = 0;
|
|
ManagedRenderPipelineProbe.RecordStageCallCount = 0;
|
|
GraphicsSettings.renderPipelineAssetType =
|
|
typeof(ManagedRenderPipelineProbeAsset);
|
|
}
|
|
}
|
|
}
|