refactor(srp): align renderer api with unity contexts
This commit is contained in:
@@ -73,61 +73,61 @@ namespace XCEngine.Rendering
|
||||
m_nativeHandle);
|
||||
}
|
||||
|
||||
internal bool RecordOpaqueScenePhase()
|
||||
public bool RecordOpaqueScenePhase()
|
||||
{
|
||||
return RecordScenePhaseInternal(
|
||||
RecordedScenePhase.Opaque);
|
||||
}
|
||||
|
||||
internal bool RecordSkyboxScenePhase()
|
||||
public bool RecordSkyboxScenePhase()
|
||||
{
|
||||
return RecordScenePhaseInternal(
|
||||
RecordedScenePhase.Skybox);
|
||||
}
|
||||
|
||||
internal bool RecordTransparentScenePhase()
|
||||
public bool RecordTransparentScenePhase()
|
||||
{
|
||||
return RecordScenePhaseInternal(
|
||||
RecordedScenePhase.Transparent);
|
||||
}
|
||||
|
||||
internal bool RecordBeforeOpaqueInjection()
|
||||
public bool RecordBeforeOpaqueInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.BeforeOpaque);
|
||||
}
|
||||
|
||||
internal bool RecordAfterOpaqueInjection()
|
||||
public bool RecordAfterOpaqueInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.AfterOpaque);
|
||||
}
|
||||
|
||||
internal bool RecordBeforeSkyboxInjection()
|
||||
public bool RecordBeforeSkyboxInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.BeforeSkybox);
|
||||
}
|
||||
|
||||
internal bool RecordAfterSkyboxInjection()
|
||||
public bool RecordAfterSkyboxInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.AfterSkybox);
|
||||
}
|
||||
|
||||
internal bool RecordBeforeTransparentInjection()
|
||||
public bool RecordBeforeTransparentInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.BeforeTransparent);
|
||||
}
|
||||
|
||||
internal bool RecordAfterTransparentInjection()
|
||||
public bool RecordAfterTransparentInjection()
|
||||
{
|
||||
return RecordSceneInjectionPointInternal(
|
||||
RecordedSceneInjectionPoint.AfterTransparent);
|
||||
}
|
||||
|
||||
internal bool RecordColorScaleFullscreenPass(
|
||||
public bool RecordColorScaleFullscreenPass(
|
||||
Vector4 colorScale)
|
||||
{
|
||||
return RecordFullscreenPassInternal(
|
||||
@@ -137,7 +137,7 @@ namespace XCEngine.Rendering
|
||||
colorScale);
|
||||
}
|
||||
|
||||
internal bool RecordShaderVectorFullscreenPass(
|
||||
public bool RecordShaderVectorFullscreenPass(
|
||||
string shaderPath,
|
||||
Vector4 vectorPayload,
|
||||
string passName = null)
|
||||
|
||||
@@ -21,12 +21,12 @@ namespace XCEngine.Rendering
|
||||
.Rendering_ScriptableRenderPipelineCameraRequestContext_GetRenderedRequestCount(
|
||||
m_nativeHandle);
|
||||
|
||||
internal bool hasDirectionalShadow =>
|
||||
public bool hasDirectionalShadow =>
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderPipelineCameraRequestContext_GetHasDirectionalShadow(
|
||||
m_nativeHandle);
|
||||
|
||||
internal void ClearDirectionalShadow()
|
||||
public void ClearDirectionalShadow()
|
||||
{
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderPipelineCameraRequestContext_ClearDirectionalShadow(
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace XCEngine.Rendering.FirstParty
|
||||
}
|
||||
|
||||
protected override bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
return context != null &&
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCEngine.Rendering.FirstParty
|
||||
: ScriptableRendererFeature
|
||||
{
|
||||
public override void ConfigureCameraRenderRequest(
|
||||
RendererCameraRequestContext context)
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
if (context != null &&
|
||||
context.hasDirectionalShadow)
|
||||
|
||||
@@ -7,18 +7,18 @@ namespace XCEngine.Rendering.FirstParty
|
||||
{
|
||||
internal sealed class ForwardSceneRecordingPass : ScriptableRenderPass
|
||||
{
|
||||
private readonly Func<RendererRecordingContext, bool> m_recordAction;
|
||||
private readonly Func<ScriptableRenderContext, bool> m_recordAction;
|
||||
|
||||
public ForwardSceneRecordingPass(
|
||||
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 &&
|
||||
|
||||
@@ -26,10 +26,8 @@ namespace XCEngine.Rendering.Renderer
|
||||
ResolveRendererData();
|
||||
if (rendererData != null)
|
||||
{
|
||||
RendererCameraRequestContext rendererContext =
|
||||
new RendererCameraRequestContext(context);
|
||||
rendererData.ConfigureCameraRenderRequestInstance(
|
||||
rendererContext);
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
using XCEngine;
|
||||
using XCEngine.Rendering;
|
||||
|
||||
namespace XCEngine.Rendering.Renderer
|
||||
{
|
||||
public sealed class RendererCameraRequestContext
|
||||
{
|
||||
private readonly ScriptableRenderPipelineCameraRequestContext
|
||||
m_requestContext;
|
||||
|
||||
internal RendererCameraRequestContext(
|
||||
ScriptableRenderPipelineCameraRequestContext requestContext)
|
||||
{
|
||||
m_requestContext = requestContext;
|
||||
}
|
||||
|
||||
public int renderedBaseCameraCount =>
|
||||
m_requestContext != null
|
||||
? m_requestContext.renderedBaseCameraCount
|
||||
: 0;
|
||||
|
||||
public int renderedRequestCount =>
|
||||
m_requestContext != null
|
||||
? m_requestContext.renderedRequestCount
|
||||
: 0;
|
||||
|
||||
public bool hasDirectionalShadow =>
|
||||
m_requestContext != null &&
|
||||
m_requestContext.hasDirectionalShadow;
|
||||
|
||||
public void ClearDirectionalShadow()
|
||||
{
|
||||
if (m_requestContext != null)
|
||||
{
|
||||
m_requestContext.ClearDirectionalShadow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
using XCEngine;
|
||||
using XCEngine.Rendering;
|
||||
|
||||
namespace XCEngine.Rendering.Renderer
|
||||
{
|
||||
public sealed class RendererRecordingContext
|
||||
{
|
||||
private readonly ScriptableRenderContext m_renderContext;
|
||||
|
||||
internal RendererRecordingContext(
|
||||
ScriptableRenderContext renderContext)
|
||||
{
|
||||
m_renderContext = renderContext;
|
||||
}
|
||||
|
||||
public bool RecordScene()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordScene();
|
||||
}
|
||||
|
||||
public bool RecordOpaqueScenePhase()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordOpaqueScenePhase();
|
||||
}
|
||||
|
||||
public bool RecordSkyboxScenePhase()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordSkyboxScenePhase();
|
||||
}
|
||||
|
||||
public bool RecordTransparentScenePhase()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordTransparentScenePhase();
|
||||
}
|
||||
|
||||
public bool RecordBeforeOpaqueInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordBeforeOpaqueInjection();
|
||||
}
|
||||
|
||||
public bool RecordAfterOpaqueInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordAfterOpaqueInjection();
|
||||
}
|
||||
|
||||
public bool RecordBeforeSkyboxInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordBeforeSkyboxInjection();
|
||||
}
|
||||
|
||||
public bool RecordAfterSkyboxInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordAfterSkyboxInjection();
|
||||
}
|
||||
|
||||
public bool RecordBeforeTransparentInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordBeforeTransparentInjection();
|
||||
}
|
||||
|
||||
public bool RecordAfterTransparentInjection()
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordAfterTransparentInjection();
|
||||
}
|
||||
|
||||
public bool RecordColorScaleFullscreenPass(
|
||||
Vector4 colorScale)
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordColorScaleFullscreenPass(
|
||||
colorScale);
|
||||
}
|
||||
|
||||
public bool RecordShaderVectorFullscreenPass(
|
||||
string shaderPath,
|
||||
Vector4 vectorPayload,
|
||||
string passName = null)
|
||||
{
|
||||
return m_renderContext != null &&
|
||||
m_renderContext.RecordShaderVectorFullscreenPass(
|
||||
shaderPath,
|
||||
vectorPayload,
|
||||
passName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
internal bool Record(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData)
|
||||
{
|
||||
return RecordRenderGraph(
|
||||
@@ -32,7 +32,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
protected abstract bool RecordRenderGraph(
|
||||
RendererRecordingContext context,
|
||||
ScriptableRenderContext context,
|
||||
RenderingData renderingData);
|
||||
|
||||
internal static bool TryResolveStage(
|
||||
|
||||
@@ -81,8 +81,6 @@ namespace XCEngine.Rendering.Renderer
|
||||
|
||||
RenderingData renderingData =
|
||||
new RenderingData(context);
|
||||
RendererRecordingContext recordingContext =
|
||||
new RendererRecordingContext(context);
|
||||
BuildPassQueue(renderingData);
|
||||
|
||||
bool recordedAnyPass = false;
|
||||
@@ -96,7 +94,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
if (!renderPass.Record(
|
||||
recordingContext,
|
||||
context,
|
||||
renderingData))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
internal void ConfigureCameraRenderRequestInstance(
|
||||
RendererCameraRequestContext context)
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
ConfigureCameraRenderRequest(context);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
protected virtual void ConfigureCameraRenderRequest(
|
||||
RendererCameraRequestContext context)
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace XCEngine.Rendering.Renderer
|
||||
}
|
||||
|
||||
public virtual void ConfigureCameraRenderRequest(
|
||||
RendererCameraRequestContext context)
|
||||
ScriptableRenderPipelineCameraRequestContext context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user