暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RenderGraph.Compiler.cs 2.0KB

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