feat(rendering): select managed SRP through asset instances
This commit is contained in:
@@ -39,11 +39,13 @@ namespace Gameplay
|
||||
: 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();
|
||||
return new ManagedForwardRenderPipelineProbe(
|
||||
postProcessScale);
|
||||
}
|
||||
|
||||
protected override void ConfigureCameraFramePlan(
|
||||
@@ -188,6 +190,15 @@ namespace Gameplay
|
||||
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 bool SupportsStageRenderGraph(
|
||||
CameraFrameStage stage)
|
||||
@@ -230,9 +241,10 @@ namespace Gameplay
|
||||
if (context.stage == CameraFrameStage.PostProcess)
|
||||
{
|
||||
RecordPostProcessCallCount++;
|
||||
LastPostProcessScale = m_postProcessScale;
|
||||
return context.RecordFullscreenPass(
|
||||
FullscreenPassDescriptor.CreateColorScale(
|
||||
new Vector4(1.03f, 0.98f, 0.94f, 1.0f)));
|
||||
m_postProcessScale));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -263,36 +275,28 @@ namespace Gameplay
|
||||
|
||||
public sealed class RenderPipelineApiProbe : MonoBehaviour
|
||||
{
|
||||
public bool InitialTypeWasNull;
|
||||
public bool InvalidSelectionRejected;
|
||||
public bool InvalidSelectionMentionsScriptableBase;
|
||||
public bool InitialAssetWasNull;
|
||||
public bool SelectionRoundTripSucceeded;
|
||||
public string SelectedPipelineTypeName = string.Empty;
|
||||
public bool SelectionReferencePreserved;
|
||||
public string SelectedPipelineAssetTypeName = string.Empty;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
InitialTypeWasNull = GraphicsSettings.renderPipelineAssetType == null;
|
||||
InitialAssetWasNull = GraphicsSettings.renderPipelineAsset == 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;
|
||||
RenderPipelineApiProbeAsset selectedAssetInstance =
|
||||
new RenderPipelineApiProbeAsset();
|
||||
GraphicsSettings.renderPipelineAsset = selectedAssetInstance;
|
||||
ScriptableRenderPipelineAsset selectedAsset =
|
||||
GraphicsSettings.renderPipelineAsset;
|
||||
SelectionRoundTripSucceeded =
|
||||
selectedType == typeof(RenderPipelineApiProbeAsset);
|
||||
SelectedPipelineTypeName = selectedType != null
|
||||
? selectedType.FullName ?? string.Empty
|
||||
selectedAsset is RenderPipelineApiProbeAsset;
|
||||
SelectionReferencePreserved =
|
||||
object.ReferenceEquals(
|
||||
selectedAsset,
|
||||
selectedAssetInstance);
|
||||
SelectedPipelineAssetTypeName = selectedAsset != null
|
||||
? selectedAsset.GetType().FullName ?? string.Empty
|
||||
: string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -304,8 +308,8 @@ namespace Gameplay
|
||||
ManagedRenderPipelineProbeAsset.CreatePipelineCallCount = 0;
|
||||
ManagedRenderPipelineProbe.SupportsStageCallCount = 0;
|
||||
ManagedRenderPipelineProbe.RecordStageCallCount = 0;
|
||||
GraphicsSettings.renderPipelineAssetType =
|
||||
typeof(ManagedRenderPipelineProbeAsset);
|
||||
GraphicsSettings.renderPipelineAsset =
|
||||
new ManagedRenderPipelineProbeAsset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +322,7 @@ namespace Gameplay
|
||||
public int ObservedRecordMainSceneCallCount;
|
||||
public int ObservedRecordSceneCallCount;
|
||||
public int ObservedRecordPostProcessCallCount;
|
||||
public Vector4 ObservedPostProcessScale;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
@@ -327,8 +332,13 @@ namespace Gameplay
|
||||
ManagedForwardRenderPipelineProbe.RecordMainSceneCallCount = 0;
|
||||
ManagedForwardRenderPipelineProbe.RecordSceneCallCount = 0;
|
||||
ManagedForwardRenderPipelineProbe.RecordPostProcessCallCount = 0;
|
||||
GraphicsSettings.renderPipelineAssetType =
|
||||
typeof(ManagedForwardRenderPipelineProbeAsset);
|
||||
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()
|
||||
@@ -345,6 +355,8 @@ namespace Gameplay
|
||||
ManagedForwardRenderPipelineProbe.RecordSceneCallCount;
|
||||
ObservedRecordPostProcessCallCount =
|
||||
ManagedForwardRenderPipelineProbe.RecordPostProcessCallCount;
|
||||
ObservedPostProcessScale =
|
||||
ManagedForwardRenderPipelineProbe.LastPostProcessScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user