-
Notifications
You must be signed in to change notification settings - Fork 866
Expand file tree
/
Copy pathRenderGraph.Compiler.cs
More file actions
49 lines (40 loc) · 1.96 KB
/
RenderGraph.Compiler.cs
File metadata and controls
49 lines (40 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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 (new ProfilingScope(m_RenderGraphContext.cmd, ProfilingSampler.Get(RenderGraphProfileId.CompileRenderGraph)))
{
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, m_RendererListCulling);
return nativeCompiler;
}
}
void ExecuteNativeRenderGraph()
{
using (new ProfilingScope(m_RenderGraphContext.cmd, ProfilingSampler.Get(RenderGraphProfileId.ExecuteRenderGraph)))
{
nativeCompiler.ExecuteGraph(m_RenderGraphContext, m_Resources, m_RenderPasses);
}
}
public bool IsPassUsingRenderTarget(int passId, int resourceId)
{
return nativeCompiler.contextData.nativepassFragmentsContain(passId, resourceId);
}
}
}