feat(srp): formalize scene recording and draw entrypoints
This commit is contained in:
@@ -581,11 +581,6 @@ namespace XCEngine
|
||||
Rendering_ScriptableRenderContext_GetMainDirectionalShadowDepthBiasUnits(
|
||||
ulong nativeHandle);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern bool
|
||||
Rendering_ScriptableRenderContext_RecordScene(
|
||||
ulong nativeHandle);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void
|
||||
Rendering_ScriptableRenderContext_GetCameraView(
|
||||
@@ -781,6 +776,13 @@ namespace XCEngine
|
||||
ulong nativeHandle,
|
||||
int scenePhase);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern bool
|
||||
Rendering_ScriptableRenderContext_DrawRenderers(
|
||||
ulong nativeHandle,
|
||||
int scenePhase,
|
||||
int rendererListType);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern bool
|
||||
Rendering_ScriptableRenderContext_RecordSceneInjectionPoint(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace XCEngine.Rendering
|
||||
{
|
||||
public enum RendererListType
|
||||
{
|
||||
AllVisible = 0,
|
||||
Opaque = 1,
|
||||
Transparent = 2,
|
||||
ShadowCaster = 3,
|
||||
ObjectId = 4
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace XCEngine.Rendering
|
||||
{
|
||||
public enum SceneRenderInjectionPoint
|
||||
{
|
||||
BeforeOpaque = 0,
|
||||
AfterOpaque = 1,
|
||||
BeforeSkybox = 2,
|
||||
AfterSkybox = 3,
|
||||
BeforeTransparent = 4,
|
||||
AfterTransparent = 5
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace XCEngine.Rendering
|
||||
{
|
||||
public enum SceneRenderPhase
|
||||
{
|
||||
Opaque = 0,
|
||||
Skybox = 1,
|
||||
Transparent = 3,
|
||||
EditorExtension = 4,
|
||||
PostProcess = 5,
|
||||
FinalOutput = 6
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,176 @@ namespace XCEngine.Rendering
|
||||
(CameraFrameStage)InternalCalls.Rendering_ScriptableRenderContext_GetStage(
|
||||
m_nativeHandle);
|
||||
|
||||
public RenderGraphTextureHandle sourceColorTexture =>
|
||||
RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_GetSourceColorTextureHandle(
|
||||
m_nativeHandle));
|
||||
|
||||
public RenderGraphTextureHandle primaryColorTarget =>
|
||||
RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_GetPrimaryColorTargetHandle(
|
||||
m_nativeHandle));
|
||||
|
||||
public RenderGraphTextureHandle depthTarget =>
|
||||
RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_GetDepthTargetHandle(
|
||||
m_nativeHandle));
|
||||
|
||||
public bool RecordScene()
|
||||
{
|
||||
return RecordBeforeOpaqueInjection() &&
|
||||
RecordOpaqueScenePhase() &&
|
||||
RecordAfterOpaqueInjection() &&
|
||||
RecordBeforeSkyboxInjection() &&
|
||||
RecordSkyboxScenePhase() &&
|
||||
RecordAfterSkyboxInjection() &&
|
||||
RecordBeforeTransparentInjection() &&
|
||||
RecordTransparentScenePhase() &&
|
||||
RecordAfterTransparentInjection();
|
||||
}
|
||||
|
||||
public bool RecordScenePhase(
|
||||
SceneRenderPhase scenePhase)
|
||||
{
|
||||
return InternalCalls
|
||||
.Rendering_ScriptableRenderContext_RecordScenePhase(
|
||||
m_nativeHandle,
|
||||
(int)scenePhase);
|
||||
}
|
||||
|
||||
public bool RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint injectionPoint)
|
||||
{
|
||||
return InternalCalls
|
||||
.Rendering_ScriptableRenderContext_RecordSceneInjectionPoint(
|
||||
m_nativeHandle,
|
||||
(int)injectionPoint);
|
||||
}
|
||||
|
||||
public bool DrawRenderers(
|
||||
SceneRenderPhase scenePhase,
|
||||
RendererListType rendererListType)
|
||||
{
|
||||
return InternalCalls
|
||||
.Rendering_ScriptableRenderContext_DrawRenderers(
|
||||
m_nativeHandle,
|
||||
(int)scenePhase,
|
||||
(int)rendererListType);
|
||||
}
|
||||
|
||||
public bool RecordOpaqueScenePhase()
|
||||
{
|
||||
return RecordScenePhase(
|
||||
SceneRenderPhase.Opaque);
|
||||
}
|
||||
|
||||
public bool RecordSkyboxScenePhase()
|
||||
{
|
||||
return RecordScenePhase(
|
||||
SceneRenderPhase.Skybox);
|
||||
}
|
||||
|
||||
public bool RecordTransparentScenePhase()
|
||||
{
|
||||
return RecordScenePhase(
|
||||
SceneRenderPhase.Transparent);
|
||||
}
|
||||
|
||||
public bool RecordBeforeOpaqueInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.BeforeOpaque);
|
||||
}
|
||||
|
||||
public bool RecordAfterOpaqueInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.AfterOpaque);
|
||||
}
|
||||
|
||||
public bool RecordBeforeSkyboxInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.BeforeSkybox);
|
||||
}
|
||||
|
||||
public bool RecordAfterSkyboxInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.AfterSkybox);
|
||||
}
|
||||
|
||||
public bool RecordBeforeTransparentInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.BeforeTransparent);
|
||||
}
|
||||
|
||||
public bool RecordAfterTransparentInjection()
|
||||
{
|
||||
return RecordSceneInjectionPoint(
|
||||
SceneRenderInjectionPoint.AfterTransparent);
|
||||
}
|
||||
|
||||
public bool DrawOpaqueRenderers()
|
||||
{
|
||||
return DrawRenderers(
|
||||
SceneRenderPhase.Opaque,
|
||||
RendererListType.Opaque);
|
||||
}
|
||||
|
||||
public bool DrawTransparentRenderers()
|
||||
{
|
||||
return DrawRenderers(
|
||||
SceneRenderPhase.Transparent,
|
||||
RendererListType.Transparent);
|
||||
}
|
||||
|
||||
public RenderGraphTextureHandle CreateTransientTexture(
|
||||
string name,
|
||||
RenderGraphTextureDesc desc)
|
||||
{
|
||||
return RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_CreateTransientTexture(
|
||||
m_nativeHandle,
|
||||
name,
|
||||
ref desc));
|
||||
}
|
||||
|
||||
public RenderGraphTextureHandle
|
||||
CreateFullscreenTransientColorTexture(
|
||||
string name)
|
||||
{
|
||||
return RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_CreateFullscreenTransientColorTexture(
|
||||
m_nativeHandle,
|
||||
name));
|
||||
}
|
||||
|
||||
public RenderGraphTextureHandle
|
||||
CreateFullscreenTransientDepthTexture(
|
||||
string name)
|
||||
{
|
||||
return RenderGraphTextureHandle.FromNativeIndex(
|
||||
InternalCalls
|
||||
.Rendering_ScriptableRenderContext_CreateFullscreenTransientDepthTexture(
|
||||
m_nativeHandle,
|
||||
name));
|
||||
}
|
||||
|
||||
public RenderGraphRasterPassBuilder AddRasterPass(
|
||||
string passName)
|
||||
{
|
||||
return new RenderGraphRasterPassBuilder(
|
||||
this,
|
||||
passName);
|
||||
}
|
||||
|
||||
internal ulong nativeHandle =>
|
||||
m_nativeHandle;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user