125 lines
3.6 KiB
C#
125 lines
3.6 KiB
C#
using System;
|
|
|
|
namespace XCEngine.Rendering.RenderGraphModule
|
|
{
|
|
public sealed class RenderGraph
|
|
{
|
|
private readonly XCEngine.Rendering.ScriptableRenderContext
|
|
m_context;
|
|
|
|
public RenderGraph()
|
|
: this(null)
|
|
{
|
|
}
|
|
|
|
public RenderGraph(
|
|
XCEngine.Rendering.ScriptableRenderContext context)
|
|
{
|
|
m_context = context;
|
|
}
|
|
|
|
public XCEngine.Rendering.RenderGraphRasterPassBuilder
|
|
AddRasterPass(
|
|
string passName)
|
|
{
|
|
if (m_context == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"RenderGraph is not bound to a recording context.");
|
|
}
|
|
|
|
return m_context.AddRasterPass(passName);
|
|
}
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
CreateTransientTexture(
|
|
string name,
|
|
XCEngine.Rendering.RenderGraphTextureDesc desc)
|
|
{
|
|
if (m_context == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"RenderGraph is not bound to a recording context.");
|
|
}
|
|
|
|
return m_context.CreateTransientTexture(
|
|
name,
|
|
desc);
|
|
}
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
CreateFullscreenTransientColorTexture(
|
|
string name)
|
|
{
|
|
if (m_context == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"RenderGraph is not bound to a recording context.");
|
|
}
|
|
|
|
return m_context.CreateFullscreenTransientColorTexture(name);
|
|
}
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
CreateFullscreenTransientDepthTexture(
|
|
string name)
|
|
{
|
|
if (m_context == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"RenderGraph is not bound to a recording context.");
|
|
}
|
|
|
|
return m_context.CreateFullscreenTransientDepthTexture(name);
|
|
}
|
|
|
|
public XCEngine.Rendering.RendererListHandle
|
|
CreateRendererList(
|
|
XCEngine.Rendering.RendererListDesc rendererListDesc)
|
|
{
|
|
return CreateRendererList(
|
|
rendererListDesc,
|
|
XCEngine.Rendering.DrawingSettings.CreateDefault());
|
|
}
|
|
|
|
public XCEngine.Rendering.RendererListHandle
|
|
CreateRendererList(
|
|
XCEngine.Rendering.RendererListDesc rendererListDesc,
|
|
XCEngine.Rendering.DrawingSettings drawingSettings)
|
|
{
|
|
if (m_context == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"RenderGraph is not bound to a recording context.");
|
|
}
|
|
|
|
return m_context.CreateRendererList(
|
|
rendererListDesc,
|
|
drawingSettings);
|
|
}
|
|
|
|
internal string passName =>
|
|
m_context != null
|
|
? m_context.passName
|
|
: string.Empty;
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
sourceColorTexture =>
|
|
m_context != null
|
|
? m_context.sourceColorTexture
|
|
: default;
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
primaryColorTarget =>
|
|
m_context != null
|
|
? m_context.primaryColorTarget
|
|
: default;
|
|
|
|
public XCEngine.Rendering.RenderGraphTextureHandle
|
|
depthTarget =>
|
|
m_context != null
|
|
? m_context.depthTarget
|
|
: default;
|
|
}
|
|
}
|