refactor(srp): add depth-aware managed fullscreen raster graph bridge
This commit is contained in:
@@ -18,9 +18,12 @@ namespace XCEngine.Rendering
|
||||
private readonly string m_passName;
|
||||
private readonly List<RenderGraphTextureHandle> m_readTextures =
|
||||
new List<RenderGraphTextureHandle>();
|
||||
private readonly List<RenderGraphTextureHandle> m_readDepthTextures =
|
||||
new List<RenderGraphTextureHandle>();
|
||||
private readonly List<RenderGraphTextureHandle> m_colorAttachments =
|
||||
new List<RenderGraphTextureHandle>();
|
||||
private RenderGraphTextureHandle m_sourceColorTexture;
|
||||
private RenderGraphTextureHandle m_depthAttachment;
|
||||
private Vector4 m_vectorPayload;
|
||||
private string m_shaderPath = string.Empty;
|
||||
private string m_shaderPassName = string.Empty;
|
||||
@@ -79,6 +82,17 @@ namespace XCEngine.Rendering
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderGraphRasterPassBuilder UseDepthTexture(
|
||||
RenderGraphTextureHandle texture)
|
||||
{
|
||||
if (texture.isValid)
|
||||
{
|
||||
m_readDepthTextures.Add(texture);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderGraphRasterPassBuilder SetColorAttachment(
|
||||
RenderGraphTextureHandle texture,
|
||||
int index = 0)
|
||||
@@ -99,6 +113,13 @@ namespace XCEngine.Rendering
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderGraphRasterPassBuilder SetDepthAttachment(
|
||||
RenderGraphTextureHandle texture)
|
||||
{
|
||||
m_depthAttachment = texture;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RenderGraphRasterPassBuilder
|
||||
SetColorScaleFullscreenExecution(
|
||||
Vector4 colorScale)
|
||||
@@ -184,6 +205,25 @@ namespace XCEngine.Rendering
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_readDepthTextures.Count; ++i)
|
||||
{
|
||||
RenderGraphTextureHandle readDepthTexture =
|
||||
m_readDepthTextures[i];
|
||||
if (!readDepthTexture.isValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!InternalCalls
|
||||
.Rendering_ScriptableRenderContext_AddRasterPassReadDepthTexture(
|
||||
m_context.nativeHandle,
|
||||
nativePassHandle,
|
||||
readDepthTexture.nativeIndex))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_colorAttachments.Count; ++i)
|
||||
{
|
||||
RenderGraphTextureHandle colorAttachment =
|
||||
@@ -204,6 +244,16 @@ namespace XCEngine.Rendering
|
||||
}
|
||||
}
|
||||
|
||||
if (m_depthAttachment.isValid &&
|
||||
!InternalCalls
|
||||
.Rendering_ScriptableRenderContext_SetRasterPassDepthAttachment(
|
||||
m_context.nativeHandle,
|
||||
nativePassHandle,
|
||||
m_depthAttachment.nativeIndex))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool configuredExecution;
|
||||
switch (m_executionKind)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user