Files
Test/Library/PackageCache/com.unity.render-pipelines.core@13460d8ea9e5/Runtime/RenderGraph/RenderGraph.Compiler.cs
T
2026-11-01 23:39:55 +02:00

45 lines
1.7 KiB
C#

using UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler;
namespace UnityEngine.Rendering.RenderGraphModule
{
public partial class RenderGraph
{
//TODO(ddebaets) move old compile func/members over
NativePassCompiler nativeCompiler = null;
internal NativePassCompiler CompileNativeRenderGraph(int graphHash)
{
using (RenderGraphProfilerMarkers.CompileRenderGraph.Auto())
{
if (nativeCompiler == null)
nativeCompiler = new NativePassCompiler(m_CompilationCache);
bool compilationIsCached = nativeCompiler.Initialize(m_Resources, m_RenderPasses, m_DebugParameters, name, m_EnableCompilationCaching, graphHash, m_ExecutionCount, m_renderTextureUVOriginStrategy);
if (!compilationIsCached)
nativeCompiler.Compile(m_Resources);
ref var passData = ref nativeCompiler.contextData.passData;
int numPasses = passData.Length;
for (int i = 0; i < numPasses; ++i)
{
if (!passData.ElementAt(i).culled)
m_RendererLists.AddRange(m_RenderPasses[i].usedRendererListList);
}
m_Resources.CreateRendererLists(m_RendererLists, m_RenderGraphContext.renderContext);
return nativeCompiler;
}
}
void ExecuteNativeRenderGraph()
{
using (new ProfilingScope(m_RenderGraphContext.cmd, RenderGraphProfilerMarkers.ExecuteRenderGraph))
{
nativeCompiler.ExecuteGraph(m_RenderGraphContext, m_Resources, m_RenderPasses);
}
}
}
}