1572 lines
60 KiB
C#
1572 lines
60 KiB
C#
using System;
|
|
using XCEngine;
|
|
using XCEngine.Rendering;
|
|
using XCEngine.Rendering.Renderer;
|
|
using XCEngine.Rendering.FirstParty;
|
|
|
|
namespace Gameplay
|
|
{
|
|
internal static class BuiltinShaderPaths
|
|
{
|
|
public const string ColorScalePostProcess =
|
|
"builtin://shaders/color-scale-post-process";
|
|
}
|
|
|
|
internal static class ProbeFinalColorSettingsFactory
|
|
{
|
|
public static FinalColorSettings Create()
|
|
{
|
|
FinalColorSettings settings =
|
|
FinalColorSettings.CreateDefault();
|
|
settings.outputTransferMode =
|
|
FinalColorOutputTransferMode.LinearToSRGB;
|
|
settings.exposureMode =
|
|
FinalColorExposureMode.Fixed;
|
|
settings.exposureValue = 1.75f;
|
|
settings.toneMappingMode =
|
|
FinalColorToneMappingMode.ACES;
|
|
settings.finalColorScale =
|
|
new Vector4(0.90f, 1.10f, 1.20f, 1.0f);
|
|
return settings;
|
|
}
|
|
}
|
|
|
|
internal sealed class SceneInjectionPass : ScriptableRenderPass
|
|
{
|
|
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
|
|
|
public SceneInjectionPass(
|
|
RenderPassEvent passEvent,
|
|
Func<RendererRecordingContext, bool> recordAction)
|
|
{
|
|
renderPassEvent = passEvent;
|
|
m_recordAction = recordAction;
|
|
}
|
|
|
|
protected override bool RecordRenderGraph(
|
|
RendererRecordingContext context,
|
|
RenderingData renderingData)
|
|
{
|
|
return context != null &&
|
|
renderingData != null &&
|
|
renderingData.isMainSceneStage &&
|
|
m_recordAction != null &&
|
|
m_recordAction(context);
|
|
}
|
|
}
|
|
|
|
internal sealed class ScenePhasePass : ScriptableRenderPass
|
|
{
|
|
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
|
private readonly Action m_onRecorded;
|
|
|
|
public ScenePhasePass(
|
|
RenderPassEvent passEvent,
|
|
Func<RendererRecordingContext, bool> recordAction,
|
|
Action onRecorded = null)
|
|
{
|
|
renderPassEvent = passEvent;
|
|
m_recordAction = recordAction;
|
|
m_onRecorded = onRecorded;
|
|
}
|
|
|
|
protected override bool RecordRenderGraph(
|
|
RendererRecordingContext context,
|
|
RenderingData renderingData)
|
|
{
|
|
bool recorded = context != null &&
|
|
renderingData != null &&
|
|
renderingData.isMainSceneStage &&
|
|
m_recordAction != null &&
|
|
m_recordAction(context);
|
|
if (recorded && m_onRecorded != null)
|
|
{
|
|
m_onRecorded();
|
|
}
|
|
|
|
return recorded;
|
|
}
|
|
}
|
|
|
|
internal sealed class FullscreenPass : ScriptableRenderPass
|
|
{
|
|
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
|
|
|
public FullscreenPass(
|
|
RenderPassEvent passEvent,
|
|
Func<RendererRecordingContext, bool> recordAction)
|
|
{
|
|
renderPassEvent = passEvent;
|
|
m_recordAction = recordAction;
|
|
}
|
|
|
|
protected override bool RecordRenderGraph(
|
|
RendererRecordingContext context,
|
|
RenderingData renderingData)
|
|
{
|
|
return context != null &&
|
|
renderingData != null &&
|
|
m_recordAction != null &&
|
|
m_recordAction(context);
|
|
}
|
|
}
|
|
|
|
internal sealed class DefaultSceneFeature : ScriptableRendererFeature
|
|
{
|
|
private readonly SceneInjectionPass m_beforeOpaquePass;
|
|
private readonly ScenePhasePass m_opaquePass;
|
|
private readonly SceneInjectionPass m_afterOpaquePass;
|
|
private readonly SceneInjectionPass m_beforeSkyboxPass;
|
|
private readonly ScenePhasePass m_skyboxPass;
|
|
private readonly SceneInjectionPass m_afterSkyboxPass;
|
|
private readonly SceneInjectionPass m_beforeTransparentPass;
|
|
private readonly ScenePhasePass m_transparentPass;
|
|
private readonly SceneInjectionPass m_afterTransparentPass;
|
|
|
|
public DefaultSceneFeature(
|
|
Action onOpaqueRecorded = null)
|
|
{
|
|
m_beforeOpaquePass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.BeforeRenderingOpaques,
|
|
context => context.RecordBeforeOpaqueInjection());
|
|
m_opaquePass =
|
|
new ScenePhasePass(
|
|
RenderPassEvent.RenderOpaques,
|
|
context => context.RecordOpaqueScenePhase(),
|
|
onOpaqueRecorded);
|
|
m_afterOpaquePass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.AfterRenderingOpaques,
|
|
context => context.RecordAfterOpaqueInjection());
|
|
m_beforeSkyboxPass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.BeforeRenderingSkybox,
|
|
context => context.RecordBeforeSkyboxInjection());
|
|
m_skyboxPass =
|
|
new ScenePhasePass(
|
|
RenderPassEvent.RenderSkybox,
|
|
context => context.RecordSkyboxScenePhase());
|
|
m_afterSkyboxPass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.AfterRenderingSkybox,
|
|
context => context.RecordAfterSkyboxInjection());
|
|
m_beforeTransparentPass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.BeforeRenderingTransparents,
|
|
context => context.RecordBeforeTransparentInjection());
|
|
m_transparentPass =
|
|
new ScenePhasePass(
|
|
RenderPassEvent.RenderTransparents,
|
|
context => context.RecordTransparentScenePhase());
|
|
m_afterTransparentPass =
|
|
new SceneInjectionPass(
|
|
RenderPassEvent.AfterRenderingTransparents,
|
|
context => context.RecordAfterTransparentInjection());
|
|
}
|
|
|
|
public override void AddRenderPasses(
|
|
ScriptableRenderer renderer,
|
|
RenderingData renderingData)
|
|
{
|
|
if (renderer == null ||
|
|
renderingData == null ||
|
|
!renderingData.isMainSceneStage)
|
|
{
|
|
return;
|
|
}
|
|
|
|
renderer.EnqueuePass(m_beforeOpaquePass);
|
|
renderer.EnqueuePass(m_opaquePass);
|
|
renderer.EnqueuePass(m_afterOpaquePass);
|
|
renderer.EnqueuePass(m_beforeSkyboxPass);
|
|
renderer.EnqueuePass(m_skyboxPass);
|
|
renderer.EnqueuePass(m_afterSkyboxPass);
|
|
renderer.EnqueuePass(m_beforeTransparentPass);
|
|
renderer.EnqueuePass(m_transparentPass);
|
|
renderer.EnqueuePass(m_afterTransparentPass);
|
|
}
|
|
}
|
|
|
|
internal sealed class FullscreenFeature : ScriptableRendererFeature
|
|
{
|
|
private readonly ScriptableRenderPass[] m_passes;
|
|
|
|
public FullscreenFeature(
|
|
params ScriptableRenderPass[] passes)
|
|
{
|
|
m_passes = passes ?? Array.Empty<ScriptableRenderPass>();
|
|
}
|
|
|
|
public override void AddRenderPasses(
|
|
ScriptableRenderer renderer,
|
|
RenderingData renderingData)
|
|
{
|
|
if (renderer == null ||
|
|
renderingData == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < m_passes.Length; ++i)
|
|
{
|
|
ScriptableRenderPass renderPass = m_passes[i];
|
|
if (renderPass == null ||
|
|
!renderPass.SupportsStage(renderingData.stage))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
renderer.EnqueuePass(renderPass);
|
|
}
|
|
}
|
|
}
|
|
|
|
internal sealed class ProbeSceneRenderer : ScriptableRenderer
|
|
{
|
|
public ProbeSceneRenderer(
|
|
Action onOpaqueRecorded = null)
|
|
{
|
|
AddFeature(new DefaultSceneFeature(onOpaqueRecorded));
|
|
}
|
|
}
|
|
|
|
internal sealed class ProbePostProcessRenderer : ScriptableRenderer
|
|
{
|
|
public ProbePostProcessRenderer(
|
|
Vector4 firstVectorPayload,
|
|
Vector4 secondVectorPayload)
|
|
{
|
|
AddFeature(
|
|
new FullscreenFeature(
|
|
new FullscreenPass(
|
|
RenderPassEvent.BeforeRenderingPostProcessing,
|
|
context => context.RecordShaderVectorFullscreenPass(
|
|
BuiltinShaderPaths.ColorScalePostProcess,
|
|
firstVectorPayload,
|
|
"ColorScale")),
|
|
new FullscreenPass(
|
|
RenderPassEvent.AfterRenderingPostProcessing,
|
|
context => context.RecordShaderVectorFullscreenPass(
|
|
BuiltinShaderPaths.ColorScalePostProcess,
|
|
secondVectorPayload,
|
|
"ColorScale"))));
|
|
}
|
|
}
|
|
|
|
internal sealed class ProbeForwardRenderer : ScriptableRenderer
|
|
{
|
|
public ProbeForwardRenderer(
|
|
Vector4 postProcessScale,
|
|
Action onOpaqueRecorded)
|
|
{
|
|
AddFeature(new DefaultSceneFeature(onOpaqueRecorded));
|
|
AddFeature(
|
|
new FullscreenFeature(
|
|
new FullscreenPass(
|
|
RenderPassEvent.BeforeRenderingPostProcessing,
|
|
context => context.RecordColorScaleFullscreenPass(
|
|
postProcessScale))));
|
|
}
|
|
}
|
|
|
|
internal sealed class ProbePlannedFullscreenRenderer : ScriptableRenderer
|
|
{
|
|
public ProbePlannedFullscreenRenderer()
|
|
{
|
|
AddFeature(
|
|
new FullscreenFeature(
|
|
new FullscreenPass(
|
|
RenderPassEvent.BeforeRenderingPostProcessing,
|
|
context => context.RecordColorScaleFullscreenPass(
|
|
new Vector4(1.05f, 1.0f, 0.95f, 1.0f))),
|
|
new FullscreenPass(
|
|
RenderPassEvent.BeforeRenderingFinalOutput,
|
|
context => context.RecordColorScaleFullscreenPass(
|
|
new Vector4(1.05f, 1.0f, 0.95f, 1.0f)))));
|
|
}
|
|
}
|
|
|
|
internal sealed class CameraDataObservationPass
|
|
: ScriptableRenderPass
|
|
{
|
|
public static Vector4 ObservedViewRow0;
|
|
public static Vector4 ObservedViewRow1;
|
|
public static Vector4 ObservedViewRow2;
|
|
public static Vector4 ObservedViewRow3;
|
|
public static Vector4 ObservedProjectionRow0;
|
|
public static Vector4 ObservedProjectionRow1;
|
|
public static Vector4 ObservedProjectionRow2;
|
|
public static Vector4 ObservedProjectionRow3;
|
|
public static Vector4 ObservedViewProjectionRow0;
|
|
public static Vector4 ObservedViewProjectionRow1;
|
|
public static Vector4 ObservedViewProjectionRow2;
|
|
public static Vector4 ObservedViewProjectionRow3;
|
|
public static Vector3 ObservedWorldPosition;
|
|
public static Vector4 ObservedClearColor;
|
|
public static int ObservedClearFlags;
|
|
public static bool ObservedPerspectiveProjection;
|
|
public static float ObservedVerticalFovRadians;
|
|
public static float ObservedOrthographicSize;
|
|
public static float ObservedAspectRatio;
|
|
public static float ObservedNearClipPlane;
|
|
public static float ObservedFarClipPlane;
|
|
public static int ObservedViewportWidth;
|
|
public static int ObservedViewportHeight;
|
|
public static bool ObservedMainDirectionalLightEnabled;
|
|
public static bool ObservedMainDirectionalLightCastsShadows;
|
|
public static Vector3 ObservedMainDirectionalLightDirection;
|
|
public static Vector4 ObservedMainDirectionalLightColor;
|
|
public static float ObservedMainDirectionalLightIntensity;
|
|
public static bool ObservedHasMainDirectionalShadow;
|
|
public static int ObservedAdditionalLightCount;
|
|
public static bool ObservedShadowEnabled;
|
|
public static Vector4 ObservedShadowViewProjectionRow0;
|
|
public static Vector4 ObservedShadowViewProjectionRow1;
|
|
public static Vector4 ObservedShadowViewProjectionRow2;
|
|
public static Vector4 ObservedShadowViewProjectionRow3;
|
|
public static float ObservedShadowOrthographicHalfExtent;
|
|
public static float ObservedShadowNearClipPlane;
|
|
public static float ObservedShadowFarClipPlane;
|
|
public static int ObservedShadowMapWidth;
|
|
public static int ObservedShadowMapHeight;
|
|
public static float ObservedShadowWorldTexelSize;
|
|
public static float ObservedShadowReceiverDepthBias;
|
|
public static float ObservedShadowNormalBiasScale;
|
|
public static float ObservedShadowStrength;
|
|
public static float ObservedShadowDepthBiasFactor;
|
|
public static int ObservedShadowDepthBiasUnits;
|
|
public static int ObservedEnvironmentMode;
|
|
public static Vector4 ObservedSkyboxTopColor;
|
|
public static Vector4 ObservedSkyboxHorizonColor;
|
|
public static Vector4 ObservedSkyboxBottomColor;
|
|
public static int ObservedFinalColorOutputTransferMode;
|
|
public static int ObservedFinalColorExposureMode;
|
|
public static float ObservedFinalColorExposureValue;
|
|
public static int ObservedFinalColorToneMappingMode;
|
|
public static Vector4 ObservedFinalColorScale;
|
|
public static bool ObservedFinalColorHasPipelineDefaults;
|
|
public static bool ObservedFinalColorHasCameraOverrides;
|
|
public static bool ObservedFinalColorRequiresProcessing;
|
|
public static int RecordCallCount;
|
|
|
|
public CameraDataObservationPass()
|
|
{
|
|
renderPassEvent = RenderPassEvent.RenderOpaques;
|
|
}
|
|
|
|
public static void Reset()
|
|
{
|
|
ObservedViewRow0 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewRow1 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewRow2 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewRow3 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedProjectionRow0 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedProjectionRow1 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedProjectionRow2 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedProjectionRow3 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewProjectionRow0 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewProjectionRow1 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewProjectionRow2 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedViewProjectionRow3 = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedWorldPosition = new Vector3(0.0f, 0.0f, 0.0f);
|
|
ObservedClearColor = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedClearFlags = 0;
|
|
ObservedPerspectiveProjection = true;
|
|
ObservedVerticalFovRadians = 0.0f;
|
|
ObservedOrthographicSize = 0.0f;
|
|
ObservedAspectRatio = 0.0f;
|
|
ObservedNearClipPlane = 0.0f;
|
|
ObservedFarClipPlane = 0.0f;
|
|
ObservedViewportWidth = 0;
|
|
ObservedViewportHeight = 0;
|
|
ObservedMainDirectionalLightEnabled = false;
|
|
ObservedMainDirectionalLightCastsShadows = false;
|
|
ObservedMainDirectionalLightDirection =
|
|
new Vector3(0.0f, 0.0f, 0.0f);
|
|
ObservedMainDirectionalLightColor =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedMainDirectionalLightIntensity = 0.0f;
|
|
ObservedHasMainDirectionalShadow = false;
|
|
ObservedAdditionalLightCount = 0;
|
|
ObservedShadowEnabled = false;
|
|
ObservedShadowViewProjectionRow0 =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedShadowViewProjectionRow1 =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedShadowViewProjectionRow2 =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedShadowViewProjectionRow3 =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedShadowOrthographicHalfExtent = 0.0f;
|
|
ObservedShadowNearClipPlane = 0.0f;
|
|
ObservedShadowFarClipPlane = 0.0f;
|
|
ObservedShadowMapWidth = 0;
|
|
ObservedShadowMapHeight = 0;
|
|
ObservedShadowWorldTexelSize = 0.0f;
|
|
ObservedShadowReceiverDepthBias = 0.0f;
|
|
ObservedShadowNormalBiasScale = 0.0f;
|
|
ObservedShadowStrength = 0.0f;
|
|
ObservedShadowDepthBiasFactor = 0.0f;
|
|
ObservedShadowDepthBiasUnits = 0;
|
|
ObservedEnvironmentMode = 0;
|
|
ObservedSkyboxTopColor =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedSkyboxHorizonColor =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedSkyboxBottomColor =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedFinalColorOutputTransferMode = 0;
|
|
ObservedFinalColorExposureMode = 0;
|
|
ObservedFinalColorExposureValue = 0.0f;
|
|
ObservedFinalColorToneMappingMode = 0;
|
|
ObservedFinalColorScale =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
ObservedFinalColorHasPipelineDefaults = false;
|
|
ObservedFinalColorHasCameraOverrides = false;
|
|
ObservedFinalColorRequiresProcessing = false;
|
|
RecordCallCount = 0;
|
|
}
|
|
|
|
protected override bool RecordRenderGraph(
|
|
RendererRecordingContext context,
|
|
RenderingData renderingData)
|
|
{
|
|
if (context == null ||
|
|
renderingData == null ||
|
|
!renderingData.isMainSceneStage)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
CameraData cameraData = renderingData.cameraData;
|
|
LightingData lightingData = renderingData.lightingData;
|
|
ShadowData shadowData = renderingData.shadowData;
|
|
EnvironmentData environmentData =
|
|
renderingData.environmentData;
|
|
FinalColorData finalColorData =
|
|
renderingData.finalColorData;
|
|
if (cameraData == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
ObservedViewRow0 = cameraData.view.GetRow(0);
|
|
ObservedViewRow1 = cameraData.view.GetRow(1);
|
|
ObservedViewRow2 = cameraData.view.GetRow(2);
|
|
ObservedViewRow3 = cameraData.view.GetRow(3);
|
|
ObservedProjectionRow0 =
|
|
cameraData.projection.GetRow(0);
|
|
ObservedProjectionRow1 =
|
|
cameraData.projection.GetRow(1);
|
|
ObservedProjectionRow2 =
|
|
cameraData.projection.GetRow(2);
|
|
ObservedProjectionRow3 =
|
|
cameraData.projection.GetRow(3);
|
|
ObservedViewProjectionRow0 =
|
|
cameraData.viewProjection.GetRow(0);
|
|
ObservedViewProjectionRow1 =
|
|
cameraData.viewProjection.GetRow(1);
|
|
ObservedViewProjectionRow2 =
|
|
cameraData.viewProjection.GetRow(2);
|
|
ObservedViewProjectionRow3 =
|
|
cameraData.viewProjection.GetRow(3);
|
|
ObservedWorldPosition = cameraData.worldPosition;
|
|
ObservedClearColor = new Vector4(
|
|
cameraData.clearColor.r,
|
|
cameraData.clearColor.g,
|
|
cameraData.clearColor.b,
|
|
cameraData.clearColor.a);
|
|
ObservedClearFlags = (int)cameraData.clearFlags;
|
|
ObservedPerspectiveProjection =
|
|
cameraData.perspectiveProjection;
|
|
ObservedVerticalFovRadians =
|
|
cameraData.verticalFovRadians;
|
|
ObservedOrthographicSize =
|
|
cameraData.orthographicSize;
|
|
ObservedAspectRatio =
|
|
cameraData.aspectRatio;
|
|
ObservedNearClipPlane =
|
|
cameraData.nearClipPlane;
|
|
ObservedFarClipPlane =
|
|
cameraData.farClipPlane;
|
|
ObservedViewportWidth =
|
|
cameraData.viewportWidth;
|
|
ObservedViewportHeight =
|
|
cameraData.viewportHeight;
|
|
if (lightingData != null &&
|
|
lightingData.mainDirectionalLight != null)
|
|
{
|
|
ObservedMainDirectionalLightEnabled =
|
|
lightingData.mainDirectionalLight.enabled;
|
|
ObservedMainDirectionalLightCastsShadows =
|
|
lightingData.mainDirectionalLight.castsShadows;
|
|
ObservedMainDirectionalLightDirection =
|
|
lightingData.mainDirectionalLight.direction;
|
|
ObservedMainDirectionalLightColor = new Vector4(
|
|
lightingData.mainDirectionalLight.color.r,
|
|
lightingData.mainDirectionalLight.color.g,
|
|
lightingData.mainDirectionalLight.color.b,
|
|
lightingData.mainDirectionalLight.color.a);
|
|
ObservedMainDirectionalLightIntensity =
|
|
lightingData.mainDirectionalLight.intensity;
|
|
ObservedHasMainDirectionalShadow =
|
|
lightingData.hasMainDirectionalShadow;
|
|
ObservedAdditionalLightCount =
|
|
lightingData.additionalLightCount;
|
|
}
|
|
if (shadowData != null &&
|
|
shadowData.mainDirectionalShadow != null)
|
|
{
|
|
DirectionalShadowData mainDirectionalShadow =
|
|
shadowData.mainDirectionalShadow;
|
|
ObservedShadowEnabled =
|
|
mainDirectionalShadow.enabled;
|
|
ObservedShadowViewProjectionRow0 =
|
|
mainDirectionalShadow.viewProjection.GetRow(0);
|
|
ObservedShadowViewProjectionRow1 =
|
|
mainDirectionalShadow.viewProjection.GetRow(1);
|
|
ObservedShadowViewProjectionRow2 =
|
|
mainDirectionalShadow.viewProjection.GetRow(2);
|
|
ObservedShadowViewProjectionRow3 =
|
|
mainDirectionalShadow.viewProjection.GetRow(3);
|
|
ObservedShadowOrthographicHalfExtent =
|
|
mainDirectionalShadow.orthographicHalfExtent;
|
|
ObservedShadowNearClipPlane =
|
|
mainDirectionalShadow.nearClipPlane;
|
|
ObservedShadowFarClipPlane =
|
|
mainDirectionalShadow.farClipPlane;
|
|
ObservedShadowMapWidth =
|
|
mainDirectionalShadow.mapWidth;
|
|
ObservedShadowMapHeight =
|
|
mainDirectionalShadow.mapHeight;
|
|
ObservedShadowWorldTexelSize =
|
|
mainDirectionalShadow.worldTexelSize;
|
|
ObservedShadowReceiverDepthBias =
|
|
mainDirectionalShadow.receiverDepthBias;
|
|
ObservedShadowNormalBiasScale =
|
|
mainDirectionalShadow.normalBiasScale;
|
|
ObservedShadowStrength =
|
|
mainDirectionalShadow.shadowStrength;
|
|
ObservedShadowDepthBiasFactor =
|
|
mainDirectionalShadow.depthBiasFactor;
|
|
ObservedShadowDepthBiasUnits =
|
|
mainDirectionalShadow.depthBiasUnits;
|
|
}
|
|
if (environmentData != null)
|
|
{
|
|
ObservedEnvironmentMode =
|
|
(int)environmentData.mode;
|
|
ObservedSkyboxTopColor = new Vector4(
|
|
environmentData.skyboxTopColor.r,
|
|
environmentData.skyboxTopColor.g,
|
|
environmentData.skyboxTopColor.b,
|
|
environmentData.skyboxTopColor.a);
|
|
ObservedSkyboxHorizonColor = new Vector4(
|
|
environmentData.skyboxHorizonColor.r,
|
|
environmentData.skyboxHorizonColor.g,
|
|
environmentData.skyboxHorizonColor.b,
|
|
environmentData.skyboxHorizonColor.a);
|
|
ObservedSkyboxBottomColor = new Vector4(
|
|
environmentData.skyboxBottomColor.r,
|
|
environmentData.skyboxBottomColor.g,
|
|
environmentData.skyboxBottomColor.b,
|
|
environmentData.skyboxBottomColor.a);
|
|
}
|
|
if (finalColorData != null)
|
|
{
|
|
ObservedFinalColorOutputTransferMode =
|
|
(int)finalColorData.settings.outputTransferMode;
|
|
ObservedFinalColorExposureMode =
|
|
(int)finalColorData.settings.exposureMode;
|
|
ObservedFinalColorExposureValue =
|
|
finalColorData.settings.exposureValue;
|
|
ObservedFinalColorToneMappingMode =
|
|
(int)finalColorData.settings.toneMappingMode;
|
|
ObservedFinalColorScale =
|
|
finalColorData.settings.finalColorScale;
|
|
ObservedFinalColorHasPipelineDefaults =
|
|
finalColorData.hasPipelineDefaults;
|
|
ObservedFinalColorHasCameraOverrides =
|
|
finalColorData.hasCameraOverrides;
|
|
ObservedFinalColorRequiresProcessing =
|
|
finalColorData.requiresProcessing;
|
|
}
|
|
RecordCallCount++;
|
|
return context.RecordScene();
|
|
}
|
|
}
|
|
|
|
internal sealed class CameraDataObservationFeature
|
|
: ScriptableRendererFeature
|
|
{
|
|
private readonly CameraDataObservationPass m_pass =
|
|
new CameraDataObservationPass();
|
|
|
|
public override void AddRenderPasses(
|
|
ScriptableRenderer renderer,
|
|
RenderingData renderingData)
|
|
{
|
|
if (renderer == null ||
|
|
renderingData == null ||
|
|
!renderingData.isMainSceneStage)
|
|
{
|
|
return;
|
|
}
|
|
|
|
renderer.EnqueuePass(m_pass);
|
|
}
|
|
}
|
|
|
|
internal sealed class CameraDataObservationRenderer
|
|
: ScriptableRenderer
|
|
{
|
|
public CameraDataObservationRenderer()
|
|
{
|
|
AddFeature(new CameraDataObservationFeature());
|
|
}
|
|
}
|
|
|
|
internal sealed class StageColorObservationPass
|
|
: ScriptableRenderPass
|
|
{
|
|
public static int ObservedMainSceneSource;
|
|
public static bool ObservedMainSceneUsesGraphManagedOutputColor;
|
|
public static int ObservedPostProcessSource;
|
|
public static bool ObservedPostProcessUsesGraphManagedOutputColor;
|
|
public static int ObservedFinalOutputSource;
|
|
public static bool ObservedFinalOutputUsesGraphManagedOutputColor;
|
|
public static int MainSceneRecordCallCount;
|
|
public static int PostProcessRecordCallCount;
|
|
public static int FinalOutputRecordCallCount;
|
|
|
|
public StageColorObservationPass(
|
|
RenderPassEvent passEvent)
|
|
{
|
|
renderPassEvent = passEvent;
|
|
}
|
|
|
|
public static void Reset()
|
|
{
|
|
ObservedMainSceneSource = 0;
|
|
ObservedMainSceneUsesGraphManagedOutputColor = false;
|
|
ObservedPostProcessSource = 0;
|
|
ObservedPostProcessUsesGraphManagedOutputColor = false;
|
|
ObservedFinalOutputSource = 0;
|
|
ObservedFinalOutputUsesGraphManagedOutputColor = false;
|
|
MainSceneRecordCallCount = 0;
|
|
PostProcessRecordCallCount = 0;
|
|
FinalOutputRecordCallCount = 0;
|
|
}
|
|
|
|
protected override bool RecordRenderGraph(
|
|
RendererRecordingContext context,
|
|
RenderingData renderingData)
|
|
{
|
|
if (context == null ||
|
|
renderingData == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
StageColorData stageColorData =
|
|
renderingData.stageColorData;
|
|
if (stageColorData == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (renderingData.isMainSceneStage)
|
|
{
|
|
ObservedMainSceneSource =
|
|
(int)stageColorData.source;
|
|
ObservedMainSceneUsesGraphManagedOutputColor =
|
|
stageColorData.usesGraphManagedOutputColor;
|
|
MainSceneRecordCallCount++;
|
|
return true;
|
|
}
|
|
|
|
if (renderingData.isPostProcessStage)
|
|
{
|
|
ObservedPostProcessSource =
|
|
(int)stageColorData.source;
|
|
ObservedPostProcessUsesGraphManagedOutputColor =
|
|
stageColorData.usesGraphManagedOutputColor;
|
|
PostProcessRecordCallCount++;
|
|
return true;
|
|
}
|
|
|
|
if (renderingData.isFinalOutputStage)
|
|
{
|
|
ObservedFinalOutputSource =
|
|
(int)stageColorData.source;
|
|
ObservedFinalOutputUsesGraphManagedOutputColor =
|
|
stageColorData.usesGraphManagedOutputColor;
|
|
FinalOutputRecordCallCount++;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
internal sealed class StageColorObservationRenderer
|
|
: ScriptableRenderer
|
|
{
|
|
public StageColorObservationRenderer()
|
|
{
|
|
AddFeature(
|
|
new FullscreenFeature(
|
|
new StageColorObservationPass(
|
|
RenderPassEvent.RenderOpaques),
|
|
new StageColorObservationPass(
|
|
RenderPassEvent.BeforeRenderingPostProcessing),
|
|
new StageColorObservationPass(
|
|
RenderPassEvent.BeforeRenderingFinalOutput)));
|
|
}
|
|
}
|
|
|
|
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 ManagedForwardRenderPipelineProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
public static int CreatePipelineCallCount;
|
|
public Vector4 postProcessScale = new Vector4(1.03f, 0.98f, 0.94f, 1.0f);
|
|
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
CreatePipelineCallCount++;
|
|
return new ManagedForwardRenderPipelineProbe(
|
|
postProcessScale);
|
|
}
|
|
|
|
protected override void ConfigureCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context)
|
|
{
|
|
context.ClearFullscreenStage(CameraFrameStage.PostProcess);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.PostProcess,
|
|
CameraFrameColorSource.MainSceneColor,
|
|
false);
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPlannedFullscreenRenderPipelineProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedPlannedFullscreenRenderPipelineProbe();
|
|
}
|
|
|
|
protected override void ConfigureCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context)
|
|
{
|
|
context.ClearFullscreenStage(CameraFrameStage.PostProcess);
|
|
context.ClearFullscreenStage(CameraFrameStage.FinalOutput);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.PostProcess,
|
|
CameraFrameColorSource.MainSceneColor,
|
|
true);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.FinalOutput,
|
|
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 ManagedRenderContextCameraDataProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedRenderContextCameraDataProbe();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedFinalColorRenderPipelineProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedRenderPipelineProbe();
|
|
}
|
|
|
|
protected override FinalColorSettings GetDefaultFinalColorSettings()
|
|
{
|
|
return ProbeFinalColorSettingsFactory.Create();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextFinalColorDataProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedRenderContextCameraDataProbe();
|
|
}
|
|
|
|
protected override FinalColorSettings GetDefaultFinalColorSettings()
|
|
{
|
|
return ProbeFinalColorSettingsFactory.Create();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextStageColorDataProbeAsset
|
|
: ScriptableRenderPipelineAsset
|
|
{
|
|
protected override ScriptableRenderPipeline CreatePipeline()
|
|
{
|
|
return new ManagedRenderContextStageColorDataProbe();
|
|
}
|
|
|
|
protected override void ConfigureCameraFramePlan(
|
|
ScriptableRenderPipelinePlanningContext context)
|
|
{
|
|
context.ClearFullscreenStage(CameraFrameStage.PostProcess);
|
|
context.ClearFullscreenStage(CameraFrameStage.FinalOutput);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.PostProcess,
|
|
CameraFrameColorSource.MainSceneColor,
|
|
true);
|
|
context.RequestFullscreenStage(
|
|
CameraFrameStage.FinalOutput,
|
|
CameraFrameColorSource.PostProcessColor);
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderPipelineProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
public static int SupportsStageCallCount;
|
|
public static int RecordStageCallCount;
|
|
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new ProbeSceneRenderer();
|
|
}
|
|
|
|
protected override bool SupportsStageRenderGraph(
|
|
CameraFrameStage stage)
|
|
{
|
|
SupportsStageCallCount++;
|
|
return base.SupportsStageRenderGraph(stage);
|
|
}
|
|
|
|
protected override bool RecordStageRenderGraph(
|
|
ScriptableRenderContext context)
|
|
{
|
|
RecordStageCallCount++;
|
|
return base.RecordStageRenderGraph(context);
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPostProcessRenderPipelineProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new ProbePostProcessRenderer(
|
|
new Vector4(1.10f, 0.95f, 0.90f, 1.0f),
|
|
new Vector4(0.95f, 1.05f, 1.10f, 1.0f));
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedForwardRenderPipelineProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
public static int SupportsMainSceneCallCount;
|
|
public static int SupportsPostProcessCallCount;
|
|
public static int RecordMainSceneCallCount;
|
|
public static int RecordSceneCallCount;
|
|
public static int RecordPostProcessCallCount;
|
|
public static Vector4 LastPostProcessScale;
|
|
|
|
private readonly Vector4 m_postProcessScale;
|
|
|
|
public ManagedForwardRenderPipelineProbe(
|
|
Vector4 postProcessScale)
|
|
{
|
|
m_postProcessScale = postProcessScale;
|
|
}
|
|
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new ProbeForwardRenderer(
|
|
m_postProcessScale,
|
|
OnOpaqueRecorded);
|
|
}
|
|
|
|
protected override bool SupportsStageRenderGraph(
|
|
CameraFrameStage stage)
|
|
{
|
|
if (stage == CameraFrameStage.MainScene)
|
|
{
|
|
SupportsMainSceneCallCount++;
|
|
}
|
|
else if (stage == CameraFrameStage.PostProcess)
|
|
{
|
|
SupportsPostProcessCallCount++;
|
|
}
|
|
|
|
return base.SupportsStageRenderGraph(stage);
|
|
}
|
|
|
|
protected override bool RecordStageRenderGraph(
|
|
ScriptableRenderContext context)
|
|
{
|
|
if (context == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (context.stage == CameraFrameStage.MainScene)
|
|
{
|
|
RecordMainSceneCallCount++;
|
|
}
|
|
else if (context.stage == CameraFrameStage.PostProcess)
|
|
{
|
|
RecordPostProcessCallCount++;
|
|
LastPostProcessScale = m_postProcessScale;
|
|
}
|
|
|
|
return base.RecordStageRenderGraph(context);
|
|
}
|
|
|
|
private void OnOpaqueRecorded()
|
|
{
|
|
RecordSceneCallCount++;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedPlannedFullscreenRenderPipelineProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new ProbePlannedFullscreenRenderer();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextCameraDataProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new CameraDataObservationRenderer();
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextStageColorDataProbe
|
|
: RendererBackedRenderPipeline
|
|
{
|
|
protected override ScriptableRenderer CreateRenderer()
|
|
{
|
|
return new StageColorObservationRenderer();
|
|
}
|
|
}
|
|
|
|
public sealed class RenderPipelineApiProbe : MonoBehaviour
|
|
{
|
|
public bool InitialAssetWasNull;
|
|
public bool SelectionRoundTripSucceeded;
|
|
public bool SelectionReferencePreserved;
|
|
public string SelectedPipelineAssetTypeName = string.Empty;
|
|
|
|
public void Start()
|
|
{
|
|
InitialAssetWasNull = GraphicsSettings.renderPipelineAsset == null;
|
|
|
|
RenderPipelineApiProbeAsset selectedAssetInstance =
|
|
new RenderPipelineApiProbeAsset();
|
|
GraphicsSettings.renderPipelineAsset = selectedAssetInstance;
|
|
ScriptableRenderPipelineAsset selectedAsset =
|
|
GraphicsSettings.renderPipelineAsset;
|
|
SelectionRoundTripSucceeded =
|
|
selectedAsset is RenderPipelineApiProbeAsset;
|
|
SelectionReferencePreserved =
|
|
object.ReferenceEquals(
|
|
selectedAsset,
|
|
selectedAssetInstance);
|
|
SelectedPipelineAssetTypeName = selectedAsset != null
|
|
? selectedAsset.GetType().FullName ?? string.Empty
|
|
: string.Empty;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderPipelineRuntimeSelectionProbe : MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
ManagedRenderPipelineProbeAsset.CreatePipelineCallCount = 0;
|
|
ManagedRenderPipelineProbe.SupportsStageCallCount = 0;
|
|
ManagedRenderPipelineProbe.RecordStageCallCount = 0;
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderPipelineProbeAsset();
|
|
}
|
|
}
|
|
|
|
public sealed class ScriptCoreForwardRenderPipelineSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public bool SelectionRoundTripSucceeded;
|
|
public string SelectedPipelineAssetTypeName = string.Empty;
|
|
public string SelectedRendererDataTypeName = string.Empty;
|
|
|
|
public void Start()
|
|
{
|
|
ForwardRenderPipelineAsset asset =
|
|
new ForwardRenderPipelineAsset
|
|
{
|
|
rendererData = new ForwardRendererData()
|
|
};
|
|
GraphicsSettings.renderPipelineAsset = asset;
|
|
|
|
ForwardRenderPipelineAsset selectedAsset =
|
|
GraphicsSettings.renderPipelineAsset as ForwardRenderPipelineAsset;
|
|
SelectionRoundTripSucceeded =
|
|
selectedAsset != null;
|
|
SelectedPipelineAssetTypeName =
|
|
selectedAsset != null
|
|
? selectedAsset.GetType().FullName ?? string.Empty
|
|
: string.Empty;
|
|
SelectedRendererDataTypeName =
|
|
selectedAsset != null &&
|
|
selectedAsset.rendererData != null
|
|
? selectedAsset.rendererData.GetType().FullName ?? string.Empty
|
|
: string.Empty;
|
|
}
|
|
}
|
|
|
|
public sealed class ScriptCoreForwardRenderPipelineRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ForwardRenderPipelineAsset
|
|
{
|
|
rendererData = new ForwardRendererData()
|
|
};
|
|
}
|
|
}
|
|
|
|
public sealed class ScriptCoreConfiguredForwardRenderPipelineRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ForwardRenderPipelineAsset
|
|
{
|
|
rendererData = new ForwardRendererData
|
|
{
|
|
renderOpaque = true,
|
|
renderSkybox = false,
|
|
renderTransparent = false
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
public sealed class ScriptCoreForwardPostProcessRendererFeatureRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ForwardRenderPipelineAsset
|
|
{
|
|
rendererData = new ForwardRendererData
|
|
{
|
|
rendererFeatures =
|
|
new ScriptableRendererFeature[]
|
|
{
|
|
new ColorScalePostProcessRendererFeature
|
|
{
|
|
colorScale = new Vector4(
|
|
1.08f,
|
|
0.96f,
|
|
0.92f,
|
|
1.0f)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
public sealed class ScriptCoreForwardShadowlessRendererFeatureRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public void Start()
|
|
{
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ForwardRenderPipelineAsset
|
|
{
|
|
rendererData = new ForwardRendererData
|
|
{
|
|
rendererFeatures =
|
|
new ScriptableRendererFeature[]
|
|
{
|
|
new DisableDirectionalShadowRendererFeature()
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
public sealed class ProjectConfiguredRenderPipelineGetterProbe
|
|
: MonoBehaviour
|
|
{
|
|
public bool ObservedAssetWasNull = true;
|
|
public string ObservedPipelineAssetTypeName = string.Empty;
|
|
|
|
public void Start()
|
|
{
|
|
ScriptableRenderPipelineAsset asset =
|
|
GraphicsSettings.renderPipelineAsset;
|
|
ObservedAssetWasNull = asset == null;
|
|
ObservedPipelineAssetTypeName = asset != null
|
|
? asset.GetType().FullName ?? string.Empty
|
|
: string.Empty;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedForwardRenderPipelineRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public int ObservedCreatePipelineCallCount;
|
|
public int ObservedSupportsMainSceneCallCount;
|
|
public int ObservedSupportsPostProcessCallCount;
|
|
public int ObservedRecordMainSceneCallCount;
|
|
public int ObservedRecordSceneCallCount;
|
|
public int ObservedRecordPostProcessCallCount;
|
|
public Vector4 ObservedPostProcessScale;
|
|
|
|
public void Start()
|
|
{
|
|
ManagedForwardRenderPipelineProbeAsset.CreatePipelineCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.SupportsMainSceneCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.SupportsPostProcessCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.RecordMainSceneCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.RecordSceneCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.RecordPostProcessCallCount = 0;
|
|
ManagedForwardRenderPipelineProbe.LastPostProcessScale =
|
|
new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedForwardRenderPipelineProbeAsset
|
|
{
|
|
postProcessScale = new Vector4(1.11f, 0.97f, 0.93f, 1.0f)
|
|
};
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedCreatePipelineCallCount =
|
|
ManagedForwardRenderPipelineProbeAsset.CreatePipelineCallCount;
|
|
ObservedSupportsMainSceneCallCount =
|
|
ManagedForwardRenderPipelineProbe.SupportsMainSceneCallCount;
|
|
ObservedSupportsPostProcessCallCount =
|
|
ManagedForwardRenderPipelineProbe.SupportsPostProcessCallCount;
|
|
ObservedRecordMainSceneCallCount =
|
|
ManagedForwardRenderPipelineProbe.RecordMainSceneCallCount;
|
|
ObservedRecordSceneCallCount =
|
|
ManagedForwardRenderPipelineProbe.RecordSceneCallCount;
|
|
ObservedRecordPostProcessCallCount =
|
|
ManagedForwardRenderPipelineProbe.RecordPostProcessCallCount;
|
|
ObservedPostProcessScale =
|
|
ManagedForwardRenderPipelineProbe.LastPostProcessScale;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextCameraDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public Vector4 ObservedViewRow0;
|
|
public Vector4 ObservedViewRow1;
|
|
public Vector4 ObservedViewRow2;
|
|
public Vector4 ObservedViewRow3;
|
|
public Vector4 ObservedProjectionRow0;
|
|
public Vector4 ObservedProjectionRow1;
|
|
public Vector4 ObservedProjectionRow2;
|
|
public Vector4 ObservedProjectionRow3;
|
|
public Vector4 ObservedViewProjectionRow0;
|
|
public Vector4 ObservedViewProjectionRow1;
|
|
public Vector4 ObservedViewProjectionRow2;
|
|
public Vector4 ObservedViewProjectionRow3;
|
|
public Vector3 ObservedWorldPosition;
|
|
public Vector4 ObservedClearColor;
|
|
public int ObservedClearFlags;
|
|
public bool ObservedPerspectiveProjection;
|
|
public float ObservedVerticalFovRadians;
|
|
public float ObservedOrthographicSize;
|
|
public float ObservedAspectRatio;
|
|
public float ObservedNearClipPlane;
|
|
public float ObservedFarClipPlane;
|
|
public int ObservedViewportWidth;
|
|
public int ObservedViewportHeight;
|
|
public int ObservedRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
CameraDataObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextCameraDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedViewRow0 =
|
|
CameraDataObservationPass.ObservedViewRow0;
|
|
ObservedViewRow1 =
|
|
CameraDataObservationPass.ObservedViewRow1;
|
|
ObservedViewRow2 =
|
|
CameraDataObservationPass.ObservedViewRow2;
|
|
ObservedViewRow3 =
|
|
CameraDataObservationPass.ObservedViewRow3;
|
|
ObservedProjectionRow0 =
|
|
CameraDataObservationPass.ObservedProjectionRow0;
|
|
ObservedProjectionRow1 =
|
|
CameraDataObservationPass.ObservedProjectionRow1;
|
|
ObservedProjectionRow2 =
|
|
CameraDataObservationPass.ObservedProjectionRow2;
|
|
ObservedProjectionRow3 =
|
|
CameraDataObservationPass.ObservedProjectionRow3;
|
|
ObservedViewProjectionRow0 =
|
|
CameraDataObservationPass.ObservedViewProjectionRow0;
|
|
ObservedViewProjectionRow1 =
|
|
CameraDataObservationPass.ObservedViewProjectionRow1;
|
|
ObservedViewProjectionRow2 =
|
|
CameraDataObservationPass.ObservedViewProjectionRow2;
|
|
ObservedViewProjectionRow3 =
|
|
CameraDataObservationPass.ObservedViewProjectionRow3;
|
|
ObservedWorldPosition =
|
|
CameraDataObservationPass.ObservedWorldPosition;
|
|
ObservedClearColor =
|
|
CameraDataObservationPass.ObservedClearColor;
|
|
ObservedClearFlags =
|
|
CameraDataObservationPass.ObservedClearFlags;
|
|
ObservedPerspectiveProjection =
|
|
CameraDataObservationPass.ObservedPerspectiveProjection;
|
|
ObservedVerticalFovRadians =
|
|
CameraDataObservationPass.ObservedVerticalFovRadians;
|
|
ObservedOrthographicSize =
|
|
CameraDataObservationPass.ObservedOrthographicSize;
|
|
ObservedAspectRatio =
|
|
CameraDataObservationPass.ObservedAspectRatio;
|
|
ObservedNearClipPlane =
|
|
CameraDataObservationPass.ObservedNearClipPlane;
|
|
ObservedFarClipPlane =
|
|
CameraDataObservationPass.ObservedFarClipPlane;
|
|
ObservedViewportWidth =
|
|
CameraDataObservationPass.ObservedViewportWidth;
|
|
ObservedViewportHeight =
|
|
CameraDataObservationPass.ObservedViewportHeight;
|
|
ObservedRecordCallCount =
|
|
CameraDataObservationPass.RecordCallCount;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextLightingDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public bool ObservedMainDirectionalLightEnabled;
|
|
public bool ObservedMainDirectionalLightCastsShadows;
|
|
public Vector3 ObservedMainDirectionalLightDirection;
|
|
public Vector4 ObservedMainDirectionalLightColor;
|
|
public float ObservedMainDirectionalLightIntensity;
|
|
public bool ObservedHasMainDirectionalShadow;
|
|
public int ObservedAdditionalLightCount;
|
|
public int ObservedRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
CameraDataObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextCameraDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedMainDirectionalLightEnabled =
|
|
CameraDataObservationPass
|
|
.ObservedMainDirectionalLightEnabled;
|
|
ObservedMainDirectionalLightCastsShadows =
|
|
CameraDataObservationPass
|
|
.ObservedMainDirectionalLightCastsShadows;
|
|
ObservedMainDirectionalLightDirection =
|
|
CameraDataObservationPass
|
|
.ObservedMainDirectionalLightDirection;
|
|
ObservedMainDirectionalLightColor =
|
|
CameraDataObservationPass
|
|
.ObservedMainDirectionalLightColor;
|
|
ObservedMainDirectionalLightIntensity =
|
|
CameraDataObservationPass
|
|
.ObservedMainDirectionalLightIntensity;
|
|
ObservedHasMainDirectionalShadow =
|
|
CameraDataObservationPass
|
|
.ObservedHasMainDirectionalShadow;
|
|
ObservedAdditionalLightCount =
|
|
CameraDataObservationPass
|
|
.ObservedAdditionalLightCount;
|
|
ObservedRecordCallCount =
|
|
CameraDataObservationPass.RecordCallCount;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextEnvironmentDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public int ObservedEnvironmentMode;
|
|
public Vector4 ObservedSkyboxTopColor;
|
|
public Vector4 ObservedSkyboxHorizonColor;
|
|
public Vector4 ObservedSkyboxBottomColor;
|
|
public int ObservedRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
CameraDataObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextCameraDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedEnvironmentMode =
|
|
CameraDataObservationPass.ObservedEnvironmentMode;
|
|
ObservedSkyboxTopColor =
|
|
CameraDataObservationPass.ObservedSkyboxTopColor;
|
|
ObservedSkyboxHorizonColor =
|
|
CameraDataObservationPass.ObservedSkyboxHorizonColor;
|
|
ObservedSkyboxBottomColor =
|
|
CameraDataObservationPass.ObservedSkyboxBottomColor;
|
|
ObservedRecordCallCount =
|
|
CameraDataObservationPass.RecordCallCount;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextShadowDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public bool ObservedShadowEnabled;
|
|
public Vector4 ObservedShadowViewProjectionRow0;
|
|
public Vector4 ObservedShadowViewProjectionRow1;
|
|
public Vector4 ObservedShadowViewProjectionRow2;
|
|
public Vector4 ObservedShadowViewProjectionRow3;
|
|
public float ObservedShadowOrthographicHalfExtent;
|
|
public float ObservedShadowNearClipPlane;
|
|
public float ObservedShadowFarClipPlane;
|
|
public int ObservedShadowMapWidth;
|
|
public int ObservedShadowMapHeight;
|
|
public float ObservedShadowWorldTexelSize;
|
|
public float ObservedShadowReceiverDepthBias;
|
|
public float ObservedShadowNormalBiasScale;
|
|
public float ObservedShadowStrength;
|
|
public float ObservedShadowDepthBiasFactor;
|
|
public int ObservedShadowDepthBiasUnits;
|
|
public int ObservedRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
CameraDataObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextCameraDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedShadowEnabled =
|
|
CameraDataObservationPass.ObservedShadowEnabled;
|
|
ObservedShadowViewProjectionRow0 =
|
|
CameraDataObservationPass
|
|
.ObservedShadowViewProjectionRow0;
|
|
ObservedShadowViewProjectionRow1 =
|
|
CameraDataObservationPass
|
|
.ObservedShadowViewProjectionRow1;
|
|
ObservedShadowViewProjectionRow2 =
|
|
CameraDataObservationPass
|
|
.ObservedShadowViewProjectionRow2;
|
|
ObservedShadowViewProjectionRow3 =
|
|
CameraDataObservationPass
|
|
.ObservedShadowViewProjectionRow3;
|
|
ObservedShadowOrthographicHalfExtent =
|
|
CameraDataObservationPass
|
|
.ObservedShadowOrthographicHalfExtent;
|
|
ObservedShadowNearClipPlane =
|
|
CameraDataObservationPass
|
|
.ObservedShadowNearClipPlane;
|
|
ObservedShadowFarClipPlane =
|
|
CameraDataObservationPass
|
|
.ObservedShadowFarClipPlane;
|
|
ObservedShadowMapWidth =
|
|
CameraDataObservationPass
|
|
.ObservedShadowMapWidth;
|
|
ObservedShadowMapHeight =
|
|
CameraDataObservationPass
|
|
.ObservedShadowMapHeight;
|
|
ObservedShadowWorldTexelSize =
|
|
CameraDataObservationPass
|
|
.ObservedShadowWorldTexelSize;
|
|
ObservedShadowReceiverDepthBias =
|
|
CameraDataObservationPass
|
|
.ObservedShadowReceiverDepthBias;
|
|
ObservedShadowNormalBiasScale =
|
|
CameraDataObservationPass
|
|
.ObservedShadowNormalBiasScale;
|
|
ObservedShadowStrength =
|
|
CameraDataObservationPass
|
|
.ObservedShadowStrength;
|
|
ObservedShadowDepthBiasFactor =
|
|
CameraDataObservationPass
|
|
.ObservedShadowDepthBiasFactor;
|
|
ObservedShadowDepthBiasUnits =
|
|
CameraDataObservationPass
|
|
.ObservedShadowDepthBiasUnits;
|
|
ObservedRecordCallCount =
|
|
CameraDataObservationPass.RecordCallCount;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextFinalColorDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public int ObservedFinalColorOutputTransferMode;
|
|
public int ObservedFinalColorExposureMode;
|
|
public float ObservedFinalColorExposureValue;
|
|
public int ObservedFinalColorToneMappingMode;
|
|
public Vector4 ObservedFinalColorScale;
|
|
public bool ObservedFinalColorHasPipelineDefaults;
|
|
public bool ObservedFinalColorHasCameraOverrides;
|
|
public bool ObservedFinalColorRequiresProcessing;
|
|
public int ObservedRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
CameraDataObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextFinalColorDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedFinalColorOutputTransferMode =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorOutputTransferMode;
|
|
ObservedFinalColorExposureMode =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorExposureMode;
|
|
ObservedFinalColorExposureValue =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorExposureValue;
|
|
ObservedFinalColorToneMappingMode =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorToneMappingMode;
|
|
ObservedFinalColorScale =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorScale;
|
|
ObservedFinalColorHasPipelineDefaults =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorHasPipelineDefaults;
|
|
ObservedFinalColorHasCameraOverrides =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorHasCameraOverrides;
|
|
ObservedFinalColorRequiresProcessing =
|
|
CameraDataObservationPass
|
|
.ObservedFinalColorRequiresProcessing;
|
|
ObservedRecordCallCount =
|
|
CameraDataObservationPass.RecordCallCount;
|
|
}
|
|
}
|
|
|
|
public sealed class ManagedRenderContextStageColorDataRuntimeSelectionProbe
|
|
: MonoBehaviour
|
|
{
|
|
public int ObservedMainSceneSource;
|
|
public bool ObservedMainSceneUsesGraphManagedOutputColor;
|
|
public int ObservedPostProcessSource;
|
|
public bool ObservedPostProcessUsesGraphManagedOutputColor;
|
|
public int ObservedFinalOutputSource;
|
|
public bool ObservedFinalOutputUsesGraphManagedOutputColor;
|
|
public int ObservedMainSceneRecordCallCount;
|
|
public int ObservedPostProcessRecordCallCount;
|
|
public int ObservedFinalOutputRecordCallCount;
|
|
|
|
public void Start()
|
|
{
|
|
StageColorObservationPass.Reset();
|
|
GraphicsSettings.renderPipelineAsset =
|
|
new ManagedRenderContextStageColorDataProbeAsset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
ObservedMainSceneSource =
|
|
StageColorObservationPass.ObservedMainSceneSource;
|
|
ObservedMainSceneUsesGraphManagedOutputColor =
|
|
StageColorObservationPass
|
|
.ObservedMainSceneUsesGraphManagedOutputColor;
|
|
ObservedPostProcessSource =
|
|
StageColorObservationPass.ObservedPostProcessSource;
|
|
ObservedPostProcessUsesGraphManagedOutputColor =
|
|
StageColorObservationPass
|
|
.ObservedPostProcessUsesGraphManagedOutputColor;
|
|
ObservedFinalOutputSource =
|
|
StageColorObservationPass.ObservedFinalOutputSource;
|
|
ObservedFinalOutputUsesGraphManagedOutputColor =
|
|
StageColorObservationPass
|
|
.ObservedFinalOutputUsesGraphManagedOutputColor;
|
|
ObservedMainSceneRecordCallCount =
|
|
StageColorObservationPass.MainSceneRecordCallCount;
|
|
ObservedPostProcessRecordCallCount =
|
|
StageColorObservationPass.PostProcessRecordCallCount;
|
|
ObservedFinalOutputRecordCallCount =
|
|
StageColorObservationPass.FinalOutputRecordCallCount;
|
|
}
|
|
}
|
|
}
|
|
|