暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Render2DLightingPass.cs 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine.Profiling;
  4. using UnityEngine.Experimental.Rendering;
  5. namespace UnityEngine.Rendering.Universal
  6. {
  7. internal class Render2DLightingPass : ScriptableRenderPass, IRenderPass2D
  8. {
  9. private static readonly int k_HDREmulationScaleID = Shader.PropertyToID("_HDREmulationScale");
  10. private static readonly int k_InverseHDREmulationScaleID = Shader.PropertyToID("_InverseHDREmulationScale");
  11. private static readonly int k_RendererColorID = Shader.PropertyToID("_RendererColor");
  12. private static readonly int k_LightLookupID = Shader.PropertyToID("_LightLookup");
  13. private static readonly int k_FalloffLookupID = Shader.PropertyToID("_FalloffLookup");
  14. private static readonly int[] k_ShapeLightTextureIDs =
  15. {
  16. Shader.PropertyToID("_ShapeLightTexture0"),
  17. Shader.PropertyToID("_ShapeLightTexture1"),
  18. Shader.PropertyToID("_ShapeLightTexture2"),
  19. Shader.PropertyToID("_ShapeLightTexture3")
  20. };
  21. private static readonly ShaderTagId k_CombinedRenderingPassName = new ShaderTagId("Universal2D");
  22. private static readonly ShaderTagId k_NormalsRenderingPassName = new ShaderTagId("NormalsRendering");
  23. private static readonly ShaderTagId k_LegacyPassName = new ShaderTagId("SRPDefaultUnlit");
  24. private static readonly List<ShaderTagId> k_ShaderTags = new List<ShaderTagId>() { k_LegacyPassName, k_CombinedRenderingPassName };
  25. private static readonly ProfilingSampler m_ProfilingDrawLights = new ProfilingSampler("Draw 2D Lights");
  26. private static readonly ProfilingSampler m_ProfilingDrawLightTextures = new ProfilingSampler("Draw 2D Lights Textures");
  27. private static readonly ProfilingSampler m_ProfilingDrawRenderers = new ProfilingSampler("Draw All Renderers");
  28. private static readonly ProfilingSampler m_ProfilingDrawLayerBatch = new ProfilingSampler("Draw Layer Batch");
  29. private static readonly ProfilingSampler m_ProfilingSamplerUnlit = new ProfilingSampler("Render Unlit");
  30. Material m_BlitMaterial;
  31. Material m_SamplingMaterial;
  32. private readonly Renderer2DData m_Renderer2DData;
  33. private readonly Texture2D m_FallOffLookup;
  34. private bool m_NeedsDepth;
  35. private short m_CameraSortingLayerBoundsIndex;
  36. public Render2DLightingPass(Renderer2DData rendererData, Material blitMaterial, Material samplingMaterial, Texture2D fallOffLookup)
  37. {
  38. m_Renderer2DData = rendererData;
  39. m_BlitMaterial = blitMaterial;
  40. m_SamplingMaterial = samplingMaterial;
  41. m_FallOffLookup = fallOffLookup;
  42. m_CameraSortingLayerBoundsIndex = GetCameraSortingLayerBoundsIndex(m_Renderer2DData);
  43. }
  44. internal void Setup(bool useDepth)
  45. {
  46. m_NeedsDepth = useDepth;
  47. }
  48. private void CopyCameraSortingLayerRenderTexture(ScriptableRenderContext context, RenderingData renderingData, RenderBufferStoreAction mainTargetStoreAction)
  49. {
  50. var cmd = renderingData.commandBuffer;
  51. this.CreateCameraSortingLayerRenderTexture(renderingData, cmd, m_Renderer2DData.cameraSortingLayerDownsamplingMethod);
  52. Material copyMaterial = m_SamplingMaterial;
  53. int passIndex = 0;
  54. if (m_Renderer2DData.cameraSortingLayerDownsamplingMethod != Downsampling._4xBox)
  55. {
  56. copyMaterial = m_BlitMaterial;
  57. passIndex = colorAttachmentHandle.rt.filterMode == FilterMode.Bilinear ? 1 : 0;
  58. }
  59. Blitter.BlitCameraTexture(cmd, colorAttachmentHandle, m_Renderer2DData.cameraSortingLayerRenderTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, copyMaterial, passIndex);
  60. CoreUtils.SetRenderTarget(cmd,
  61. colorAttachmentHandle, RenderBufferLoadAction.Load, mainTargetStoreAction,
  62. depthAttachmentHandle, RenderBufferLoadAction.Load, mainTargetStoreAction,
  63. ClearFlag.None, Color.clear);
  64. cmd.SetGlobalTexture(m_Renderer2DData.cameraSortingLayerRenderTarget.name, m_Renderer2DData.cameraSortingLayerRenderTarget.nameID);
  65. context.ExecuteCommandBuffer(cmd);
  66. cmd.Clear();
  67. }
  68. public static short GetCameraSortingLayerBoundsIndex(Renderer2DData rendererData)
  69. {
  70. SortingLayer[] sortingLayers = Light2DManager.GetCachedSortingLayer();
  71. for (short i = 0; i < sortingLayers.Length; i++)
  72. {
  73. if (sortingLayers[i].id == rendererData.cameraSortingLayerTextureBound)
  74. return (short)sortingLayers[i].value;
  75. }
  76. return short.MinValue;
  77. }
  78. private void DetermineWhenToResolve(int startIndex, int batchesDrawn, int batchCount, LayerBatch[] layerBatches,
  79. out int resolveDuringBatch, out bool resolveIsAfterCopy)
  80. {
  81. bool anyLightWithVolumetricShadows = false;
  82. var lights = m_Renderer2DData.lightCullResult.visibleLights;
  83. for (int i = 0; i < lights.Count; i++)
  84. {
  85. anyLightWithVolumetricShadows = lights[i].renderVolumetricShadows;
  86. if (anyLightWithVolumetricShadows)
  87. break;
  88. }
  89. var lastVolumetricLightBatch = -1;
  90. if (anyLightWithVolumetricShadows)
  91. {
  92. for (int i = startIndex + batchesDrawn - 1; i >= startIndex; i--)
  93. {
  94. if (layerBatches[i].lightStats.totalVolumetricUsage > 0)
  95. {
  96. lastVolumetricLightBatch = i;
  97. break;
  98. }
  99. }
  100. }
  101. if (m_Renderer2DData.useCameraSortingLayerTexture)
  102. {
  103. var cameraSortingLayerBoundsIndex = GetCameraSortingLayerBoundsIndex(m_Renderer2DData);
  104. var copyBatch = -1;
  105. for (int i = startIndex; i < startIndex + batchesDrawn; i++)
  106. {
  107. var layerBatch = layerBatches[i];
  108. if (cameraSortingLayerBoundsIndex >= layerBatch.layerRange.lowerBound && cameraSortingLayerBoundsIndex <= layerBatch.layerRange.upperBound)
  109. {
  110. copyBatch = i;
  111. break;
  112. }
  113. }
  114. resolveIsAfterCopy = copyBatch > lastVolumetricLightBatch;
  115. resolveDuringBatch = resolveIsAfterCopy ? copyBatch : lastVolumetricLightBatch;
  116. }
  117. else
  118. {
  119. resolveDuringBatch = lastVolumetricLightBatch;
  120. resolveIsAfterCopy = false;
  121. }
  122. }
  123. private void Render(ScriptableRenderContext context, CommandBuffer cmd, ref RenderingData renderingData, ref FilteringSettings filterSettings, DrawingSettings drawSettings)
  124. {
  125. UniversalCameraData cameraData = renderingData.frameData.Get<UniversalCameraData>();
  126. var activeDebugHandler = GetActiveDebugHandler(cameraData);
  127. if (activeDebugHandler != null)
  128. {
  129. UniversalRenderingData universalRenderingData = renderingData.universalRenderingData;
  130. RenderStateBlock renderStateBlock = new RenderStateBlock();
  131. var debugRendererLists = activeDebugHandler.CreateRendererListsWithDebugRenderState(context,
  132. ref universalRenderingData.cullResults, ref drawSettings, ref filterSettings, ref renderStateBlock);
  133. debugRendererLists.DrawWithRendererList(CommandBufferHelpers.GetRasterCommandBuffer(renderingData.commandBuffer));
  134. }
  135. else
  136. {
  137. var param = new RendererListParams(renderingData.cullResults, drawSettings, filterSettings);
  138. var rl = context.CreateRendererList(ref param);
  139. cmd.DrawRendererList(rl);
  140. }
  141. }
  142. private int DrawLayerBatches(
  143. LayerBatch[] layerBatches,
  144. int batchCount,
  145. int startIndex,
  146. CommandBuffer cmd,
  147. ScriptableRenderContext context,
  148. ref RenderingData renderingData,
  149. ref FilteringSettings filterSettings,
  150. ref DrawingSettings normalsDrawSettings,
  151. ref DrawingSettings drawSettings,
  152. ref RenderTextureDescriptor desc)
  153. {
  154. UniversalCameraData cameraData = renderingData.frameData.Get<UniversalCameraData>();
  155. var debugHandler = GetActiveDebugHandler(cameraData);
  156. bool drawLights = debugHandler?.IsLightingActive ?? true;
  157. var batchesDrawn = 0;
  158. var rtCount = 0U;
  159. // Account for Sprite Mask and normal map usage where the first and last layer has to render the stencil pass
  160. bool normalsFirstClear = true;
  161. // Draw lights
  162. using (new ProfilingScope(cmd, m_ProfilingDrawLights))
  163. {
  164. for (var i = startIndex; i < batchCount; ++i)
  165. {
  166. ref var layerBatch = ref layerBatches[i];
  167. var blendStyleMask = layerBatch.lightStats.blendStylesUsed;
  168. var blendStyleCount = 0U;
  169. while (blendStyleMask > 0)
  170. {
  171. blendStyleCount += blendStyleMask & 1;
  172. blendStyleMask >>= 1;
  173. }
  174. rtCount += blendStyleCount;
  175. if (rtCount > LayerUtility.maxTextureCount)
  176. break;
  177. batchesDrawn++;
  178. if (layerBatch.lightStats.totalNormalMapUsage > 0)
  179. {
  180. filterSettings.sortingLayerRange = layerBatch.layerRange;
  181. var depthTarget = m_NeedsDepth ? depthAttachmentHandle : null;
  182. this.RenderNormals(context, renderingData, normalsDrawSettings, filterSettings, depthTarget, ref normalsFirstClear);
  183. }
  184. using (new ProfilingScope(cmd, m_ProfilingDrawLightTextures))
  185. {
  186. this.RenderLights(renderingData, cmd, ref layerBatch, ref desc);
  187. }
  188. }
  189. }
  190. // Determine when to resolve in case we use MSAA
  191. var msaaEnabled = renderingData.cameraData.cameraTargetDescriptor.msaaSamples > 1;
  192. var isFinalBatchSet = startIndex + batchesDrawn >= batchCount;
  193. var resolveDuringBatch = -1;
  194. var resolveIsAfterCopy = false;
  195. if (msaaEnabled && isFinalBatchSet)
  196. DetermineWhenToResolve(startIndex, batchesDrawn, batchCount, layerBatches, out resolveDuringBatch, out resolveIsAfterCopy);
  197. // Draw renderers
  198. var blendStylesCount = m_Renderer2DData.lightBlendStyles.Length;
  199. using (new ProfilingScope(cmd, m_ProfilingDrawRenderers))
  200. {
  201. RenderBufferStoreAction initialStoreAction;
  202. if (msaaEnabled)
  203. initialStoreAction = resolveDuringBatch < startIndex ? RenderBufferStoreAction.Resolve : RenderBufferStoreAction.StoreAndResolve;
  204. else
  205. initialStoreAction = RenderBufferStoreAction.Store;
  206. CoreUtils.SetRenderTarget(cmd,
  207. colorAttachmentHandle, RenderBufferLoadAction.Load, initialStoreAction,
  208. depthAttachmentHandle, RenderBufferLoadAction.Load, initialStoreAction,
  209. ClearFlag.None, Color.clear);
  210. for (var i = startIndex; i < startIndex + batchesDrawn; i++)
  211. {
  212. using (new ProfilingScope(cmd, m_ProfilingDrawLayerBatch))
  213. {
  214. // This is a local copy of the array element (it's a struct). Remember to add a ref here if you need to modify the real thing.
  215. var layerBatch = layerBatches[i];
  216. if (layerBatch.lightStats.useAnyLights)
  217. {
  218. for (var blendStyleIndex = 0; blendStyleIndex < blendStylesCount; blendStyleIndex++)
  219. {
  220. var blendStyleMask = (uint)(1 << blendStyleIndex);
  221. var blendStyleUsed = (layerBatch.lightStats.blendStylesUsed & blendStyleMask) > 0;
  222. if (blendStyleUsed)
  223. {
  224. var identifier = layerBatch.GetRTId(cmd, desc, blendStyleIndex);
  225. cmd.SetGlobalTexture(k_ShapeLightTextureIDs[blendStyleIndex], identifier);
  226. }
  227. RendererLighting.EnableBlendStyle(CommandBufferHelpers.GetRasterCommandBuffer(cmd), blendStyleIndex, blendStyleUsed);
  228. }
  229. }
  230. else
  231. {
  232. for (var blendStyleIndex = 0; blendStyleIndex < k_ShapeLightTextureIDs.Length; blendStyleIndex++)
  233. {
  234. cmd.SetGlobalTexture(k_ShapeLightTextureIDs[blendStyleIndex], Texture2D.blackTexture);
  235. RendererLighting.EnableBlendStyle(CommandBufferHelpers.GetRasterCommandBuffer(cmd), blendStyleIndex, blendStyleIndex == 0);
  236. }
  237. }
  238. context.ExecuteCommandBuffer(cmd);
  239. cmd.Clear();
  240. short cameraSortingLayerBoundsIndex = GetCameraSortingLayerBoundsIndex(m_Renderer2DData);
  241. RenderBufferStoreAction copyStoreAction;
  242. if (msaaEnabled)
  243. copyStoreAction = resolveDuringBatch == i && resolveIsAfterCopy ? RenderBufferStoreAction.Resolve : RenderBufferStoreAction.StoreAndResolve;
  244. else
  245. copyStoreAction = RenderBufferStoreAction.Store;
  246. // If our camera sorting layer texture bound is inside our batch we need to break up the DrawRenderers into two batches
  247. if (cameraSortingLayerBoundsIndex >= layerBatch.layerRange.lowerBound && cameraSortingLayerBoundsIndex < layerBatch.layerRange.upperBound && m_Renderer2DData.useCameraSortingLayerTexture)
  248. {
  249. filterSettings.sortingLayerRange = new SortingLayerRange(layerBatch.layerRange.lowerBound, cameraSortingLayerBoundsIndex);
  250. Render(context, cmd, ref renderingData, ref filterSettings, drawSettings);
  251. CopyCameraSortingLayerRenderTexture(context, renderingData, copyStoreAction);
  252. filterSettings.sortingLayerRange = new SortingLayerRange((short)(cameraSortingLayerBoundsIndex + 1), layerBatch.layerRange.upperBound);
  253. Render(context, cmd, ref renderingData, ref filterSettings, drawSettings);
  254. }
  255. else
  256. {
  257. filterSettings.sortingLayerRange = new SortingLayerRange(layerBatch.layerRange.lowerBound, layerBatch.layerRange.upperBound);
  258. Render(context, cmd, ref renderingData, ref filterSettings, drawSettings);
  259. if (cameraSortingLayerBoundsIndex == layerBatch.layerRange.upperBound && m_Renderer2DData.useCameraSortingLayerTexture)
  260. CopyCameraSortingLayerRenderTexture(context, renderingData, copyStoreAction);
  261. }
  262. // Draw light volumes
  263. if (drawLights && (layerBatch.lightStats.totalVolumetricUsage > 0))
  264. {
  265. var sampleName = "Render 2D Light Volumes";
  266. cmd.BeginSample(sampleName);
  267. RenderBufferStoreAction storeAction;
  268. if (msaaEnabled)
  269. storeAction = resolveDuringBatch == i && !resolveIsAfterCopy ? RenderBufferStoreAction.Resolve : RenderBufferStoreAction.StoreAndResolve;
  270. else
  271. storeAction = RenderBufferStoreAction.Store;
  272. this.RenderLightVolumes(renderingData, cmd, ref layerBatch, colorAttachmentHandle.nameID, depthAttachmentHandle.nameID,
  273. RenderBufferStoreAction.Store, storeAction, false, m_Renderer2DData.lightCullResult.visibleLights);
  274. cmd.EndSample(sampleName);
  275. }
  276. }
  277. }
  278. }
  279. for (var i = startIndex; i < startIndex + batchesDrawn; ++i)
  280. {
  281. ref var layerBatch = ref layerBatches[i];
  282. layerBatch.ReleaseRT(cmd);
  283. }
  284. return batchesDrawn;
  285. }
  286. [Obsolete(DeprecationMessage.CompatibilityScriptingAPIObsolete, false)]
  287. public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
  288. {
  289. var isLitView = true;
  290. #if UNITY_EDITOR
  291. if (renderingData.cameraData.isSceneViewCamera)
  292. isLitView = UnityEditor.SceneView.currentDrawingSceneView.sceneLighting;
  293. if (renderingData.cameraData.camera.cameraType == CameraType.Preview)
  294. isLitView = false;
  295. #endif
  296. var camera = renderingData.cameraData.camera;
  297. var filterSettings = FilteringSettings.defaultValue;
  298. filterSettings.renderQueueRange = RenderQueueRange.all;
  299. filterSettings.layerMask = -1;
  300. filterSettings.renderingLayerMask = 0xFFFFFFFF;
  301. filterSettings.sortingLayerRange = SortingLayerRange.all;
  302. LayerUtility.InitializeBudget(m_Renderer2DData.lightRenderTextureMemoryBudget);
  303. ShadowRendering.InitializeBudget(m_Renderer2DData.shadowRenderTextureMemoryBudget);
  304. RendererLighting.lightBatch.Reset();
  305. var isSceneLit = m_Renderer2DData.lightCullResult.IsSceneLit();
  306. if (isSceneLit && isLitView)
  307. {
  308. var combinedDrawSettings = CreateDrawingSettings(k_ShaderTags, ref renderingData, SortingCriteria.CommonTransparent);
  309. var normalsDrawSettings = CreateDrawingSettings(k_NormalsRenderingPassName, ref renderingData, SortingCriteria.CommonTransparent);
  310. var sortSettings = combinedDrawSettings.sortingSettings;
  311. RendererLighting.GetTransparencySortingMode(m_Renderer2DData, camera, ref sortSettings);
  312. combinedDrawSettings.sortingSettings = sortSettings;
  313. normalsDrawSettings.sortingSettings = sortSettings;
  314. var cmd = renderingData.commandBuffer;
  315. cmd.SetGlobalFloat(k_HDREmulationScaleID, m_Renderer2DData.hdrEmulationScale);
  316. cmd.SetGlobalFloat(k_InverseHDREmulationScaleID, 1.0f / m_Renderer2DData.hdrEmulationScale);
  317. cmd.SetGlobalColor(k_RendererColorID, Color.white);
  318. cmd.SetGlobalTexture(k_FalloffLookupID, m_FallOffLookup);
  319. cmd.SetGlobalTexture(k_LightLookupID, Light2DLookupTexture.GetLightLookupTexture());
  320. RendererLighting.SetLightShaderGlobals(m_Renderer2DData, CommandBufferHelpers.GetRasterCommandBuffer(cmd));
  321. var desc = this.GetBlendStyleRenderTextureDesc(renderingData);
  322. ShadowRendering.CallOnBeforeRender(renderingData.cameraData.camera, m_Renderer2DData.lightCullResult);
  323. var layerBatches = LayerUtility.CalculateBatches(m_Renderer2DData.lightCullResult, out var batchCount);
  324. var batchesDrawn = 0;
  325. for (var i = 0; i < batchCount; i += batchesDrawn)
  326. batchesDrawn = DrawLayerBatches(layerBatches, batchCount, i, cmd, context, ref renderingData, ref filterSettings, ref normalsDrawSettings, ref combinedDrawSettings, ref desc);
  327. RendererLighting.DisableAllKeywords(CommandBufferHelpers.GetRasterCommandBuffer(cmd));
  328. context.ExecuteCommandBuffer(cmd);
  329. cmd.Clear();
  330. }
  331. else
  332. {
  333. var unlitDrawSettings = CreateDrawingSettings(k_ShaderTags, ref renderingData, SortingCriteria.CommonTransparent);
  334. var msaaEnabled = renderingData.cameraData.cameraTargetDescriptor.msaaSamples > 1;
  335. var storeAction = msaaEnabled ? RenderBufferStoreAction.Resolve : RenderBufferStoreAction.Store;
  336. var sortSettings = unlitDrawSettings.sortingSettings;
  337. RendererLighting.GetTransparencySortingMode(m_Renderer2DData, camera, ref sortSettings);
  338. unlitDrawSettings.sortingSettings = sortSettings;
  339. var cmd = renderingData.commandBuffer;
  340. using (new ProfilingScope(cmd, m_ProfilingSamplerUnlit))
  341. {
  342. CoreUtils.SetRenderTarget(cmd,
  343. colorAttachmentHandle, RenderBufferLoadAction.Load, storeAction,
  344. depthAttachmentHandle, RenderBufferLoadAction.Load, storeAction,
  345. ClearFlag.None, Color.clear);
  346. cmd.SetGlobalColor(k_RendererColorID, Color.white);
  347. for (var blendStyleIndex = 0; blendStyleIndex < k_ShapeLightTextureIDs.Length; blendStyleIndex++)
  348. {
  349. if (blendStyleIndex == 0)
  350. cmd.SetGlobalTexture(k_ShapeLightTextureIDs[blendStyleIndex], Texture2D.blackTexture);
  351. RendererLighting.EnableBlendStyle(CommandBufferHelpers.GetRasterCommandBuffer(cmd), blendStyleIndex, blendStyleIndex == 0);
  352. }
  353. }
  354. RendererLighting.DisableAllKeywords(CommandBufferHelpers.GetRasterCommandBuffer(cmd));
  355. context.ExecuteCommandBuffer(cmd);
  356. cmd.Clear();
  357. Profiler.BeginSample("Render Sprites Unlit");
  358. if (m_Renderer2DData.useCameraSortingLayerTexture)
  359. {
  360. filterSettings.sortingLayerRange = new SortingLayerRange(short.MinValue, m_CameraSortingLayerBoundsIndex);
  361. Render(context, cmd, ref renderingData, ref filterSettings, unlitDrawSettings);
  362. CopyCameraSortingLayerRenderTexture(context, renderingData, storeAction);
  363. filterSettings.sortingLayerRange = new SortingLayerRange((short)(m_CameraSortingLayerBoundsIndex + 1), short.MaxValue);
  364. Render(context, cmd, ref renderingData, ref filterSettings, unlitDrawSettings);
  365. }
  366. else
  367. {
  368. Render(context, cmd, ref renderingData, ref filterSettings, unlitDrawSettings);
  369. }
  370. Profiler.EndSample();
  371. }
  372. filterSettings.sortingLayerRange = SortingLayerRange.all;
  373. RendererList objectsWithErrorRendererList = RendererList.nullRendererList;
  374. RenderingUtils.CreateRendererListObjectsWithError(context, ref renderingData.cullResults, camera, filterSettings, SortingCriteria.None, ref objectsWithErrorRendererList);
  375. RenderingUtils.DrawRendererListObjectsWithError(CommandBufferHelpers.GetRasterCommandBuffer(renderingData.commandBuffer), ref objectsWithErrorRendererList);
  376. }
  377. Renderer2DData IRenderPass2D.rendererData
  378. {
  379. get { return m_Renderer2DData; }
  380. }
  381. public void Dispose()
  382. {
  383. m_Renderer2DData.normalsRenderTarget?.Release();
  384. m_Renderer2DData.normalsRenderTarget = null;
  385. m_Renderer2DData.cameraSortingLayerRenderTarget?.Release();
  386. m_Renderer2DData.cameraSortingLayerRenderTarget = null;
  387. }
  388. }
  389. }