refactor(srp): align renderer api with unity contexts
This commit is contained in:
@@ -33,18 +33,18 @@ namespace Gameplay
|
||||
|
||||
internal sealed class SceneInjectionPass : ScriptableRenderPass
|
||||
{
|
||||
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
||||
private readonly Func<ScriptableRenderContext, bool> m_recordAction;
|
||||
|
||||
public SceneInjectionPass(
|
||||
RenderPassEvent passEvent,
|
||||
Func<RendererRecordingContext, bool> recordAction)
|
||||
Func<ScriptableRenderContext, bool> recordAction)
|
||||
{
|
||||
renderPassEvent = passEvent;
|
||||
m_recordAction = recordAction;
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
return context != null &&
|
||||
@@ -57,12 +57,12 @@ namespace Gameplay
|
||||
|
||||
internal sealed class ScenePhasePass : ScriptableRenderPass
|
||||
{
|
||||
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
||||
private readonly Func<ScriptableRenderContext, bool> m_recordAction;
|
||||
private readonly Action m_onRecorded;
|
||||
|
||||
public ScenePhasePass(
|
||||
RenderPassEvent passEvent,
|
||||
Func<RendererRecordingContext, bool> recordAction,
|
||||
Func<ScriptableRenderContext, bool> recordAction,
|
||||
Action onRecorded = null)
|
||||
{
|
||||
renderPassEvent = passEvent;
|
||||
@@ -71,7 +71,7 @@ namespace Gameplay
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
bool recorded = context != null &&
|
||||
@@ -90,18 +90,18 @@ namespace Gameplay
|
||||
|
||||
internal sealed class FullscreenPass : ScriptableRenderPass
|
||||
{
|
||||
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
||||
private readonly Func<ScriptableRenderContext, bool> m_recordAction;
|
||||
|
||||
public FullscreenPass(
|
||||
RenderPassEvent passEvent,
|
||||
Func<RendererRecordingContext, bool> recordAction)
|
||||
Func<ScriptableRenderContext, bool> recordAction)
|
||||
{
|
||||
renderPassEvent = passEvent;
|
||||
m_recordAction = recordAction;
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
return context != null &&
|
||||
@@ -429,7 +429,7 @@ namespace Gameplay
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
if (context == null ||
|
||||
@@ -660,7 +660,7 @@ namespace Gameplay
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
if (context == null ||
|
||||
@@ -809,7 +809,7 @@ namespace Gameplay
|
||||
}
|
||||
|
||||
protected override void ConfigureCameraRenderRequest(
|
||||
RendererCameraRequestContext context)
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
if (context != null &&
|
||||
context.hasDirectionalShadow)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Reflection;
|
||||
using XCEngine;
|
||||
using XCEngine.Rendering;
|
||||
using XCEngine.Rendering.Renderer;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
@@ -12,12 +11,10 @@ namespace Gameplay
|
||||
public bool HasPublicContextRecordOpaqueScenePhase;
|
||||
public bool HasPublicContextRecordBeforeOpaqueInjection;
|
||||
public bool HasPublicContextRecordShaderVectorFullscreenPass;
|
||||
public bool HasPublicRendererRecordOpaqueScenePhase;
|
||||
public bool HasPublicRendererRecordShaderVectorFullscreenPass;
|
||||
public bool HasPublicCameraRequestContextHasDirectionalShadow;
|
||||
public bool HasPublicCameraRequestContextClearDirectionalShadow;
|
||||
public bool HasPublicRendererCameraRequestContextHasDirectionalShadow;
|
||||
public bool HasPublicRendererCameraRequestContextClearDirectionalShadow;
|
||||
public bool HasRendererRecordingContextType;
|
||||
public bool HasRendererCameraRequestContextType;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
@@ -25,12 +22,8 @@ namespace Gameplay
|
||||
BindingFlags.Instance | BindingFlags.Public;
|
||||
System.Type contextType =
|
||||
typeof(ScriptableRenderContext);
|
||||
System.Type rendererContextType =
|
||||
typeof(RendererRecordingContext);
|
||||
System.Type cameraRequestContextType =
|
||||
typeof(ScriptableRenderPipelineCameraRequestContext);
|
||||
System.Type rendererCameraRequestContextType =
|
||||
typeof(RendererCameraRequestContext);
|
||||
|
||||
HasPublicContextRecordScene =
|
||||
contextType.GetMethod(
|
||||
@@ -48,14 +41,6 @@ namespace Gameplay
|
||||
contextType.GetMethod(
|
||||
"RecordShaderVectorFullscreenPass",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicRendererRecordOpaqueScenePhase =
|
||||
rendererContextType.GetMethod(
|
||||
"RecordOpaqueScenePhase",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicRendererRecordShaderVectorFullscreenPass =
|
||||
rendererContextType.GetMethod(
|
||||
"RecordShaderVectorFullscreenPass",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicCameraRequestContextHasDirectionalShadow =
|
||||
cameraRequestContextType.GetProperty(
|
||||
"hasDirectionalShadow",
|
||||
@@ -64,14 +49,12 @@ namespace Gameplay
|
||||
cameraRequestContextType.GetMethod(
|
||||
"ClearDirectionalShadow",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicRendererCameraRequestContextHasDirectionalShadow =
|
||||
rendererCameraRequestContextType.GetProperty(
|
||||
"hasDirectionalShadow",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasPublicRendererCameraRequestContextClearDirectionalShadow =
|
||||
rendererCameraRequestContextType.GetMethod(
|
||||
"ClearDirectionalShadow",
|
||||
PublicInstanceMethodFlags) != null;
|
||||
HasRendererRecordingContextType =
|
||||
System.Type.GetType(
|
||||
"XCEngine.Rendering.Renderer.RendererRecordingContext, XCEngine.RenderPipelines.Universal") != null;
|
||||
HasRendererCameraRequestContextType =
|
||||
System.Type.GetType(
|
||||
"XCEngine.Rendering.Renderer.RendererCameraRequestContext, XCEngine.RenderPipelines.Universal") != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user