Tighten URP pass queue snapshot ownership
This commit is contained in:
@@ -1687,6 +1687,69 @@ namespace Gameplay
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class ManagedPassQueueSnapshotProbeFeature
|
||||
: ScriptableRendererFeature
|
||||
{
|
||||
private readonly FullscreenPass m_pass =
|
||||
new FullscreenPass(
|
||||
RenderPassEvent.BeforeRenderingPostProcessing,
|
||||
"ManagedPassQueueSnapshot.PostProcess");
|
||||
private ulong m_enqueuedFramePlanId;
|
||||
private bool m_enqueuedForCurrentFramePlan;
|
||||
|
||||
public override void AddRenderPasses(
|
||||
ScriptableRenderer renderer,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
if (renderer == null ||
|
||||
renderingData == null ||
|
||||
!renderingData.isPostProcessStage)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (renderingData.framePlanId == 0UL)
|
||||
{
|
||||
renderer.EnqueuePass(m_pass);
|
||||
return;
|
||||
}
|
||||
|
||||
if (renderingData.framePlanId != m_enqueuedFramePlanId)
|
||||
{
|
||||
m_enqueuedFramePlanId =
|
||||
renderingData.framePlanId;
|
||||
m_enqueuedForCurrentFramePlan = false;
|
||||
}
|
||||
|
||||
if (m_enqueuedForCurrentFramePlan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
renderer.EnqueuePass(m_pass);
|
||||
m_enqueuedForCurrentFramePlan = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class ManagedPassQueueSnapshotProbeRendererData
|
||||
: ProbeRendererData
|
||||
{
|
||||
public ManagedPassQueueSnapshotProbeRendererData()
|
||||
: base(false)
|
||||
{
|
||||
rendererFeatures =
|
||||
ProbeScriptableObjectFactory
|
||||
.CreateRendererFeatureList(
|
||||
ProbeScriptableObjectFactory
|
||||
.Create<ManagedPassQueueSnapshotProbeFeature>());
|
||||
}
|
||||
|
||||
protected override ScriptableRenderer CreateProbeRenderer()
|
||||
{
|
||||
return new ProbeSceneRenderer();
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class ManagedRenderContextCameraDataProbeRendererData
|
||||
: ProbeRendererData
|
||||
{
|
||||
@@ -2287,6 +2350,19 @@ namespace Gameplay
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ManagedPassQueueSnapshotProbeAsset
|
||||
: UniversalRenderPipelineAsset
|
||||
{
|
||||
public ManagedPassQueueSnapshotProbeAsset()
|
||||
{
|
||||
rendererDataList =
|
||||
ProbeScriptableObjectFactory
|
||||
.CreateRendererDataList(
|
||||
ProbeScriptableObjectFactory
|
||||
.Create<ManagedPassQueueSnapshotProbeRendererData>());
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ManagedInvalidFullscreenStagePlanningProbeAsset
|
||||
: UniversalRenderPipelineAsset
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace Gameplay
|
||||
public bool HasPublicContextEnvironmentData;
|
||||
public bool HasPublicContextFinalColorData;
|
||||
public bool HasPublicContextStageColorData;
|
||||
public bool HasPublicContextFramePlanId;
|
||||
public bool HasPublicRequestContextHasDirectionalShadow;
|
||||
public bool HasPublicRequestContextClearDirectionalShadow;
|
||||
public bool HasUniversalContextRecordSceneExtension;
|
||||
@@ -49,8 +50,10 @@ namespace Gameplay
|
||||
public bool HasScriptableObjectCreateInstance;
|
||||
public bool HasRenderPipelineAssetScriptableObjectBase;
|
||||
public bool HasPlanningContextType;
|
||||
public bool HasPublicPlanningContextFramePlanId;
|
||||
public bool HasRendererFeatureConfigureCameraFramePlan;
|
||||
public bool HasRendererRecordingContextType;
|
||||
public bool HasPublicRendererRecordingContextFramePlanId;
|
||||
public bool HasRendererCameraRequestContextType;
|
||||
public bool HasRendererBackedRenderPipelineAssetType;
|
||||
public bool HasRendererBackedRenderPipelineType;
|
||||
@@ -109,6 +112,7 @@ namespace Gameplay
|
||||
public bool HasRenderGraphType;
|
||||
public bool HasRenderGraphAddRasterPass;
|
||||
public bool HasRenderPassPublicRecordRenderGraph;
|
||||
public bool HasPublicRenderingDataFramePlanId;
|
||||
public bool HasRenderPassProtectedRecordColorScaleFullscreenPass;
|
||||
public bool HasRenderPassProtectedRecordShaderVectorFullscreenPass;
|
||||
public bool HasRenderPassProtectedRecordFinalColorFullscreenPass;
|
||||
@@ -172,6 +176,8 @@ namespace Gameplay
|
||||
typeof(ScriptableRenderContext);
|
||||
System.Type requestContextType =
|
||||
typeof(CameraRenderRequestContext);
|
||||
System.Type planningContextType =
|
||||
typeof(ScriptableRenderPipelinePlanningContext);
|
||||
System.Type pipelineAssetType =
|
||||
typeof(ScriptableRenderPipelineAsset);
|
||||
System.Type scriptableObjectType =
|
||||
@@ -187,6 +193,10 @@ namespace Gameplay
|
||||
typeof(ScriptableRendererData);
|
||||
System.Type rendererType =
|
||||
typeof(ScriptableRenderer);
|
||||
System.Type rendererRecordingContextType =
|
||||
typeof(RendererRecordingContext);
|
||||
System.Type renderingDataType =
|
||||
typeof(RenderingData);
|
||||
System.Type renderPassType =
|
||||
typeof(ScriptableRenderPass);
|
||||
System.Type commandBufferType =
|
||||
@@ -334,6 +344,10 @@ namespace Gameplay
|
||||
contextType.GetProperty(
|
||||
"stageColorData",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicContextFramePlanId =
|
||||
contextType.GetProperty(
|
||||
"framePlanId",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicRequestContextHasDirectionalShadow =
|
||||
requestContextType.GetProperty(
|
||||
"hasDirectionalShadow",
|
||||
@@ -400,7 +414,11 @@ namespace Gameplay
|
||||
scriptableObjectType != null &&
|
||||
pipelineAssetType.BaseType == scriptableObjectType;
|
||||
HasPlanningContextType =
|
||||
typeof(ScriptableRenderPipelinePlanningContext) != null;
|
||||
planningContextType != null;
|
||||
HasPublicPlanningContextFramePlanId =
|
||||
planningContextType.GetProperty(
|
||||
"framePlanId",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasRendererFeatureConfigureCameraFramePlan =
|
||||
HasMethod(
|
||||
rendererFeatureType,
|
||||
@@ -409,8 +427,11 @@ namespace Gameplay
|
||||
BindingFlags.Public |
|
||||
BindingFlags.NonPublic);
|
||||
HasRendererRecordingContextType =
|
||||
universalAssembly.GetType(
|
||||
"XCEngine.Rendering.Universal.RendererRecordingContext") != null;
|
||||
rendererRecordingContextType != null;
|
||||
HasPublicRendererRecordingContextFramePlanId =
|
||||
rendererRecordingContextType.GetProperty(
|
||||
"framePlanId",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasRendererCameraRequestContextType =
|
||||
universalAssembly.GetType(
|
||||
"XCEngine.Rendering.Universal.RendererCameraRequestContext") != null;
|
||||
@@ -664,6 +685,10 @@ namespace Gameplay
|
||||
typeof(ContextContainer)
|
||||
},
|
||||
null) != null;
|
||||
HasPublicRenderingDataFramePlanId =
|
||||
renderingDataType.GetProperty(
|
||||
"framePlanId",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasRenderPassProtectedRecordColorScaleFullscreenPass =
|
||||
renderPassType.GetMethod(
|
||||
"RecordColorScaleFullscreenPass",
|
||||
|
||||
Reference in New Issue
Block a user