A game about forced loneliness, made by TACStudios
at master 51 lines 2.1 kB view raw
1using UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler; 2 3namespace UnityEngine.Rendering.RenderGraphModule 4{ 5 public partial class RenderGraph 6 { 7 //TODO(ddebaets) move old compile func/members over 8 9 NativePassCompiler nativeCompiler = null; 10 11 internal NativePassCompiler CompileNativeRenderGraph(int graphHash) 12 { 13 using (new ProfilingScope(m_RenderGraphContext.cmd, ProfilingSampler.Get(RenderGraphProfileId.CompileRenderGraph))) 14 { 15 if (nativeCompiler == null) 16 nativeCompiler = new NativePassCompiler(m_CompilationCache); 17 18 bool compilationIsCached = nativeCompiler.Initialize(m_Resources, m_RenderPasses, m_DebugParameters.disablePassCulling, name, m_EnableCompilationCaching, graphHash, m_ExecutionCount); 19 if (!compilationIsCached) 20 nativeCompiler.Compile(m_Resources); 21 22 var passData = nativeCompiler.contextData.passData; 23 int numPasses = passData.Length; 24 for (int i = 0; i < numPasses; ++i) 25 { 26 if (passData.ElementAt(i).culled) 27 continue; 28 var rp = m_RenderPasses[i]; 29 m_RendererLists.AddRange(rp.usedRendererListList); 30 } 31 32 m_Resources.CreateRendererLists(m_RendererLists, m_RenderGraphContext.renderContext, m_RendererListCulling); 33 34 return nativeCompiler; 35 } 36 } 37 38 void ExecuteNativeRenderGraph() 39 { 40 using (new ProfilingScope(m_RenderGraphContext.cmd, ProfilingSampler.Get(RenderGraphProfileId.ExecuteRenderGraph))) 41 { 42 nativeCompiler.ExecuteGraph(m_RenderGraphContext, m_Resources, m_RenderPasses); 43 44 if (m_RenderGraphContext.contextlessTesting == false) 45 m_RenderGraphContext.renderContext.ExecuteCommandBuffer(m_RenderGraphContext.cmd); 46 47 m_RenderGraphContext.cmd.Clear(); 48 } 49 } 50 } 51}